+ 1

Please help me with c++ code

I have a problem with task below. One test case fails. I don't know why. 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 #include <iostream> #include <cmath> using namespace std; int main() { int colors; cin >> colors; float costWithTax = 1.1*(5*colors+40); cout << ceil(costWithTax); return 0; }

11th Mar 2023, 8:04 PM
Monika Izydorczyk
Monika Izydorczyk - avatar
3 odpowiedzi
+ 1
Can you be specific about the test case you are failling?Also, it's good to tag what the lesson number is so people know where to look.
12th Mar 2023, 2:22 AM
Justice
Justice - avatar
+ 1
I've just added the name of code challenge as a tag. Unfortunately, this test case is hidden. This is the last one, 5th test case.
12th Mar 2023, 6:33 AM
Monika Izydorczyk
Monika Izydorczyk - avatar
+ 1
I've just found the solution in previous discussion. cout << (int)ceil(costWithTax); Someone else had the same problem.
12th Mar 2023, 6:41 AM
Monika Izydorczyk
Monika Izydorczyk - avatar