Design a class named Car, having registration number, model and engine as its private members. Here engine is an object of a class called Engine with the private members: Chassis number and make. Define a suitable constructor of Car and override to String () Method to print the details of a car. Assume appropriate data types for the instance members of the classes. Write a Java program to test the above class.
// Engine class
class Engine {
private String chassisNumber;
private String make;
// Constructor for Engine class
public Engine(String chassisNumber, String make) {
this.chassisNumber = chassisNumber;
this.make = make;
}
// Getter methods for Engine class
public String getChassisNumber() {
_______ ______ ________ _________ ________ _______ ______ ______ ____ _____.
________ ______ _____ _______ ________ ____.
______ _______ _______ _____ _____ ____ _________ ____ ________ _____.
_______ ________ _____ ____ _______ __________ _______ __________ ______ _______ _________ _______.
___ ________ __________ ______ _____ _____ __________ ________ ____ __________.
_________ ___ ____ ___ _________ _______ ______ _____ ___ _____.
______ _________ ______ ____ _______ _______ ______ ___ ________ ________.
__________ _________ __________ _________ __________ ___ __________ __________.
____ ________ ________ _________ ____ __________ _____ ___.
________ _____ __________ _______ __________ _________.
___ ___ ________ ________ ________ _____ ______ __________ ______ ___ ______ _____.
________ __________ _________ _____ ________ ______ _______ _____.
___ _____ __________ ___ ____ _______ ___ ________.
__________ ________ ______ _______ _________.
________ ________ ________ ____ ____ ________ _______.
________ _______ _______ _______ _________ ______ _________.
_____ ______ __________ __________ _________ ______ ______ ______.
_______ _________ ______ _____ _______ __________ ___ ________ _______ ________ ____ ______.
______ ____ _________ _________ ________ _______ _________ ____ ________ _________.
______ ___ _________ ____ _____ ____ ______.
______ ___ _________ _______ ___ _______ _____ _________.
_____ __________ ______ __________ ______ ______ ________ _________ ____.
_____ ____ _________ ______ __________ ________ __________ _____ _________ __________ ______ ______.
_____ ___ ________ ____ __________ _______ ______ _________ __________.
__________ _________ ______ _____ ___ ____ ___ ___.
______ ________ _____ ____ _______ ___ ____ ______.
_______ ___ _____ _______ ________ _____ ______.
__________ ____ ___ ________ ______ _________ _________.
__________ _______ ________ _______ _________ _____ ___ _________ __________ ____ ________ ________.
________ _______ ___ _________ _________ ____ ________ ______ ____ _________.
__________ ________ ____ ________ _________ _______ _____ _________ ____ __________ ________.
_______ ___ ____ _________ ___ _________ ____ ______ _____ _________ ________.
_________ ___ ___ ____ __________.
_____ _________ _____ __________ ___ ___ ______ _______.
Get Full Answer on WhatsApp