#include <iostream>
using namespace std;
void ExactChange(double userTotal,int &numDollars,int
&numQuarters,int & numDimes,int &numNickels,int &
numPennies){
if(userTotal==0){
return ;
}
int userTotal1=(int)userTotal;
//finding dollors
if(userTotal1>=100){
numDollars=userTotal1/100;
userTotal1=userTotal1%100;
}
//finding quarters
if(userTotal1>=25){
numQuarters=userTotal1/25;
userTotal1=userTotal1%25;
}
//findigng dimes
if(userTotal1>=10){
numDimes=userTotal1/10;
userTotal1=userTotal1%10;
}
//finding nickels
if(userTotal1>=5){
numNickels=userTotal1/5;
userTotal1=userTotal1%5;
}
numPennies=userTotal1;
}
int main(){
cout<<"Enter amount: ";
double amount;
cin>>amount;
int d=0,q=0,di=0,n=0,p=0;
ExactChange(amount,d,q,di,n,p);
if(d==1)
printf("%d dollor\n",d);
else if(d!=0)
printf("%d dollors\n",d);
if(q==1)
printf("%d quarter\n",q);
else if (q!=0)
printf("%d quarters\n",q);
if(di==1)
printf("%d dime\n",di);
else if (di!=0)
printf("%d dimes\n",di);
if(n==1)
printf("%d nickel\n",n);
else if (n!=0)
printf("%d nickels\n",n);
if(p==1)
printf("%d penny\n",d);
else if (p!=0)
printf("%d pennies\n",d);
}
Note : Please comment below if you have concerns. I am here to help you
If you like my answer please rate and help me it is very Imp for me
in c++ please tortViewHistory Bookmarks Window Help learn Tybooks.com 3.12. LAB: Exact change functions My Ibrary...
Write a program with total change amount as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies. Ex: If the input is: 0 the output is: No change Ex: If the input is: 45 the output is: 1 Quarter 2 Dimes
(In Python 3) Write a program with total change amount as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies. Ex: If the input is: 0 (or less than 0), the output is: No change Ex: If the input is: 45 the output is: 1 Quarter 2 Dimes So...
I made this C program to count change and make a slip saying the exact dollar and change amount given. every time I run the program it says the change given is 477256577 and i'm not sure what I have done wrong? #include<stdio.h> int main(void) { char first, last; int pennies; int nickels; int dimes; int quarters; int loonies; int change; int t_dollars; int t_cents; printf("Type in your 2 initials and press return> "); scanf("%c%c",&first,&last); printf("%c%c please enter in your...
Write a C program that calculates exact change. In order to receive full credit, please remember that only int arithmetic is exact, so you’ll need to break up your double into two ints, the one before the decimal point and the one after the decimal point. Another point worth mentioning is that the % operator gives the remainder. In other words, when working with int values, 9 / 5 = 1 whereas 9 % 5 = 4. Keep this in...
Can you please help me with creating this Java Code using the following pseudocode? Make Change Calculator (100 points + 5 ex.cr.) 2019 In this program (closely related to the change calculator done as the prior assignment) you will make “change for a dollar” using the most efficient set of coins possible. In Part A you will give the fewest quarters, dimes, nickels, and pennies possible (i.e., without regard to any ‘limits’ on coin counts), but in Part B you...
Write a program that tells what coins to give out for as change from 1 cent to 99 cents. Use coin denominations of 25 cents (quarters), 10 cents (dimes), and 1 cent (pennies) only. Include a loop that lets the user repeat this computation for new input values until the user says he or she wants to end the program. Solution Demo Hello I am the coin machine! I will give you the least number of coins for your change....
Hi please help with c++ programming. This is my code. there's a syntax error. PLEASE FIX MY CODE instead of re-designing the program. Thanks /* Description of problem: Introduction to Friends functions. Create objects in the stack (not on the heap) 3.1: Add a friend function, kilotopound, which will convert kilograms to pounds. 3.2: Add a copy constructor utilizing Lab 3.1 code. Copy the fist object using a copy constructor. Output the contents of both objects. */ #include <iostream>...