CSE 142 Autumn 2000 Homework #1

Galleons, Sickles, and Knuts



Introduction

As the new programming wizard at Hogwarts School of Wizardry, you are being given a series of tasks to make the magical world run more smoothly. Your first task is to assist Gringott's Bank in the conversion of currency from Magical Money (Galleons, Sickles, and Knuts) to Muggle Money (Euros). You have been asked to create a program which prompts the user for an amount of money in Galleons, Sickles, and Knuts, converts it to Euros, and also computes the commission that Gringotts charges. Information on conversion rates and commissions are given below.

Key Concepts

In this section, for most homeworks, we'll provide a list some of the relevant concepts. Don't forget, however, that CS is a lot like math in that you can never afford to forget concepts you learned earlier in the course; every new homework and programming concept builds on previously learned ones. In addition, later in the quarter, determining which concepts you should apply might well be part of your homework.

In this homework, keep an eye out for...

Specifications

Your program should prompt the user to enter (in order) the number Galleons, Sickles, and Knuts to exchange into Euros. The program should then convert to Euros and calculate the commission to charge. The program should print the value in Euros, the commission in Euros, and the amount to be paid to the customer.

There are 17 Sickles in a Galleon, and 29 Knuts in a Sickle. You may use the conversion rate that one Galleon is worth 60.0 Euros. The commission charged by Gringott's is 5.0 %.

You should read in the Galleons, Sickles, and Knuts as ints. Use doubles to represent the amount in Euros and the commission. The sample executable uses the formatting code %.2lf to display a double to two decimal digits.

Your program should run like the sample executable we have provided on the web. The computed numbers should be very close. (Note - the computation can be done in several different ways - because of rounding, the answers may differ in the last displayed digit.) The spacing in the output doesn't have to be identical, but the order of the inputs and outputs must match exactly. (When we can, we use automated scripts to test submitted programs, which is one reason that it is important that your program accepts input and produces output in the same order as the sample program.  The other reason consistency is important is TA sanity when they grade dozens of programs.)

Your program should prompt the user for inputs and give descriptive messages of the output, but does not need to match all of the verbiage of the sample solution.

Programming Requirements

It is important that your program be well-written, as well as work correctly.  Besides general guidelines like picking good variable names, there a few specific things that are required for this assignment. 

Submission Guidelines

The due date for this assignment is at the top of this page. Be especially aware of the web submission deadline, as submission times are tracked precisely and we cannot accept late submissions.

Files


A few bits of advice

Background

The source for information on Hogwarts School of Wizardry and related subjects is the series of Harry Potter books by J. K. Rowling. These books are highly recommended for pleasurable reading (and to get a few references in HW assignments), but are not necessary for the completion of the homework assignments. The books tell of Harry's adventures in wizarding school, and describe the interaction of the magical and non-magical (muggle) world. The fourth volume of the series was published last summer. A discussion of Magical Money (Galleons, Sickles, and Knuts) can be found in the Diagon Alley Chapter (pg. 75) of the first volume of the series: Harry Potter and the Sorcerer's Stone.

Announcements

If any clarifications or changes need to be made for this homework, they will be posted to the cse142-announce email list and linked here.


Return to main Homework page...