(Solved) : Please Convert Code Using Basic C Code Thank Declare Variables Ones Fives Tens Twnties Fi Q43959289 . . .
Please convert this into code using the most BASIC C++ code.Thank You.
- Declare variablesones,fives,tens,twnties,fifties,hundreds,salesCnt,openingBal,salesAmt,deposit,paidAmt,i=1,Diff
- Prompt “Enter 1’s in opening cash: “
- Read ones
- Prompt “Enter 5’s in opening cash: “
- Read fives
- Prompt “Enter 10s in opening cash: “
- Read tens
- Prompt “Enter 20’s in opening cash: “
- Read twenties
- Prompt “Enter 50’s in opening cash: “
- Read fifties
- Prompt “Enter 100’s in opening cash: “
- Read hundreds
- Calculate Opening balance
openingBal=ones+fives+tens+twenties+fifties+hundreds
- Copy deposit, deposit=deposit+openingBal
- Generate random sales count of the day
salesCnt=rand()%20+1
While i <=salesCnt
Prompt “Enter the amount sales i: “
Read salesAmt
IF salesAmt<0
Display Error Message less than 0
ELSE IF salesAmt>100
Display Error Message greater than 100
ELSE
Prompt “Enter the amount paid: “
Read paidAmt
IF paidAmt<0
Display Error Message less than 0
ELSE IF paidAmt>100
Display Error Message greater than 100
ELSE IF paidAmt<salesAmr
Display Error Message not enough
ELSE
diff=paidAtmt-salesAmt
IF diff>0:
IF diff==1:
ones-=1
ELSE IF diff=5
fives-=1
ELSE IF diff=10
tens-=1
ELSE IF diff=20
twenties-=1
ELSE IF diff=50
ffties-=1
ELSE IF diff=100
hundreds-=1
IF paidAmt==1:
ones+=1
ELSE IF paidAmt=5
fives+=1
ELSE IF paidAmt=10
tens+=1
ELSE IF paidAmt=20
twenties+=1
ELSEIF paidAmt=50
ffties+=1
ELSE IF paidAmt=100
hundreds+=1
deposit+=diff
i=i+1
End While
- Display end of the day details
deposit=deposit-75
Display deposit
twenties-=2
tens-=3
fives-=4
ones-=5
Display hundreds,fifties,twenties,tens,fives and ones
Display cash drawer = 75
Display cash drawerones=5,fives=4,tens=2,twenties=2,fifties=0,hundred=0
________________________________________________________________________________________________
Please us this information to understand what the abovecode needs to do. Thank you.
Program
The program should start by asking the employee for the amount ofmoney in the opening cash drawer. The program will need to keeptrack of the number of $1’s, $5’s, $10’s, $20’s, $50’s, and $100’s.The store keeps only dollars (no cents).
Next, the daily sales will take place. Please use a random numbergenerator to tell us how many sales will be taking place during theday and the amount of each sale (usually no more than 20 sales takeplace in a day). You can limit items for sale to be only wholenumbers (no cents) and all are under $100. Only cash sales affectthe cash drawer (charges with a visa or debit card are not used).See below for an explanation of how to use the random numbergenerator.
Then, when the daily sales have been completed, have the programcalculate how much to deposit in the bank, leaving somewherebetween somewhere between $70 and $85 dollars in the cash drawerwith appropriate denominations. You will want to work on thealgorithm for this section in detail. (Saying “Calculate Deposit”will not give you enough detail to solve this problem!)
The output at the end should be the amount to deposit and the totalamount left in the cash drawer along with the number of eachdemonization for the next day.
Random Numbers:
In this program you will need to use the random number generator.There are two function needed to use this from the cstdlib library(standard library header file) and ctime:
• srand(time(0)); to seed the random number generator at thebeginning of your program (i.e., at the beginning inside of main())
• rand() which will return a random number when you need it:
value = rand();
• The mod operation (%) is great to limit the value returned fromthe random number generator, such as limiting the number to a rangeof 1-100. variable = some_number % maximum +1; The % gives you theremainder (which is what is left over after an integerdivision).
Things you should know…as part of the program:
1. Make sure to use a loop.
2. Make sure to prompt the user for any input requested. Make sureit is clear from your prompts what the user is expected to do. 3.Please don’t use any global variables in this program!
4. Make sure to use C++’s I/O (iostream library) for I/O
5. And, don’t forget to add comments and to work on your program’sreadability
Expert Answer
Answer to Please convert this into code using the most BASIC C++ code. Thank You. Declare variables ones,fives,tens,twnties,fiftie…
OR