I need help solving this problem please help me | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I need help solving this problem please help me

The owner of a parking lot requires a program that allows him to determine how much he should charge for the use of the parking lot to his clients. The rates they have are as follows. The first two hours to $ 5.00 each. The next three to $ 4.00 each. The next five to 3.00 c / u. I need to solve the problem is a task for the course I attend

17th Jun 2017, 3:00 AM
victor
18 Answers
+ 2
jajaj significa que por cada hora me cobraría 5pesos por ejemplo Hahaha means that for every hour I would charge 5pesos for example
17th Jun 2017, 3:59 AM
victor
+ 2
gracias por su ayuda Thanks for your help, thank you very much
17th Jun 2017, 4:08 AM
victor
+ 1
well with C++ u have the time function to save in a var then you can use if else statements to full the money part of it. or simply have an cin inout of hours then if or switch statements
17th Jun 2017, 3:44 AM
NulledNVoided
NulledNVoided - avatar
+ 1
i think continued
17th Jun 2017, 3:57 AM
NulledNVoided
NulledNVoided - avatar
+ 1
ahhh ok
17th Jun 2017, 4:00 AM
NulledNVoided
NulledNVoided - avatar
+ 1
Try having the code get the inputed hours from you or make a timer. then it takes that time and runs through the series of hours and chrages based on that
17th Jun 2017, 4:01 AM
NulledNVoided
NulledNVoided - avatar
+ 1
I would use if statements for each of the ten hours. That may not be good enough for a school solution. like edit or a set of three double conditionals if ( hour > 0 && hour <=2){ return cost += 5; }
17th Jun 2017, 4:02 AM
Manual
Manual - avatar
+ 1
Thats exactly how i would make it are switch statements but time can be complicated with those
17th Jun 2017, 4:04 AM
NulledNVoided
NulledNVoided - avatar
+ 1
True but may run faster then nested if
17th Jun 2017, 4:08 AM
NulledNVoided
NulledNVoided - avatar
+ 1
You are welcome I hope that you do well in your course and enjoy coding
17th Jun 2017, 4:08 AM
NulledNVoided
NulledNVoided - avatar
+ 1
@Nulled True again, C++ is already fast, and the code would be simple.
17th Jun 2017, 4:09 AM
Manual
Manual - avatar
+ 1
@Manual Ahh ok im still learning all of this too. All ik that professors like fast and accurate​ lol
17th Jun 2017, 4:10 AM
NulledNVoided
NulledNVoided - avatar
+ 1
@Victor De nada
17th Jun 2017, 4:10 AM
Manual
Manual - avatar
+ 1
@Nulled That makes sense, its a good practice.
17th Jun 2017, 4:12 AM
Manual
Manual - avatar
+ 1
@Manual Thanks. Also thank you for your help with this and the knowledge you gave us both.
17th Jun 2017, 4:14 AM
NulledNVoided
NulledNVoided - avatar
+ 1
Your welcome!
17th Jun 2017, 4:16 AM
Manual
Manual - avatar
0
what is c / u?
17th Jun 2017, 3:57 AM
Manual
Manual - avatar
0
@Nulled Switch statements would tske up more lines.
17th Jun 2017, 4:07 AM
Manual
Manual - avatar