CompSci 6 Spring 2010: Assignment 3
Due: Thursday, Feb 4 - 11:59pm
30 points
Solve the following problems using the APT, and submit the program
using Eclipse.
- First read and think about solving the following problems.
- In Eclipse, create a Java project named Assign3. In that project, add a
Java class called BritishChange (the .java extension will be automatically
added, also note the B and C must be capital letter, the rest of the letters
lowercase) and a Java class called TippingWaiters.
- Cut and paste the line with the method to get started and solve these
problems.
- Test your classes/methods using the APT until you get as many green lights
as possible.
- Add comments to both of your Java classes, especially one with your name.
// Author: Prof. Rodger
//
// Date: Jan. 28, 2010
//
// Purpose: ?
//
- In the same project, create
one text file called README that includes the following
information.
- Your name
- The date
- Any comments on the programs, Eclipse or the APT.
- An estimate of how long it took you to do this assignment.
- The names of anyone you spoke with about this program. If you
discussed the solution with another student, include their name. If you
received help from a UTA or the professor, include their name.
Submitting your Project with Ambient
Once your program is ready to submit. You need to do the following.
- In Eclipse, select "Ambient", "Submit a Project for Grading".
- Click on the "+" beside cps006 and you should see "assign3".
Click on assign3 to highlight it.
- If the workspace path is not correct, browse to it.
- Find your folder assign2 and click on the box beside it to select it.
Then click "Submit" at the bottom. You will be prompted for you Duke login
and password.
You should receive a message that it was successful.
Here are some hints for Tipping Waiters
- The wording is a bit tricky. Note that the tip is between 5% and 10%
of the final sum!
Here is an example:
Suppose the bill is 17100 and the cash is 18000.
The minimum amount you could pay (not rounded up to a five yet) is
NOT 17100 + 17100* 0.5 = 17955. THIS IS NOT CORRECT!
The minimum amount you could pay (not rounded up to a five yet) is
17100/0.95 = 18000.
Note that 5% of 18000 is 900. 17100 +900 = 18000.
double dminpay = Math.ceil(bill/0.95);
- Compute the minimum you can pay rounded up by 5. Compute the maximum
you can pay rounded up by 5.
You do not need a loop to figure out how many payments in increments of
5 can be paid. Instead, use a formula.