How would a for loop that adds the even numbers


Problem

I. How would the loop codes including any required and/or dependent variables for the following look like?:

i. Count down from 10 to Blast Off!, printing each number on its own line. Use a while loop.

ii. Count down from 10 to Blast Off!, printing each number on its own line. Use a for loop instead.

iii. Replace the lowercase letter e from each user entered String, replacing it with an underscore and printing the new String. Allow the user to enter as many Strings as they want. Choose a good sentinel value.

iv. Count up by a given number from 0 to another given number. For example, the user may enter 5 and 30 and the loop should produce: 5, 10, 15, 20, 25, 30 then stop.

v. How would a for loop that adds the even numbers from 0 to 100, then prints the final result only look like?

II. Alex needs to write two programs where one with the main method (Garage.java) uses an ArrayList of objects to contain several cars. He needs to ensure the user should be able to add a car to the garage, print the contents of the garage, get the value of the cars in the garage, and remove (such as selling) a car from the garage. While the Cars.java class includes the attributes of cars such as its price. What would the getters and setters look like and how to write the toString() method appropriately so when he wants to print a car, it makes sense to the user?

It would be best if one can provide a detailed explanation to gain a better understanding of while loops, for loops, ArrayList. I would also really appreciate it if you could provide comments for each line of code so that I understand for future similar problems.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: How would a for loop that adds the even numbers
Reference No:- TGS03319602

Expected delivery within 24 Hours