Course Hero Logo

Lab 10 Classes and Constructors.pdf - CT044-3-1-IOOP Lab 10...

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 1 - 2 out of 2 pages.

CT044-3-1-IOOPLab 10Classes and ConstructorsPage 1 of 2Level 1Asia Pacific University of Technology and Innovation1.Car ClassCreate a class namedCarthat has the following properties:YearThe Year property holds the car’s year modelModel- The Model property holds the model of the carSpeed-The Speed property holds the car’s current speedIn addition, class should have the following constructor and other methods:Constructor-The constructor should accept the car’s year and model and make them as arguments.These values should be assigned to the memberfields for the object’s Year andModel properties.The constructor should also assign 0 to the member field for the Speed property.Accelerate-The Accelerate method should add 5 to the Speed property’s backing field each timeit is calledBrake- The Brake method should subtract 5 from the Speedproperty’s backing field each time itis called

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 2 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Summer
Professor
N/A
Tags
Object Oriented Programming, English language films, Asia Pacific University of Technology and Innovation

Newly uploaded documents

Show More

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture