Assigment1 Answer
Assigment1 Answer
Course CS221
Assigment 1
START
LET Items is the character representing the type of items in the mart
LET price of milk is a real number representing the total price of milk purchased
LET couponCode is a character representing the coupon code for bread that is R
or N
LET price of bread is a real number representing the total price of breads
purchased
LET price of egg for FullDozen is a float representing the price full dozens of eggs
purchased
LET Total price egg is a rational number representing the total price of half dozen
and full dozeneggs
LET Discount is the real number representing the discount given for the eggs
LET number of ToiletPaper is the integer representing the amount of toilet paper
LET ToiletPaper price is a real number representing the total price of toilet paper
purchased
LET ToiletPaper tracker is a real number that stores the number of toilet papers
purchashed
LET price of toilet paper on extra credit is a real number represnting the price of
toilet paper with extra credit
DO //this is the loop used to repeat the menu until the user selects to exit
WHILE item != 5
GET item
GET item
END WHILE
IF item=1 THEN// this if statment calculates the price of milk based on conditions
DISPLAY"please enter the amount of gallons you want"
GET gallon
GET gallon
END WHILE
Price of milk=gallon*6.25
ELSE IF item=2 THEN //this if statment calculates the price of bread based on the
given conditions
GET loaf
GET loaf
END WHILE
DO
Price of bread=loaf*2.25
END IF
ELSE IF item==3 THEN //this if statment calculates the price of egg based on the
given conditions
DO
GET dozen
GET dozen
IF dozen==1 THEN
END IF
IF dozen==2 THEN
DISPLAY"please enter how many half dozens you want"
END WHILE
END IF
ELSE IF item==4 THEN //this if statment calculates the price of toilet paper based
on the given conditions
DO
END IF
// this stores the amount of toilet paper entered and adds the new amount of
toilet paper entered to keep the number of oilet paper sold in track
END IF
ElSE IF item==5 THEN//all the total price is displayed after we are out of the loop
DISPLAY"total price"total
STOP