Please find what's wrong in this program. When we enter run: input — 2, output — 55, expected— 55. But my 5 tests are failed | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please find what's wrong in this program. When we enter run: input — 2, output — 55, expected— 55. But my 5 tests are failed

import java.util.*; public class Paint_cost { public static void main(String[] args) { Scanner in = new Scanner (System.in); int i; System.out.println("enter the number of paints bought"); i= in.nextInt(); int paint= i*5; int total= paint + 40; int tax= (10*total)/100; int cost= total + tax; System.out.println("paint cost ="+cost); } }

20th Aug 2020, 7:35 AM
Irine Theresa Antony
Irine Theresa Antony - avatar
1 Answer
+ 1
your solution prints unnecessary additional text. look at my solution and compare ... excuse me for my english import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner in = new Scanner (System.in); double ncolors,project = 40.00; ncolors = in.nextDouble(); project+=(ncolors * 5); project = project + project * 0.1; System.out.printf("%.0f",project ); } }
22nd Jan 2021, 6:31 PM
Luis Andrés Valido Fajardo 🇨🇺
Luis Andrés Valido Fajardo 🇨🇺 - avatar