A car rental firm leases its cars for $250 per day.

A car rental firm leases its cars for $250 per day. The manager gives a discount based on the number of days that the car is rented. If the rental period is greater than or equal to 7 days then a 25% discount is given. Read the period and print the discount given

Questions by jovan

Showing Answers 1 - 2 of 2 Answers

midosouf

  • Jan 21st, 2011
 

Code
  1. Sub rent()

  2.       Dim x, i, y As Single

  3.     i = InputBox("nb of day")

  4.        x = 250

  5.       If i >= 7 Then

  6.          y = x * i

  7.          i = y * 25 / 100

  8.  

  9.              Else

  10.              i = x * i

  11.                   End If

  12. Debug.Print y; "discout="; i

  13. End sub

  Was this answer useful?  Yes

Michael Loofburrow

  • Jun 12th, 2012
 

Here it is in C++

Code
  1. void Discount()

  2. {

  3.         int days;

  4.         float discount;

  5.  

  6.         cout >> "How many days has the car been rented?" << endl;

  7.         cin << days;

  8.        

  9.         if(days >= 7)

  10.                 discount = (250*days)*0.25;

  11.                

  12.         cout >> "The discount is " >> discount >> " dollars."

  13.        

  14.         return;

  15. }

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions