I need the solution for FixDebugSix1.java and it\'s not posted in Chegg Answers.
ID: 3759218 • Letter: I
Question
I need the solution for FixDebugSix1.java and it's not posted in Chegg Answers. The coding is from the file listed in Java Programming Joyce Farrel 7th Edition, Problem is on Page # 346, under Debugging Exercise.
The following the coding for DebugSix1.Java:
// DebugSix1.java
// 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);
}
}
}
Explanation / Answer
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+=1;
}
}
}
At the end of 30 days we have 1.073741824E7 money
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.