Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

LabTask week06 Write a program that prompts the user to enter the exchange rate from currency in US dollars to Chinese RMB. Prompt the user

LabTask week06 Write a program that prompts the user to enter the exchange rate from currency in US dollars to Chinese RMB. Prompt the user to enter 0 to convert from US dollars to Chinese RMB and 1 to convert from Chinese RMB to US dollars. Prompt the user to enter the amount in US dollars or Chinese RMB to convert it to Chinese RMB or US dollars, respectively. When the user enters "1" (yuans to dollars) the program should extract the dollar amount before the decimal point, and the cents after the decimal amount using the indexOf() and substring() methods.Here are the sample runs, user's input is underlined:

Enter the exchange rate from dollars to RMB: 6.81 Enter 0 to convert dollars to RMB and 1 vice versa: 0 Enter the dollar amount: 100 $100.0 is 681.0 yuan. Enter the exchange rate from dollars to RMB: 6.81 Enter 0 to convert dollars to RMB and 1 vice versa: 1 Enter the yuan amount: 1000 1000.0 yuan is $146.843 dollar 146 dollars 3 quarters 0 dimes 1 nickel 4 pennies 

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

Step: 3

blur-text-image

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

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions

Question

continuous problem-City of Monroe chapter 6 part 2

Answered: 1 week ago

Question

=+j Explain the essential nature of repatriation.

Answered: 1 week ago