Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program using C++ 9 Description: You are the owner of a new store and need to keep track of your inventory. Since

Write a C++ program using C++ 9

Description:

You are the owner of a new store and need to keep track of your inventory. Since you are a seasoned C++ programmer, you are going to write a C++ program to perform this function.

Define a structure that will hold a a part number (integer), description of the item (string), a quantity (integer), and price per item (float), and a total cost.

Your program is to check to see if the file called inventory.txt already exists and if it does, read it into an array of structures. Otherwise, it will create a new file. The program should have a menu that asks the user to 1) print parts 2) enter a new part 3) modify a part 4) print inventory total 4) exit the program. If the user enters 1, all of the parts will be printed to the screen. If the user enters 2, the program will ask the user for the description, quantity, and price per item and calculate the total cost. If the user selects 3, the program should ask the user for the part number to be modified and all of the new information for that part. If the user selects 4, you are to print the total cost of the inventory items to the screen. When the user selects 5 to exit the program, you are to write each record to the text file inventory.txt.

Structure member definitions:

part number is an integer that can hold part numbers from 1 to 100 generated by your program.

item is a string that may have spaces

quantity is an integer that will contain how many of the part is in inventory

price will be a float that will contain the cost per item

total cost will be a float that will hold the total cost of the item which the program will calculate

Requirements:

Create an array of structures containing the structure members as defined above

The program needs to be able to handle data for up to 100 parts.

Read the data from the file inventory.txt and save each part record in a structure in your array.

The part name should be able to contain spaces.

Sample output if 1 selected

1 hammer 2 $ 10.00 $ 20.00

2 drill press 1 $100.00 $100.00

Sample input if 2 selected

Enter item: block sander

Enter quantity: 3

Enter cost: $50.00

Sample input if 3 selected

Enter part to modify: 1

1 hammer 2 $ 10.00 $ 20.00

Enter item: hammer

Enter quantity: 3

Enter cost: $10.00

Sample output if 4 selected

Total cost of inventory: $290

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

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

1st Edition

1597496251, 978-1597496254

More Books

Students also viewed these Databases questions

Question

6. What is process reengineering? Why is it relevant to training?

Answered: 1 week ago