Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learn Mysql The Easy Way A Beginner Friendly Guide

Authors: Kiet Huynh

1st Edition

B0CNY7143T, 979-8869761545

More Books

Students also viewed these Databases questions