Answer to Question #273616 in C++ for Nick

Question #273616

You received a generous sum of money in US dollars from the caribou club to attend school in Europe. You have decided to develop an application to keep track of what you hav spent. This application should be built to accept US dollars, convert them to various currencies and add each amount spent. The US dollars spent should be added to running total and displayed on the form as each foreign currency amount currencies used are as follows: English pounds=$1=0.66, Italian Lira=$1=1476.38, German Marc=$1=1.48, Spanish Peseta=$1=126.87

1
Expert's answer
2021-11-30T18:19:29-0500
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;

void MenuCurren(double dolSum)
{
	cout<<fixed<<setprecision(2)
		<<"\n\tYour balance is\n"
		<<dolSum<< "\t\tUS dollars which equals\n"
		<<0.66*dolSum<<"\t\tEnglish pounds which equals\n"
		<<1476.38*dolSum<<"\tItalian lira which equals\n"
		<<1.48*dolSum<<"\t\tGerman Marc which equals\n"
		<<126.87*dolSum<<"\tSpanish Peseta";
}

int main()
{
	double genSum;
	double spendMoney;
	cout<<"Please, enter a generous sum in US dollars that was received: ";
	cin>>genSum;
	MenuCurren(genSum);
	int inpCur=0;
	do
	{
		cout<<"\nHow much money did you expend (0 - exit)? ";
		cout<<"\nYour input: ";
		cin>>spendMoney;
		if(spendMoney==0)break;
		cout<<"Which currence did you use "
			<<"(dollars - 0, pounds - 1, lira - 2, Marc - 3, Peseta - 4)?";
		cout<<"\nYour input: ";
		cin>>inpCur;
		switch(inpCur)
		{
			case 0:
			{
				genSum=genSum-spendMoney;
				break;
			}
			case 1:
			{
				genSum=genSum-spendMoney/0.66;
				break;
			}
			case 2:
			{
				genSum=genSum-spendMoney/1476.38;
				break;
			}
			case 3:
			{
				genSum=genSum-spendMoney/1.48;
				break;
			}
			case 4:
			{
				genSum=genSum-spendMoney/126.87;
				break;
			}
			default:
			{
				cout<<"Incorrect input";
			}
		}	
		if(genSum<=0)
		{
			cout<<"\nYou spent whole money!";
			break;
		}
		else
			MenuCurren(genSum);
	}while(true);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS