Question: Java Q6.2 Based on the Lecture 1 - exercise, please export one library (.jar) which contains Class PetrolPurchase and Class Car and import to the
Java


Q6.2 Based on the Lecture 1 - exercise, please export one library (.jar) which contains Class PetrolPurchase and Class Car and import to the solution in this new project - Reporting. In Reporting, create an object of Car and another object of Petrolpurchase. Define two methods which are both called as show and to use method overloading technique to display the information of the Car and the Pertolpurchase. Suggested JAVA program structure: public class Reporting { public static void main(String[] args) { Car c3 = new Car("Vw", 2015, 40000); //Applying the discount c3.setPrice(c3.getPrice() * 0.95); // create PetrolPurchase by constructor PetrolPurchase purchase3 = new PetrolPurchase("Taiwai", "Super", 10, 14.8, 10); //Show Information of car and purchase show(...); show(...); } public static void show...) { public static void show...) { } run: : The price of the Vw model 2015 after the discount is $3000.00 the net purchase amount = 133.20 @ Taiwai BUILD SUCCESSFUL (total time: 0 seconds) You should be able to show the result as above
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
