GeekInterview.com
Series: Subject: Topic:
Question: 11 of 51

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
Asked by: jovan | Member Since Mar-2010 | Asked on: Mar 31st, 2010

View all questions by jovan

Showing Answers 1 - 2 of 2 Answers
midosouf

Answered On : Jan 21st, 2011

View all answers by midosouf

Sub rent()
Dim x, i, y As Single
i = InputBox("nb of day")
x = 250
If i >= 7 Then
y = x * i
i = y * 25 / 100

Else
i = x * i
End If
Debug.Print y; "discout="; i


End sub

  
Login to rate this answer.
Michael Loofburrow

Answered On : 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. }

  
Login to rate this answer.

Give your answer:

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

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.