Thursday, September 24, 2020

US Money Exchange Solver

  I will show you write a program that takes as input any change expressed in cents. It should then compute the number of half-dollars, quarters, dimes, nickels, and pennies to be returned, returning as many half dollars as possible, the quarters, dimes, nickels, and pennies, in that order. For example, 493 cents should return 9 half dollars, 1 quarter, and 1 dime, and 1 nickel and 3 pennies using C++ programming language.

Note: US half dollar = 50 cents, quarter = 25 cents, dime = 10 cents, nickel = 5 cents, and penny = 1 cent.


I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.


My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking and Arduino Project development at a very affordable price.


Program Listing

 /* us_dollar.cpp

   Author  : Jake Rodriguez Pomperada, MAED-IT, MIT

   Date    : September 24, 2020

   Email   : jakerpomperada@gmail.com

   Website : www.jakerpomperada.com / www.jakerpomperada.blogspot.com

*/


#include <iostream>

using namespace std;

int main()

{

int us_dollar=0;

int halfDollar=0, quarter=0;

int dime=0, penny=0,nickel=0;

cout << "\n\n";

cout << "\tUS Money Exchange Solver";

cout << "\n\n";

cout<<"\tGive amount in US Dollar Cents: ";

cin>>us_dollar;

halfDollar=us_dollar/50;

us_dollar=us_dollar%50;

quarter=us_dollar/25;

us_dollar=us_dollar%25;

dime=us_dollar/10;

us_dollar=us_dollar%10;

nickel= us_dollar/5;

penny= us_dollar%5;

cout << "\n\n";

cout << "\tDisplay Results";

cout << "\n\n";

cout << "\tHalf Dollars : "<<halfDollar<<"\n";

cout << "\tQuarters     : "<<quarter<<"\n";

cout << "\tDime         : "<<dime<<"\n";

cout << "\tNickle       : "<<nickel<<"\n";

cout << "\tPennys       : "<<penny<<"\n";

cout <<"\n\n";

cout <<"\tEnd of Program";

cout <<"\n\n";

}



No comments:

Post a Comment