Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java8 programming, inheritance, object-oriented programming , please explain in detail, and also create a test program let it give the expected output 3. (10 points)
Java8 programming, inheritance, object-oriented programming , please explain in detail, and also create a test program let it give the expected output
3. (10 points) Free Response: Consider the following class: public class Vehicle { private String plate; private String owner; public Vehicle(String plate, String owner) { this.plate = plate; this.owner = owner; public String toString() { return "Plate #" + this.plate + " owned by " + this.owner; Write a new class, Truck, that is-a Vehicle. Your Truck class must function as follows: Vehicle firstVehicle = new Truck ("121", "Sheikh Kabeer", 7, 2020); System.out.println(firstVehicle); // Prints: Truck with Plate #121 owned by Sheikh Kabeer expires on 7/2020 Vehicle second Vehicle = new Truck ("634876", "John Smith", 10, 2022); System.out.println(secondVehicle); // Prints: Truck with Plate #634876 owned by John Smith expires on 10/2022 Note: Your solution must properly apply the principals of inheritance. Writing a Truck class that does not properly inherit from Vehicle and make use of Vehicle's methods and data will not receive pointsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started