Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN C++ Create a base class for transit system, called Automobile. Automobile has derived classes which is bicycle and Train.Both use a base class access

IN C++

Create a base class for transit system, called Automobile. Automobile has derived classes which is bicycle and Train.Both use a base class access spec of protected.

Automobile memb:

protected:

Automobile ID (str) manufacturer (str)capacity (int) status (char)

public:

constructor takes in Automobile ID, manufacture, capacity,

status virtual display information on automobile function

virtual destructor

Bicycle members:

Private

mileage (int) tire size (str) fuel type (str)

public: constructor intakes mileage, tire size, and fuel type, in addition to the 4 parameters for automobile

virtual display information on bicycle-type automobile function.

virtual destructor

Train members:

Private members:

power on time in hrs (int) motor type (str) next wheel inspection date (str)

Public members:

constructor taking hrs, motor type and wheel date, in addition to the four parameters for Automobile

virtual display information on train-type automobile function

virtual destructor

Process of Input:

Enable main to read file records and represent set of Automobile objects.Some automobiles are bicycle,some train.Automobile are each dynamically allocated and also is managed by pointer array. Ptr array holds 50 elements.

AutomobileID, manufacture, capacity status bicycle/train indicator (i or t) if i, then mileage,size of the tire along with fuel type if t, then power on time, type of motor alongside coming up inspection date.

Input should not exceed 49 and >> operator should be put into use.

Sample Output:

4567 Gig 100 a b 120000 22S11.5 78nl

S9191 Storm 70 i r 80000 500ac 2016/10/17

While main reads a record for a Bicycle, a bicycle object gets created. When it reads for train, train object gets created. Input info shall all be passed to the constructor for the Bicycle or Train and have the constructor pass to the right fields of the Automobile constructor. As main reads user input, a report of such should be made.

Automobile Report

Auto. Type ID Mfr Capacity Status Mileage Tire Size Fuel Type

Bicycle 45678 Gig 100 a 120000 22S11.5 34 nl

Auto Type ID Mfr Capacity Status Power Time Motor Type Insp Date

Train S9191 Storm 70 a 80000 500ac 2016/10/17

Report should be made from looping through a pointer array while also citing the virtual display function.Virtual display function is for the Bicycle and Train classes. They are able to get through to all members of the objects without putting getter and setter into use.

Data.txt

45678 Gig 100 a i 200000 22S11.5 34nl

S9191 Storm 70 a r 80000 500ac 2016/10/17

24098 Nightangle 300 m i 230000 10S43 2d

S8151 Wagon 15 a r 34000 100bc 2007/2/10

76506 Flex 210 m i 125200 10S19.3 3d

L3434 B&F 450 a r 67200 100bb 2011/03/06

76123 Deter 85 a i 310000 17R456 12nl

F3434 Bombardier 105 m r 60000 350dc 2018/11/01

56789 Ford 90 a i 250000 13R21.5 2d

G3434 Budd 110 a r 90000 650ac 2012/05/01

Seperate in 3 files

main.cpp

automobile.hpp

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

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

Students also viewed these Databases questions

Question

Describe the four-step process of customer relationship management.

Answered: 1 week ago

Question

4-56. Our computers are serviced by the Santee Company.

Answered: 1 week ago