Question: In this homework, you will create a code representation of an Auto Part. This will be used in an inventory system of car parts .
In this homework, you will create a code representation of an Auto Part. This will be used in an inventory system of car parts
. The Auto_Part Class
First you will create two C++ files called abc1234_Auto_Part.h and abc1234_Auto_Part.cpp. Below is a UML class diagram that shows the basic design of the Auto_Part class. The type field represents what type of part it is (tire, axle, seat, sparkplug, etc.).
The name field represents the name of the part (Firestone FR710, E3 Spark Plug, etc.).
The part number field corresponds to the inventory number of the part in the shop.
The price field represents how much that part sells for
. The default constructor assigns default values to the part (you get to pick the values).
The constructor assigns input parameters to the appropriate variables.
The accessor methods return the value that is in the function name.
The mutator methods set the value of the variable in the function name to the value of the input parameter.
The operator<< method formats output in the following way: Type: The main program You will create C++ file called abc1234_main.cpp consisting of a main function. This main program consists of a main function that should do the following: (you may have to write more loops then what is listed below, or more functions then just main) Create a list (vector) of Auto_Parts. Ask the user how many Auto_Parts to create. Create a loop that runs as many times as the user states. o For each iteration, ask the user for a type, name, part number, and price. o Create a part with those values. o Add that part to the list. Output to terminal each part in the list. Print out the average price for all parts in the list. When grading this, you do not know how many Auto_Parts the GTA will put in, so make sure your code can handle different numbers of Auto_Parts. Makefile You are REQUIRED to provide a simple makefile that can build AND execute your program given the command make. The sample code from lecture 5 is a good example of a makefile to use for the homework. The only command the GTA will type is make to run and execute your program. You will put all relevant files for the full credit portion of the homework in a folder called full_credit. Bonus question: Create a new folder called bonus and copy all files from the full credit directory in this directory. Implement the operator>> function in your Auto_Part class. This function will take an input stream as an input parameter. This function will read in input to create a new Auto_Part and return it. In your main, you will open the Auto_Parts.txt file that contains the information for many Auto_Parts. Each value will be separated by a comma. This file must be used as a Command Line Argument. Your main function will run the same as the full credit version except input will come from the file and not user input. Once that is complete, make a new makefile for this bonus to handle the command line arguments.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
