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() {
return chassisNumber;
}
public String getMake() {
return ________ _____ _________ ___ ________.
__________ __________ _____ __________ ____.
________ _______ ________ __________ ___ ______ ________ __________ ____.
________ _____ _________ _____ ______ _____ ____ ____.
__________ __________ ________ ____ __________ ____.
____ _________ ______ __________ _____ _________ ____ ______ _____ _____ ___.
____ _____ __________ _____ _________ _________ ________ ____.
_______ ___ _________ _______ ________ _____ ________ _________.
_________ _______ ___ ________ ____ __________.
__________ _______ _____ _________ ______ ______ _____ _________ _____ ___ ________ ________.
_________ ____ _______ _______ _____ _____ ____ _______.
_________ _______ __________ ____ _____ _____.
_________ _______ ________ __________ _______ ___ __________ _____ __________ _________.
__________ _____ _____ _________ ___ ________ _______ ___.
_________ ____ _____ _______ _____ _______ _______ ________ _____ ____ _____ ______.
___ ______ _________ _______ ______.
___ _________ ___ ___ _____ _____ ___ ____ ________ _________.
________ _______ _______ _____ ____ _____ ______ _______ _________ ____.
____ ____ __________ ______ __________ ________.
___ _______ _________ _________ ______.
___ _________ ________ _______ _________ ____ ________.
___ ________ _________ ____ ___ ____ _______ _____ ________ ________.
__________ ____ _________ _________ _______ _____ ____ _______ _____ ____.
________ ________ ________ ____ ____ ________.
____ ____ ____ ______ _________ _______ ______ _________ ________ _______.
_____ ___ _________ ____ __________ ______ _______ ________ ___ __________ ______.
______ _______ ________ ____ _________ ______ _____ ____.
_________ ______ _____ ____ __________ ___ _______.
______ ___ ____ ____ _________ _________ ________ ____ ___ ___ ___.
___ ______ __________ ____ _________ _____ _________ ____.
____ _______ ________ _______ ___ ______ ____ _____ ____ _______.
____ _______ _______ ___ __________ _________ ________ _____ _______.
_____ ____ __________ ______ ____ ______ ______.
____ ________ _________ ____ ____.
_____ ______ _________.
Get Full Answer on WhatsApp