Question: Create a class named Car with name and year as its properties. Create the class functions set _ name ( ) , get _ name

Create a class named Car with name and year as its properties. Create the class functions
set_name(), get_name(), set_year(), and get_year(). These functions should be self
explanatory (e.g get_name gets the name and set_name sets the name of the car). Create
an instance of your class with the object name, $ford. Set its name as Ford and the year as
2021.
Print the name and year by accessing the object's properties. Print using the format:
Name - Year.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!