In: Computer Science
I am given this starter code and I am suppose to debug it and all of that and it will not work after I change ">" to "<=" and then i'm not sure after that what else I have to do. Could someone help me solve this?
// Start with a penny
// double it every day
// how much do you have in a 30-day month?
public class DebugSix1
{
public static void main(String args[])
{
final int DAYS = 30;
double money = 0.01;
int day = 1;
while(day > DAYS);
{
money = 2 *
money;
++days;
System.out.println("After day " + day +
" you have " + moneyAmt);
}
}
}
That is the starter code. This is with the Java Programming 9th edition by Joyce Farrel and the other tutorials i have found do not show it with this starter code so I am confused.
// Start with a penny // double it every day // how much do you have in a 30-day month? public class DebugSix1 { public static void main(String args[]) { final int DAYS = 30; double money = 0.01; int day = 1; while (day <= DAYS) { money = 2 * money; System.out.println("After day " + day + " you have " + money); ++day; } } }