+ 2

Please, I need help with this code. I'm just starting in sololearn. It's an easy problem named "Paint costs"

import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int colors = scanner.nextInt(); //My code int a = (colors * 5) + 40; /* each color is 5 and canvas and brushes are 40 */ int b = a / 10; //paying 10% of taxes int c = a + b; //total amount System.out.println(c); } }

6th Feb 2022, 12:48 AM
Lio Batista
Lio Batista - avatar
2 Réponses
+ 4
G'day Lio Batista great attempt. Good work on the Q&A post tag, have you found the search bar (it is the magnifying glass icon at the top of the discuss screen). You have missed one of the instructions of paint costs, let me know if you can't find it after you read the instructions again. Attached here is the forum welcome. https://www.sololearn.com/discuss/1316935/?ref=app
6th Feb 2022, 2:41 AM
HungryTradie
HungryTradie - avatar
+ 2
I did it! Thank you for your help. // Lio Batista's program. import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int colors = scanner.nextInt(); //My code int a = (colors * 5) + 40; /* each color is 5 and canvas and brushes are 40 */ int b = a / 10; //paying 10% of taxes int c = a + b; //total amount int d = a % 10; //rounding b if (d >= 5) { System.out.println (c + 1); } else { System.out.println(c);} } }
7th Feb 2022, 1:24 AM
Lio Batista
Lio Batista - avatar