Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use this C++ code to create a flowchart. Thank you. #include using namespace std; int main() { // declaring variables int ones,fives,tens,twenties,fifties,hundreds,salesCnt,openingBal,salesAmt,deposit=0,paidAmt,i=1,diff; // prompting

Please use this C++ code to create a flowchart. Thank you.

#include using namespace std;

int main() { // declaring variables int ones,fives,tens,twenties,fifties,hundreds,salesCnt,openingBal,salesAmt,deposit=0,paidAmt,i=1,diff; // prompting and taking values for denominations cout<<"Enter 1\'s in opening cash: "<>ones; cout<<"Enter 5\'s in opening cash: "<>fives; cout<<"Enter 10s in opening cash: "<>tens; cout<<"Enter 20\'s in opening cash: "<>twenties; cout<<"Enter 50\'s in opening cash: "<>fifties; cout<<"Enter 100\'s in opening cash: "<>hundreds;

// calculating open balance openingBal=ones+fives+tens+twenties+fifties+hundreds; // calculatoin deposit deposit=deposit+openingBal;

// random value generator salesCnt=rand()%20+1;

// looping through obtained count while ( i <=salesCnt) { // reading current sales amount cout<<"Enter the amount sales "<>salesAmt;

// checking errors in sales amount if (salesAmt<0) cout<<"Amount is lessthan 0"<

else if (salesAmt>100) cout<<"Amount is greater than 100"<

else { // reaidng paid amount cout<<"Enter the amount paid: "; cin>>paidAmt; // handling errors while taking input if( paidAmt<0) cout<<"Amount is lessthan 0"<100) cout<<"Amount is greater than 100"<

else {

// calculating difference to be given to customner diff=paidAmt-salesAmt; //adjusting the cash in the cash drawer if(diff>0) { if(diff==1) ones-=1; else if(diff==5) fives-=1; else if(diff==1) tens-=1; else if(diff==20) twenties-=1; else if (diff==50) fifties-=1; else if (diff==100) hundreds-=1; }

// updating cashdrawer with amount given by the user if (paidAmt==1) ones+=1;

else if (paidAmt==5) fives+=1;

else if (paidAmt==10)

tens+=1;

else if (paidAmt==20)

twenties+=1;

else if (paidAmt==50) fifties+=1;

else if (paidAmt==100) hundreds+=1;

deposit+=diff;

i=i+1; }

} }

// calculating deposit amount cout<

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions

Question

What is an accrued revenue? Provide an example.

Answered: 1 week ago