007-002-009
Instantiation: Multiple Vehicle Management
Medium
Problem Description
Class Creation: Vehicle Class Design
In this problem, you will design a Car class representing a vehicle. It has fields for the model name (model) and year (year), and a display() method that prints the vehicle information.
Learning Objective: Design a class with fields and methods that holds independent data per instance
Overview
Design a Car class to manage vehicle information. The class allows external code to set field values and outputs information via the display() method.
Specifications
Car Class
- Fields:
String model(model name),int year(year) - Method:
void display()- Print in format "Model: [model], Year: [year]" to standard output
Example Output
Model: Civic, Year: 2020
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up