Create a new project in eclipse as a before. Name this one again using
your first initial and last name and then Lab2. So mine would be
Again add a new class to your project in eclipse. Call this class Lab2
Your class should do the following. (your main job is to figure our how
to write the code to do this.) I encourage you to look at code listing
2-27 on pages 89-90 of your book (Payroll.java from the Chapter 02
folder in the sourcecode from the cd in the back of you book). This
program is quite similar, though not exactly the same and the one you
This lab will be a simple tip calculator for a customer with three tips to pay.
- You need to ask for several pieces of information
- Ask how much the first bill was
- ask what percent tip the user wants for the first bill.
- calculate the first tip.
- Ask how much the second bill was
- ask what percent tip the user wants for the second bill.
- calculate the second tip.
- Ask how much the third bill was
- ask what percent tip the user wants for the third bill.
- after calculating all three tips
- Print out each bill and the tip for that bill on its own line.
- finally print out the third
Hint: you will need at least 7 unique variables for this lab, one for
the name, then one for each class's credits (for a total of three more)
and one the grade points for each class(three classes so you need three
your design might also need an eight variable for the output string.
An example run on the program might look like this: (program output is in black, user input is in blue)
How much is your first bill: 43.75
What percent tip do you want for that bill?: 10
How much is your second bill: 25
What percent tip do you want for that bill?: 15
How much is your third bill: 50
What percent tip do you want for that bill?: 20
The $43.75 bill has a tip of $4.375
The $25 bill has a tip of $3.75
The $50 bill has a tip of $10
Your total tip is $18.125
If you are using Payroll.java as a guide for this project as I
suggested earlier, be aware that this project is slightly longer than
that one. Expect to have anywhere from 1.5 to 2 times the code of that
Don't worry about having only two digits after the decimal point. If
you've done Java before and know how to do it, then great, if you have
not just get the input/output and math working.
again zip up your project folder and submit it to me by email. Make sure that your submitted zip file contains your first initial and last name as part of the zip file name.
Include your name somewhere in your java file in a comment.