Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Date: 4/10/2022

Group name: Ralph Mejia, Isaac Bernal, Carlos Molina


Analysis:
What the program does is read from what is displayed in the Text-file and display it in the order
the user wants it displayed as. In the program code, the problem is how to have the user enter and
choose a choice of how the inventory store should be sorted. The program will also provide how
the code will display how the items will sort. They will either sort by item name or item id.
Another problem we will solve is how to have the resulting text file information of item id,
name, and price being able to sort in an ascending order. What can be done to start with code is
to use a switch case for the user to pick whether they want to search the inventory by item id or
by item name. We may have to include an inner switch case, or an if else, to decide whether the
user wants to pick from the inventory info to display the item id, the name, or the price in
ascending order. We must also include an input-file fail if the code is unable to find the file, and
maybe a loop to validate for any negative numbers. Lastly, we may need to use a while loop to
have the user type all of his desirable items by id or name and display all the inventory
information from what the user entered.

Algorithm:
Step 1:List maybe/directives needed

● Include <iostream>

● Include <string>

● Include <fstream>

● Include <iomanip>

● Include “Menu.h”

Step 2: List the main variables needed

● A menu class with private members

● An array for storing the inventory items from the class

● ifstream to access and read text file


● A char variable to for the user inputs of which option of their choosing

● Another char to access the while loop to start program again


Step 3: Prompts

● Ask the user for how they wants to search the inventory list by item id or
item name
● Displays an error prompt when entering wrong or negative numbers /
validations
● OR

● Then prompts the user on what they want to be displayed in ascending order:
the item id, the item name, or the item price or for all items to be displayed
in unsorted order.

● Any other objective needed to do

Step 4: Output result

● Display the certain inventory items on what the user types and the types of
order display on what the user picks
● Asks user if needed to do anything else

● Says Thank You

You might also like