| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
General - C++ Help on homework again
I've been presented with this question:
Background A local business owner wants a program to help his employees redeem coupons for prizes. The employees cant do math very well and need a program that allows them to enter input about the customer and get back output about how prizes and coupons. Each time a customer wins a game, they are awarded coupons for redemption. Customers then bring the coupons to the employees who count them and tell customers what items they can get and how many coupons they have left. Customers can redeem the coupons for several different things: Stuffed animals cost 200 coupons Water pistols cost 75 coupons Pop Rocks cost 35 coupons Jewelry costs 5 coupons Functionality Changes The program should now do the following: 1. The employee should first see a prompt asking them how many coupons are being redeemed. o If the amount is less than or equal to zero, ask them to try again. o If the amount is any positive number other than zero, capture the amount and go to the next step. 2. Clear the screen and show the prizes menu. It should: o Echo the number of tickets back to the screen o Tell the employee to enter: S for stuffed animals (200 points) W for water pistol ( ) P for pop rocks ( ) J for jewelry ( ) R for Error! I entered the number of coupons wrong! If the employee selects R, return to the previous step, otherwise, continue. X for Exit If the employee selects X, tell the employee how many coupons to return and then pause the screen. For choices S,W,P or J- Determine from the number of coupons if the customer can have that prize. If the customer has enough coupons, output a message saying to award the customer that prize and deduct the coupons. o If any coupons remain, return to the prizes menu. If the customer does not have enough, return to the prizes menu. Here's some hints that I was provided. Heres some hints: 3. There should be a while loop to validate the number of coupons. This is an outside loop you may need to return to this if the employee decides that they entered the number of coupons wrong! 4. The prizes menu needs to be inside the inner loop so you can return to it if there are not enough coupons or there are coupons remaining. 5. You will likely need to use continue or break statements!!! I have no idea how to do this. I previously made a similar program with loops but it seems like my teacher is jumping ahead a few chapters and leaving me behind. Help please, I'd really appreciate it. I'm using Bloodshed's Dev C++ to compile. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > General - C++ Help on homework again |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|