Re: Help Calculating a tip

Well, think about this logically: how do you calculate a percentage?

Re: Help Calculating a tip

Let me guess: Divide the smaller number by the bigger one and multiply by one hundred?

Re: Help Calculating a tip

"15 percent" means literally, 15 / 100. 15 percent, or '%', of something is

something * ( 15 / 100 )

Re: Help Calculating a tip

I'm still having issues implementing this into my code. I see how I would need to get the number and divide it by 100, but I'm not sure which variables I need to include, and how the percentage can be chosen by the user. I appreciate the help so far.

Re: Help Calculating a tip

The standard tip rate isn't 15%, it's 0.15 when you actually calculate. So you would want to update whichever variable represents the tip amount to reflect that.

Re: Help Calculating a tip

Thanks for the help everyone, I got my code working great now! Just a quick question though. When the tip amount is displayed at the end of my new program, it shows up as $1.5 (When 15% is the tip amount). Is there a way to make it show up as $1.50? I am mostly inquiring about the aesthetics of the output, not necessarily the function. Thanks again! :)>-

Re: Help Calculating a tip

Do a search on formatting java output

Re: Help Calculating a tip

Quote:

hanks for the help everyone, I got my code working great now! Just a quick question though. When the tip amount is displayed at the end of my new program, it shows up as $1.5 (When 15% is the tip amount). Is there a way to make it show up as $1.50? I am mostly inquiring about the aesthetics of the output, not necessarily the function.

There's a function called printf used for formatting console output.

Re: Help Calculating a tip

And yet another class called DecimalFormat.