Code Coach : easy | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

Code Coach : easy

I have figured out 3 out of 5 cases on this task, but since there are 2 cases that aren't answered correctly, there is a problem with my code. I will be posting the question here and my attempt in the comments section. Paint costs +10 XP You are getting ready to paint a piece of art. The canvas and brushes that you want to use will cost 40.00. Each color of paint that you buy is an additional 5.00. Determine how much money you will need based on the number of colors that you want to buy if tax at this store is 10%. Task Given the total number of colors of paint that you need, calculate and output the total cost of your project rounded up to the nearest whole number. Input Format An integer that represents the number of colors that you want to purchase for your project. Output Format A number that represents the cost of your purchase rounded up to the nearest whole number. Sample Input 10 Sample Output 99

21st Dec 2020, 7:30 PM
4 Réponses
22nd Dec 2020, 11:48 AM
Simba - avatar
This is the attempt i used to solve three cases, and still don't know what is wrong with my code. #include <iostream> using namespace std; int main() { int BrushesAndCanvas = 40.00; int paints; cin >> paints; int PaintsPrice = paints* 5.00; float tax = 0.1; int total = (PaintsPrice + BrushesAndCanvas ); double total2 = total * tax; int total3 = total + total2; cout << total3 ; return 0; }
21st Dec 2020, 7:31 PM
Hakam, you did show your attempt, but is this a code-coach pro code?
21st Dec 2020, 7:36 PM
Dino Wun (Use the search bar plz!)
Dino Wun (Use the search bar plz!) - avatar
Dino Wun (Use the search bar plz!) no, it's on the free version. Ri He won't making the output "int" would round the answer to the nearest whole number?
22nd Dec 2020, 2:27 AM