Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PROGRAMMING PROJECT: BUY ITEMS Objectives: Use basic C + + constructs: if , switch, and repetition ( looping ) Perform simple data type manipulations Solve
PROGRAMMING PROJECT: BUY ITEMS
Objectives:
Use basic C constructs: if switch, and repetition looping
Perform simple data type manipulations
Solve problem, design solution and implement using C
Description:
Write a menudriven program named BuyItemscpp that provides the following options:
Buy items by asking for the items description, price per item and the quantity
Show receipts by listing all the purchases
Show summary by listing only the number of purchases and the total purchase cost
Requirements:
The program must produce the provided expected sample output.
The user must enter the correct access code which is one of the followings or
in order to start the program.
The program should NOT have any global variables
The program should have at least functions and some documentation including your
name and programs description
Required error handling:
The program MUST perform the following checks:
Caseinsensitive when to ask the user to confirm exiting the program eg accepting both
Y and y
Check for bad access code and allow up to trials.
Check for negative or invalid price andor quantity
Check for invalid menu answer
Sample program run
D:BuyItems
Welcome to my shopping program.
Please enter the access code:
Shopping Menu:
buy
show receipts
show summary
exit the program
Enter your option:
Invalid selection. Please try it again.
Shopping Menu:
buy
show receipts
show summary
exit the program
Enter your option:
Invalid selection. Please try it again.
Shopping Menu:
buy
show receipt
show summary
exit the program
Enter your option: Hello
Invalid selection. Please try it again.
Shopping Menu:
buy
show receipts
show summary
exit the program
Enter your option:
Please enter the description: Book
Please enter the quantity:
Please enter the price for each item:
ITEMBook QUANTITY PRICE$ COST$
Shopping Menu:
buy
show receipts
show summary
exit the program
Enter your option:
Please enter the description: CD
Please enter the quantity:
Please enter the price for each item:
ITEMCD QUANTITY PRICE$ COST$
Shopping Menu:
buy
show receipts
show summary
exit the program
Enter your option:
Please enter the description: Movie
Please enter the quantity:
Please enter the price for each item:
ITEMMovie QUANTITY PRICE$ COST$
Shopping Menu:
buy
show receipts
show summary
exit the program
Enter your option:
List of all purchases:
ITEMBook QUANTITY PRICE$ COST$
ITEMCD QUANTITY PRICE$ COST$
ITEMMovie QUANTITY PRICE$ COST$
Shopping Menu:
buy
show receipts
show summary
exit the program
Enter your option:
PURCHASES TOTALCOST$
Shopping Menu:
buy
show receipts
show summary
exit the program
Enter your option:
Are you sure that you want to exit the program yn y
Thank you for using our program.
Thank you for using my program.
D:
Sample program run invalid price and quantity input
D:BuyItems
Welcome to my shopping program.
Please enter the access code:
Shopping Menu:
buy
show receipts
show summary
exit the program
Enter your option:
Please enter the description: Book
Please enter the quantity:
Invalid quantity. Quantity cannot be negative or string. Please try it again.
Please enter the quantity:
Invalid quantity. Quantity cannot be negative or string. Please try it again.
Please enter the quantity: Hello
Invalid quantity. Quantity cannot be negative or string. Please try it again.
Please enter the quantity:
Please enter the price for each item:
Invalid price. Price cannot be negative or string. Please try it again.
Please enter the price for each item:
Invalid price. Price cannot be negative or string. Please try it again.
Please enter the price for each item: Hello
Invalid price. Price cannot be negative or string. Please try it again.
Please enter the price for each item:
ITEMBook QUANTITY PRICE$ COST$
Shopping Menu:
buy
show receipts
show summary
exit the program
Enter your option:
List of all purchases:
ITEMBook QUANTITY PRICE$ COST$
Shopping Menu:
buy
show receipts
show summary
exit the program
Enter your option:
PURCHASES TOTALCOST$
Shopping Menu:
buy
show receipts
show summary
exit the program
Enter your option:
Are you sure that you want to exit the program yn y
Thank you for using our program.
Thank you for using my program.
D:
Sample program run invalid access code
D:BuyItems
Welcome to my shopping program.
Please enter the access code:
Invalid access code. Please try it again.
P
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started