92.9k views
3 votes
In harry potter 1 galleon is 17 sickles or 493 knuts. considering that 1 galleon is about $6.64 create a program that do the following:

1. prompt the user the type of conversion us$ to galleons, sickles and knuts, or vice versa. (notice that from wizard money to us$ you will need three values)
2. perform the exchange calculating the proper amounts and display it
3. ask the user if they want to perform another transaction and loop back to the beginning if the answer is affirmative.

1 Answer

5 votes

Final answer:

The student's question pertains to creating a program that converts between US dollars and the fictional Harry Potter currency of Galleons, Sickles, and Knuts. The program should prompt the user to specify the direction of exchange, perform the calculation, display the result, and loop for another transaction if desired.

Step-by-step explanation:

The student's question involves creating a program that can handle currency conversion between US dollars and the fictional currencies used in the Harry Potter series (Galleons, Sickles, and Knuts). The exchange rates provided state that 1 Galleon equals 17 Sickles or 493 Knuts, and approximately $6.64 USD.

What is needed is a simple program that asks the user what kind of conversion they need to do (US dollars to wizard currency or vice versa), performs the calculation, and displays the result. For instance, if converting from US dollars to wizard money, the program will divide the number of dollars by 6.64 to determine the number of Galleons. It can then convert a fraction of a Galleon into Sickles and Knuts as necessary.

Conversely, when converting from Galleons, Sickles, or Knuts to US dollars, the program will multiply the number of each currency by their respective USD values. To provide further convenience, the program should ask users if they wish to perform another transaction and loop back if they respond affirmatively. This type of program would be an interesting practical application of programming skills combined with a bit of fun from a beloved book series.

User Rahul Kumar Dubey
by
8.6k points