Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use Constructors, Parameters, and arguments as needed. Create a program in C++ that can convert $dollars to Yen, Euro, or Peso. The user will input

Use Constructors, Parameters, and arguments as needed.

Create a program in C++ that can convert $dollars to Yen, Euro, or Peso.

The user will input a dollar value. If the $dollar value is greater than 0, create a menu that will allow user to select Yen, Euro, Peso, or all Currency conversion. If the $dollar value is less than 0 prompt the user and stop the program.

Write a program that has 4 methods that will return the concurrency conversions for the following.

Yen, Euro, Peso conversion program using a class structure.

Create 4 Methods: use set and get if possible

1) Convert and output conversion in Yen

2) Convert and output conversion in Euro

3) Convert and output conversion in Peso

4) Convert and output all 3 currencies.

here is my program

#include #include using namespace std;

class CurrencyConverter { public: double value; CurrencyConverter(double value) { this->value = value; } double convertToYen() { return 109.50 * value; } double convertToEuro() { return 0.87 * value; } double convertToPeso() { return 19.10 * value; } void getAlLCurrency() { cout << "The Currency is Yen is" << 109.50 * value << endl; cout << "The Currency is Euro is" << 0.87 * value << endl; cout << "The Currency is Peso is" << 19.10 * value << endl; } }; int main() { int option; double dollar; //output menu cout << "Enter the dollar amount you want to convert" << endl; cin >> dollar; CurrencyConverter convert(dollar); if (dollar <= 0) cout << "The dollar you have entered is invalid" << endl; else {

do { cout << " Here are the options of currencies" << endl; cout << "1.Yen" << endl; cout << "2.Euro" << endl; cout << "3.Peso" << endl; cout << "4. Convert to all" << endl; cout << "5.Quit the program" << endl; cout << "Choose one option :" << endl; cin >> option; switch (option) { case 1: cout << dollar << " dollars is equal to " << convert.convertToYen() << " Yens"; break; case 2:

cout << dollar << " dollars is equal to " << convert.convertToEuro() << " Euros"; break; case 3: cout << dollar << " dollars is equal to " << convert.convertToPeso() << " Pesos"; break; case 4: convert.getAlLCurrency(); break; case 5: cout << "You chose to quit the Program" << endl; break; default: cout << "Invalid Input" << endl; break; }

} while (option != 5); } return 0; }

how to make this program memory efficient

can someone make changes this code to make it memory efficient and comment what is changes. C++ ASAP

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

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students also viewed these Databases questions

Question

List two ways display screens can be kept consistent.

Answered: 1 week ago