Question
Write a program to convert currencies between British currency of pounds and pence, in which 1 pound contains 100 pence, and U.S. currency in dollars
Write a program to convert currencies between British currency of pounds and pence, in which 1 pound contains 100 pence, and U.S. currency in dollars and cents. Assume an exchange rate of 1.45 U.S. dollars per British pound. Display a menu like the following:
Convert from British currency to U.S. currency
Convert from U.S. currency to British currency
Exit
When the user chooses 1, prompt the user to enter two numbers representing British pounds and pence, converts to an equivalent number of U.S. dollars and cents, and output the result.
When the user chooses 2, prompt the use to enter two numbers representing U.S. dollars and cents, converts to an equivalent number of British pounds and pence, and output the result.
When the user chooses 3, terminate the program. Program should continue until the user picks 3.
Hint:
Represent British Pounds and pence in total pence, then multiply by 1.45, cast the result as integer, divide by 100 to get dollar amount, modular 100 to get cent amount
Difference is you need to divide by 1.45
The new program has to be changed from the existing conversion program!!
using System public class Convert FromMetric 7 public static void Metric ToEnglish() const double yards PerMeter 9144 double meters IO.GetDouble ("Enter the number of meters to convert 10 double toYards meters yards PerMeter; 11 meters converted to yards 12 int yards (int)toYards 13 integer part of to Yards 14 double excessYards toYards yards 15 fractional part of toYards 16 double toFeet 3 excess Yards 17 excess Yards converted to feet 18 int to Feet feet integer part of toFeet 19 double excess Feet to Feet feet 20 fractional part of toFeet 21 float toInches a (float) (12 excess Feet) 22 excessFeet converted to inches String output Concatenate output for message dialog 24 if (meters 1) output meters meter converts to 26 output +3 meters meters convert to 27 28 output if (yards 0) 29 if yards 1) output yards yard 30 else output yards yards 31 if (feet 0) 32 if (feet 1) output feet foot 34 else output teet teet if (to Inches 0) if (toInches 1) output to Inches inch else output to Inches inches if (yards 0 && feet 0 && toInches 0) 38 output 0 yards 39 Console.WriteLine(output); 40 elseStep 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