Question
QUESTION 2 Write a program that user may select to convert Ringgit Malaysia (RM) to Singapore Dollar (SGD), to Indonesian Rupiah(IDR) or to Thai Baht
QUESTION 2 Write a program that user may select to convert Ringgit Malaysia (RM) to Singapore Dollar (SGD), to Indonesian Rupiah(IDR) or to Thai Baht (THB). main() method: A. Call method displayMenu(). B. Prompt the user to enter his/her choice. C. Check the choice (use while structure if choice is 0, execute E) Ask user to enter RM amount to convert to. If the user selects menu 1: o Call method toSGD() and pass the RM amount as the parameter. If the user selects menu 2: o Call method toIDR() and pass the RM amount as the parameter. If the user selects menu 3: o Call method named toTHB() and pass the RM amount as the parameter. Display the conversion. Call method displayMenu() again. Prompt the user to enter his/her choice. D. Repeat (C ) steps if user enters 1 or 2 or 3. E. Stop the program if user enters 0. Methods definition: Method displayMenu(): This void method is to display a menu: (may refer to the sample output). 1. Convert to Singapore Dollar (SGD) 2. Convert to Indonesian Rupiah (IDR) 3. Convert to Thai Baht (THB) 0. Exit Program Method toSGD(): This method converts the RM amount to SGD. Write the formula accordingly (RM1.00 is equivalent to S$0.33) Return the result to the caller (main). Method toIDR(): This method converts the RM amount to IDR. Write the formula accordingly (RM1.00 is equivalent to Rp3465.14) Return the result to the caller (main). Method toTHB(): This method converts the RM amount to THB. Write the formula accordingly (RM1.00 is equivalent to B7.38) Return the result to the caller (main). Sample output:
run: D> DD MENU RM Converter 1. Convert to Singapore Dollar (SGD) 2. Convert to Indonesian Rupiah (IDR) 3. Convert to Thai Baht (THB) 0. Exit program Please enter you choice : 3 Please enter the RM amount : 25.50 RM 25.50 is equivalent to 3188.19 MENU RM Converter 1. Convert to Singapore Dollar (SGD) 2. Convert to Indonesian Rupiah (IDR) 3. Convert to Thai Baht (THB) 0. Exit program Please enter your choice : 2 Please enter the RM amount : 500.00 RM 500.00 is equivalent to Rp1732570.00 MENU RM Converter 1. Convert to Singapore Dollar (SGD) 2. Convert to Indonesian Rupiah (IDR) 3. Convert to Thai Baht (THB) 0. Exit program Please enter your choice : 0 Program endStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started