Question
C++ coding 1. A) Develop a Vehicle class with these data members and member functions: modelYr vehicles model year, int make make of the vehicle,
C++ coding
1. A)Develop a Vehicle class with these data members and member functions:
- modelYr vehicles model year, int
- make make of the vehicle, string
- speed vehicles current speed, int
- parameterised ctor parameters are model year and make; ctor assigns to corresponding data members and assigns 0 to speed data member
- accessors appropriate accessor fns to return values stored in an objects member data
- accelerate() adds 5 to the speed data member each time it is called
- brake() subtracts 5 from the speed data member each time it is called
- print() outputs to the screen the make and model year each time it is called
Build and execute the driver program that creates one or more Vehicle objects and invoke the print() member function. In a loop call accelerate() five times and after each call get the current speed and display it; in a second loop call brake() five times and after each call get the current speed and display it.
B) Develop a class that contains personal data: name, address, age, and phone number; write appropriate accessor and mutator functions. In your driver program invoke the parameterized ctor, declare an array with at least three Personal objects (invoke default ctor for each array element), and populate the array via user input. Use a member function to output all Personal objects. Be sure to exercise all member functions. See docs skeletal driver program and sample output below.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started