0

Codecoach--paint costs. I keep failing cases 3 and 4. Can anybody help me

I tried to solve Code Coach's paint costs with Java, but I can't get over case 3 and case 4. import java.util.*; public class Program { public static void main(String[] args) { Scanner sc=new Scanner (System.in); int colors=sc.nextInt(); int res=(40+5*colors); int adaos =res*10/100; int res=res+adaos; System.out.println(resi); } }

18th Jan 2020, 2:46 PM
Cosmin Ionut
Cosmin Ionut - avatar
4 Answers
+ 1
Cost, rate.. Double values. In this you have to deal with float or double values. And convert into Integer by rounding up (with ceil function)...
18th Jan 2020, 3:04 PM
Jayakrishna 🇼🇳
+ 1
Thank you! It worked. It seems like I didn't read the problem too well.
18th Jan 2020, 3:24 PM
Cosmin Ionut
Cosmin Ionut - avatar
0
Fine. It helped you... Wel come..
18th Jan 2020, 3:31 PM
Jayakrishna 🇼🇳
0
import java.util.Scanner ; public class Program { public static void main(String[] args) { Scanner input=new Scanner(System.in); int colors=input.nextInt(); double cost=colors*5+40.00; double p=cost*10/100; System.out.println((int)Math.round(cost+p)); } }
16th Aug 2020, 11:16 AM
Ebney Samrat