Documente Academic
Documente Profesional
Documente Cultură
FRISNEDI, NADINE T.
PROF.
GENNESIS JOY G. CEREDON
FEBRUARY 4, 2014
PROBLEM ANALYSIS
The Lab Activity is about designing a program using loops. That program
should simulate an order room of a factory. The programmer is tasked to create a
program that can record items and its price which was ordered by the user. The
program will continue asking the same two questions. When the user is done
encoding the items and prices, he/she can stop the program by inputting 999 when
prompted again with this: Please scan the name of the next item:. The program
will tell the user: Thank you for your order. The results should be in an output file.
The first program ends in that process.
The second program will be using the output file from the previous program.
The program will prompt the user to enter the name of the item and it will search for
that item. It will display the item name and the price. The program will continue
asking the question and display the name and price. If there is an item you have
inputted but not included in the input file, the program will tell the user: The item
was not found.. The second program should end in this way.
The third program is going to use mostly the functions in the second program.
I should read the item name and price. It should also accumulate all the prices in
the input file. It should display each name, and price, total count and total amount
in currency format. The resulting program should be copied also in the code as a
comment.
Algorithm Design
2a-2c.
1. Use the required pre-processor directives such as <fstream> for files.
2. Set variables for all.
3. Declare stream variable for output file.
4. Prompt the user for the name of an item.
5. Prompt the user for the price of the item.
6. For the output file, set the variable needed to be displayed and the separator
of the name and price, #.
7. Use while loop.
8. Set condition of loop, that when 999 is entered for the value of the variable
item which is the name of the item to be ordered, the program will stop and
display a default message. (if statement)
9. If not, the program will continue asking the user to enter the name and price
of items. (else)
10.
11.
3a-3c
1. Use the required pre-processor directives such as <fstream> for files.
2. Set variables for all.
3. Declare stream variable for input file.
4. Open input file.
5. Prompt the user for the name of an item.
6. Use while loop.
7. Checking if the item name exists or not