C++ 1. Change Calculator Write a program that directs a cashier how to give chan
ID: 3925353 • Letter: C
Question
C++
1.
Change Calculator
Write a program that directs a cashier how to give change. The program has two inputs: The amount due and the amount received from the customer. Display the dollars, quarters, dimes, nickels, and pennies that the customer should receive.
C++
2.
Use a Do-While loop and Switch Case to create menu of programs you have already created. Please have star formatting for menu.
**************************************
* Main Menu: *
* Enter # to run program or Quit *
* 1) Moon Weight Calculator *
* 2) Income Tax Program *
* 3) Change Calculator *
* 4) Quit *
**************************************
You Selected Option 1:
Enter Earth Weight:
120
Moon Weight: 100lbs
**************************************
* Main Menu: *
* Enter # to run program or Quit *
* 1) Moon Weight Calculator *
* 2) Income Tax Program *
* 3) Change Calculator *
* 4) Quit *
**************************************
You selected Option 4:
Program Quitting
Explanation / Answer
1) #include<iostream>
int main()
{
double due,received;
cout<<"enter amount due :";
cin>>due;
cout<<" enter amount received : ";
cin>>received;
double change=received-due;
if(change>1.0)
cout<<"dollars : "<<int(change);
change=change-int(change);
if(change>=0.25)
q=change/0.25;
change=change-(q*0.25);
if(change>=0.1)
d=change/0.1;
change=change-(d*0.1);
if(change>=0.05)
p=change/0.05;
change=change-(p*0.05);
cout<<" penny :"<<p<<" dime : "<<d<<" quarters : "<<q;
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.