Help me with thia Java simple question! | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 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 } }

20th Feb 2024, 1:09 PM
Sayed Mujtaba Hashimi
Sayed Mujtaba Hashimi - avatar
11 Respuestas
0
Again: ONLY OUTPUT THE RESULT. Not "Enter the bill..." Not "Tip amount...". Look at the example outputs. Your outputs need to match EXACTLY.
20th Feb 2024, 4:28 PM
Lisa
Lisa - avatar
+ 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.
20th Feb 2024, 2:03 PM
Lisa
Lisa - avatar
+ 1
Thank you
21st Feb 2024, 2:18 PM
Sayed Mujtaba Hashimi
Sayed Mujtaba Hashimi - avatar
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(); } }
20th Feb 2024, 2:58 PM
Sayed Mujtaba Hashimi
Sayed Mujtaba Hashimi - avatar
0
I tried this one, but it doesn't work on this app.
20th Feb 2024, 2:59 PM
Sayed Mujtaba Hashimi
Sayed Mujtaba Hashimi - avatar
0
ONLY output according to the task description. NO EXTRA TEXT.
20th Feb 2024, 3:06 PM
Lisa
Lisa - avatar
0
No
20th Feb 2024, 3:08 PM
Sayed Mujtaba Hashimi
Sayed Mujtaba Hashimi - avatar
0
"No" what?
20th Feb 2024, 3:14 PM
Lisa
Lisa - avatar
0
Isn't this code according to the task? It is the "input lesson" of Introduction to Java course.
20th Feb 2024, 3:21 PM
Sayed Mujtaba Hashimi
Sayed Mujtaba Hashimi - avatar
0
Look at the output example.
20th Feb 2024, 3:24 PM
Lisa
Lisa - avatar
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.
20th Feb 2024, 3:36 PM
Sayed Mujtaba Hashimi
Sayed Mujtaba Hashimi - avatar