Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write an application file named JohnDoeTest.java, which has a main method. This

ID: 3706754 • Letter: W

Question

Write an application file named JohnDoeTest.java, which has a main method. This main creates an array of RentalItem class type with a size of 4. Populate this array with two instances of car objects and two instances of tool objects, and in that order. Use constructor that has all parameters.

Then in the main method, use a loop to navigate through this array, and for each loop iteration, output the id, description, and rental fee of each item.

**Use another loop to calculate the total rental fee of all items in the array, and after the loop finishes, output the total rental fee.

Explanation / Answer

//JohnDoeTest.java public class JohnDoeTest { public static void main(String args[]){ RentalItem rentalItem[] = new RentalItem[4]; rentalItem[0] = new Car(1,"description1",12.34); rentalItem[1] = new Car(2,"description2",142.364); rentalItem[2] = new Tool(3,"description3",512.834); rentalItem[3] = new Tool(4,"description4",162.394); for(int i = 0;i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote