-1

该程序的目的是创建一个帐户程序来指示每月 2 个问题。我记录了月份输入,现在问题是..如何编写循环以重复询问两个问题并在输入数字设置的月份停止?

System.out.println("How many months had passed since the account was established?");
months = keyboard.nextInt();     



//count should be months, not sure how to word it from the month input.
int count=0; for(count=0;count<13;count++)
{ System.out.println("How much did you deposit this month?");

System.out.println("How much did you withdraw this month?");

System.out.println("Your monthly interest is");




 } 
4

1 回答 1

0

我认为这就是您要寻找的东西,但很难说...

for(int count=0;count<months;count++) { 
  System.out.println("How much did you deposit this month?");
  deposit = scanner.nextDouble();

  System.out.println("How much did you withdraw this month?");
  withdraw = scanner.nextDouble();

  //Do the math here....

  System.out.println("Your monthly interest is" + result);

 } 
于 2013-07-11T17:49:30.130 回答