私はとても新しいです。コーディングについて事前にお詫び申し上げます。年を表示し、次にタブを表示し、次に値を次の行で表示するテーブルを印刷する必要があります。値は10進形式である必要があります。私は自分のコードを読んで検索し、混ぜ合わせてきました。1つの変数で見つかりましたが、同じ行の2つの変数では見つかりませんでした。printfを試しましたが、良いol 100 / 100.0を試しましたが、エラーが発生するか、小数点以下2桁になりません。丸みを帯びる必要はありません。あと2スペースだけです。私は明らかにどこかで間違っています。何か助けていただければ幸いです。java.util.Scannerをインポートします。
public class Investment1 {
public static double futureInvestmentValue(double investmentAmount, double monthlyInterestRate, int years){
double principal = 0.0;
double futureInvestmentValue = 0;
for (years = 1; years <=30; years++){
    //calculate futureInvestmentValue
    futureInvestmentValue = (investmentAmount * (Math.pow (1 + monthlyInterestRate, years * 12)));
    System.out.print(years + "\t" + futureInvestmentValue + "\n");
}//end for
    return futureInvestmentValue;
}//end futureInvestmentValue
public static void main(String[] args){
    Scanner input = new Scanner (System.in);
    //obtain Investment amount
    System.out.print("Enter Investment amount: ");
    double investmentAmount = input.nextDouble();
    //obtain monthly interest rate in percentage
    System.out.print("Enter annual interest rate in percentage: ");
    double annualInterestRate = input.nextDouble();
    double monthlyInterestRate = (annualInterestRate / 1200);
int years = 30;
System.out.println("Years\t" + "Future Value");
System.out.print(years + "\t");
System.out.print(years + "\t" + ((int)(futureInvestmentValue(investmentAmount, monthlyInterestRate, years))) + "\n");
}//end main
}//end Investment