1. A. Write an application that counts by five from 5 through 200 inclusive, and
ID: 3543729 • Letter: 1
Question
1. A. Write an application that counts by five from 5 through 200 inclusive, and that starts a new line after every multiple of 50. Save the file as CountByFives.java
B. Modify the CountByFives application so that the user enters the value to count by. Start each new line after 10 values have been displayed. Save as CountByAnything.java
10. A. Write an application that prompts a user for the number of years the user has until retirement and the amount of money the user can save annually. If the user enter 0 or a negitive number for either value, reprompt the user until valid entries are made. Assume that no interest is earned on the money. Dispaly the amountof money the user will have at retirement.
B. Modify the RetirementGoal application to display the amount of money the user will have if the user earns 5% interest on the balance every year.
Explanation / Answer
1.A.
public class CountByFives {
public static void main(String args[]) {
for (int i = 5; i <= 200; i = i + 5) {
System.out.print(i+",");
if (i % 50 == 0) {
System.out.println();
}
}
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.