Following the examples of listing 9.8 and 9.9 in Section 9.9 in the textbook, write a program in Java to compute the following properties of automobiles: average gas mileage, lowest price, the lates

Following the examples of listing 9.8 and 9.9 in Section 9.9 in the textbook, write a program in Java to compute the following properties of automobiles: average gas mileage, lowest price, the latest model. The program must have the following: A class named Automobile, One constructor function that initializes the model year only. A method to set the gas mileage and price for the object variables. Three separate methods to compute the results (average gas mileage, lowest price, latest model) and show the outputs. The Main function will stay in another class from where the constructors and all other methods will be invoked through three objects named: sedan, minivan, and truck.  Inputs are to be taken inside the Main function from the keyboard. The program will show the outputs on the screen.Sample Input (from keyboard):Enter the model year for sedan: 2012Enter the gas mileage for sedan: 35Enter the price for sedan: 20000Enter the model year for minivan: 2013Enter the gas mileage for minivan: 26Enter the price for minivan: 18000Enter the model year for truck: 2010Enter the gas mileage for truck: 21Enter the price for truck: 17000 Sample Output (on screen):Avg gas mileage: 27.33Lowest price: 17000Latest model: 2013Problem 1 (B) [5 points]: Following the example “Array of Objects” (attached to this assignment), modify the problem 1 (A) by creating an array of three objects. Rests of the functionalities, I/O, remain unchanged.Problem 2: Create a Person classFollowing the examples of listing 9.8 and 9.9 in Section 9.9 in the textbook, create a Person class that has private name and age fields (member variables). Both fields should have associated getter methods and should be set by a constructor when the object is created.Problem 2 (A) [5 points]: Following the examples of listing 9.8 and 9.10 in Section 9.10 in the textbook, create a new method (not in the Person class) that takes a Person and an age and prints a message indicating whether the person is at least that old.Sample Input:Person p1 = new Person (“Alice”, 23);checkage (p1, 17);Person p2 = new Person (“Trudy”, 47);checkage (p2, 50);Person p3 = new Person (“Jonathan”, 35);checkage (p3, 35);Sample Output:Alice is at least 17 years old!Trudy is not yet 50 years old.Jonathan is at least 35 years old!Problem 2 (B) [5 points]: Following the examples of listing 9.8 and 9.11 in Section 9.11 in the textbook, create a new method (NOT in the Person class) that searches through an array of Person objects and prints the name of the oldest one.

Show more