1. How would the loop codes including any required and/or dependent variables for the following look like?:...
Fantastic news! We've Found the answer you've been seeking!
Question:
1. How would the loop codes including any required and/or dependent variables for the following look like?:
- Count down from 10 to Blast Off!, printing each number on its own line. Use a while loop.
- Count down from 10 to Blast Off!, printing each number on its own line. Use a for loop instead.
- 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.
- 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.
- How would a for loop that adds the even numbers from 0 to 100, then prints the final result only look like?
2. 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 is 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?
Related Book For
Posted Date: