MIS 24053 Lecture Notes - Lecture 4: Hong Kong Dollar

14 views4 pages

Document Summary

Given a collection of nickels (us 5-cent coins) and pennies (us 1-cent coins), find the equivalent number of hong kong dollars and 10-cent coins. Nickels (integer) - number of us nickels. Pennies (integer) - number of us pennies. Dollars (integer) - number of hk dollar coins to return. Houji (integer) - number of hk 10-cent coins to return. Example: refined algorithm const double us2hk = 7. 8; 2. 1 total_usd = (5 * nickel + penny)/100. // determines the number of hk coins to exchange for us coins. Us = hk. 8 exchange rate int nickel; int penny; int dollar; int houji; double total_usd; int total_hk_cent; double total_hkd; // read in the number of nickels and pennies cout << "enter the number of nickels and press return: "; cin >> nickel; cout << "enter the number of pennies and press return: "; cin >> penny; // compute the total value in us$ total_usd = (5 * nickel + penny) / 100. 0;

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents