Question
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.
Answer :
Word Count : 122
_________ _________ _______ ____ _____ ________ _____ _____ _____ ______ ____.
__________ ______ _________ ______ __________ ____ _________.
_______ _________ ______ ____ ___.
______ _____ ______ ____ ________ ________ __________ __________ ___ ______.
________ ____ ______ ___ ___ _______ ________ _______ ____.
_________ ____ __________ __________ ______ _________ ______ __________.
________ ___ ___ _____ ____ ______ ____ _________ ___ ______ ________.
__________ ____ _______ ____ _______ _______ ______ ________ _______ _______.
_______.
Skip in 10
class Engine { private String chassisNumber; private String make; ``` public Engine(String chassisNumber, String make) { this.chassisNumber = chassisNumber; this.make = make; } @Override public String toString() { return "Engine [Chassis Number=" + chassisNumber + ", Make=" + make + "]"; } ```
______ ____ __________ ____ ______ __________ _______._________ _________ _______ ____ _____ ________ _____ _____ _____ ______ ____.
__________ ______ _________ ______ __________ ____ _________.
_______ _________ ______ ____ ___.
______ _____ ______ ____ ________ ________ __________ __________ ___ ______.
________ ____ ______ ___ ___ _______ ________ _______ ____.
_________ ____ __________ __________ ______ _________ ______ __________.
________ ___ ___ _____ ____ ______ ____ _________ ___ ______ ________.
__________ ____ _______ ____ _______ _______ ______ ________ _______ _______.
_______.
IGNOU ACADEMY
Your IGNOU journey, made easier.
- Solved Assignments
- Study Notes
- Guess Papers
- Question Papers
Continue Reading — It's Free
Sign in with Google to unlock more of this answer.
✓ Free access
✓ Unlock up to 60% of the answer
✓ No payment required
✓ Unlock up to 60% of the answer
✓ No payment required
Quick Google sign-in. No separate registration form.