Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Objects, Structs and Linked Lists. Program Design: You will create a class and then use the provided test program to make sure it works.

C++ Objects, Structs and Linked Lists.

Program Design:

You will create a class and then use the provided test program to make sure it works. This means that your class and methods must match the names used in the test program.

Also, you need to break your class implementation into multiple files. You should have a car.h that defines the car class, a list.h, and a list.cpp. The link is a struct that is defined in list.h.

Remember that when writing a method outside of the class, you need to specify the class name in the method name.

Program Requirements

You need to define a class that defines a linked list of cars.

Your car class should have the following:

default constructor that sets up a 1910, Black, Ford

overloaded constructor that takes a string make, string color, and integer year

setters and getters for all three variables

Overloaded equality operator matches all three variables, return true if they match, false otherwise

Overloaded << operator that adds year, color, make to the provided output stream

Your list class should have the following:

a link struct that contains a pointer to next and a pointer to a car object

constructor that sets head to nullptr

a destructor that walks down the list and deletes any remaining links

addCar input is make, color, year. Creates a new car, creates a new link that points to that car, adds the link to the head of the list

findCar input is make, color, year. Creates a temporary car with those inputs. Uses the overloaded equality operator to check the list to see if such a car exists. Returns true if found, false otherwise

removeHead if list is empty, returns nullptr. Otherwise returns a pointer to the car at the head of the list and deletes that struct

displayList return a string containing the Cars in the list. Use the overloaded << operator to create this list. There should be a comma and space after each car.

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

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions

Question

What is conservative approach ?

Answered: 1 week ago

Question

What are the basic financial decisions ?

Answered: 1 week ago

Question

Analyze the impact of labor unions on health care.

Answered: 1 week ago

Question

Assess three motivational theories as they apply to health care.

Answered: 1 week ago

Question

Discuss the history of U.S. labor unions.

Answered: 1 week ago