This is the assignment:
TIP CALCULATOR
Create a class called TipCalculator which calculates a tip amount
based on a grade of service received.
calculateTip method
Create a method named calculateTip which accepts two
incoming parameters: a double and a String. The first parameter
(the double) contains the bill total, and the second parameter (the String) contains
a grade of the service received (A, B, C, D, or F). The tip percent is based on the
grade as follows: A: 18%, B: 15% C: 10% D: 5% F: 0%CSE 1341 Lab #4 Fall 2011
The calculateTip method should return a double containing the tipAmount that it
calculated.
main method
In the main method, prompt for a bill amount and display a suggested tip for each of
the possible grades of service A, B, C, D, and F. Use printf formatting codes to align
the values of the table. After the table is displayed, prompt for a grade and calculate
and display the tip amount and bill total.
Example:
C:\>java TipCalculator
What is the amount of the bill? $15.45
GRADE TIP
A $ 2.78
B $ 2.32
C $ 1.55
D $ 0.77
F $ 0.00
Please grade the service (A, B, C, D, F): B
Pay $17.77 (Tip $2.3)

It's not terribly hard on its own, but I have no idea when it comes to methods and such... please help!

Recommended Answers

All 3 Replies

alright, I read and am still completely lost... after I declare my

public static void calculateTip(double billtotal, stringA, stringB, StringC, StringD, StringF)

what do i do??

What is that method supposed to do? You have defined it as void so it won't be returning any results.
If you want it to return some results, you need to change the void to the type of data that it will return.


You need to read the assignment again. Your definition of calculateTip() is nothing like what you posted in your first post.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.