+ 1
Help me with thia Java simple question!
Tip Calculator You always tip 15% of the bill amount. To make the calculation easier, you decide to write a program that will do that for you. Task: Take the bill amount as input and output the corresponding tip amount, which should be 15% of the amount. To calculate 15% of a number, multiply it by 15, then divide by 100. The input amount can be a decimal, so take a double from the input. import java.util.Scanner; public class Program { public static void main(String[] args) { //your code goes here } }
11 odpowiedzi
0
Again: ONLY OUTPUT THE RESULT.
Not "Enter the bill..."
Not "Tip amount...".
Look at the example outputs. Your outputs need to match EXACTLY.
+ 1
What have you tried so far? What kind of help do you need?
1. Read the task instruction.
2. Read the given code.
3. Get input and store in variable.
4. Compute amount of tip from input.
5. Output the result.
+ 1
Thank you
0
import java.util.Scanner;
public class TipCalculator {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter the bill amount: ");
double billAmount = scanner.nextDouble();
double tipAmount = (billAmount * 15) / 100;
System.out.println("Tip amount (15%): quot; + tipAmount);
scanner.close();
}
}
0
I tried this one, but it doesn't work on this app.
0
ONLY output according to the task description. NO EXTRA TEXT.
0
No
0
"No" what?
0
Isn't this code according to the task? It is the "input lesson" of Introduction to Java course.
0
Look at the output example.
0
I really got stuck on this, I wish I could sent the output screenshot here. I can't go to next lesson, this output isn't acceptable.