Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In c++ and please include the text files you used. 2. Write a class named lEar that has the following member variables: - ownera string

In c++ and please include the text files you used.

image text in transcribed
2. Write a class named lEar that has the following member variables: - ownera string that holds the name of owner - yearModelan int that holds the car's year model - makea string that holds the make of the car - speedan int that holds the cans current speed such that speed 33 G. In addition, the class should have the following constructor and other member functions: - Constructor The constructor should accept the owner's name, car's year model and make as arguments and assigned to the object's member variables. The constructor should also assign a randomly generated integer [between 100 200, inclusive], to speed variable. - Destructor default - Acoessors and Mutators For all member variables - accelerate The accelerate function should add 5 to the speed member variable each time it is called. a brake The brake function should subtract 5 from the speed member variable each time it is called. - updateStatus The updateStatus function should generate a random integer D or 1. If the number is zero it calls brake function otherwise accelerate function. Create a text le carData.txt that contains owner's name, yearModel, and make for 5 cars. Write a program that reads data from a file and stores 5 car objects in an array. The program should display the information of each car on screen before the game start. The game starts when the program enters in a loop with 10 iterations. Every iteration of the loop calls updateStatus function of each car. At the end of iterations, display information of each car and announce the winner having highest speed. Store winner car's information in a file, winner.txt. NOTE: You also need to submit text files used in the program

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_2

Step: 3

blur-text-image_3

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

Explain Industrial market segment.

Answered: 1 week ago

Question

Explain the market segmentation.

Answered: 1 week ago