Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4 Hierarchical Records Use program Cars for Exercises 4 - 5 . Run the program. Show the content of the output file cars - out.

4 Hierarchical Records
Use program Cars for Exercises 4-5.
Run the program. Show the content of the output file cars-out.
Exercise 5:
Modify the CarType struct to add a Boolean type member called sold and a DateType member called
soldDate. In the GetCar function, initialize sold to false. In the while loop in function main, ask user
whether the car has been sold for each car record read from cars.dat. If the car is not sold, write the record
to cars.out with the price increased by 10% as before. If the car is sold, call function CarSold. The void
function CarSold takes one parameter of CarType. It should ask the user when the car was sold, and
update two members of the reference parameter of CarType: set sold to true, and set soldDate with the
sold date entered by user, then write the updated record to file carssold.out instead of cars.out. Run your
program using file cars.dat and show your test results with I/O in console window, contents in
carssold.out and cars.out. You can assume that Mary's and Betty's cars have been resold. Include your
modified C++ program in the report.
image text in transcribed

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

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

More Books

Students also viewed these Databases questions

Question

Question How are IRAs treated for state tax law purposes?

Answered: 1 week ago