Question

Create a MATHLAB program that will compute for the discounted parking fee given the number of...

Create a MATHLAB program that will compute for the discounted parking fee given the number of hours parked and parking levels as input.

Fee: 30 for 1st 2 hours. 10 for each succeeding hours

Parking levels:

A (no discount)

B (5% off)

C(10% off)

name the program park.m

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Program:

hours = input("Enter numbe of hours : ");
level = input("Enter the level : ", 's');

if hours < 2
fee = 30;
else
fee = 30 + (hours - 2) * 10;
endif

if level == 'B'
fee = fee * 0.95;
elseif level == 'C'
fee = fee * 0.9;
endif

fprintf("\nFee for parking is : %0.2f\n\n",fee);


Screenshot: ( for reference )

Output:

-----------------
Note: If you have any doubts please comment.

It will be great help If you like.

Add a comment
Know the answer?
Add Answer to:
Create a MATHLAB program that will compute for the discounted parking fee given the number of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • A parking garage has 5 customers daily. The garage charges a $5.00 minimum fee to park...

    A parking garage has 5 customers daily. The garage charges a $5.00 minimum fee to park up to two hours. The garage charges an additional $1.00 per hour for each hour (or part of an hour) over two hours. The maximum charge for any given day is $12.00. All cars are gone by midnight. Write a program to calculate and print a summary of the charges for a day. For input the program will read the hours of usage for...

  • Write a program in C An international airport offers long term parking at the following rates:...

    Write a program in C An international airport offers long term parking at the following rates: First 60 minutes is free; 61-80 minutes $4; Each additional 20 minutes $2; And $18 max. per day (24 hours). Write a program longterm_parking.c that calculates and prints the charges for parking at the long term parking garage. 1. The user enters the number of total hours and minutes; the program prints the charge. 2. If the input is invalid, print a message and...

  • A parking garage charges a $2.00 minimum fee to park for up to three hours. The...

    A parking garage charges a $2.00 minimum fee to park for up to three hours. The garage charges an additional $0.50 per hour in excess of these initial three hours. The maximum charge for any given 24 hour period is $10.00. Assume no car parks for longer than 24 hours at a time. Write a program that calculates and prints the total parking charges for the customers who parked their cars in this garage (at least 4 cars) and the...

  • Parking Ticket Simulator C++ HELP PLEASE

    For this assignment you will design a set of classes that work together to simulate a police officer issuing a parking ticket. The classes you should designare:• The ParkedCar Class: This class should simulate a parked car. The class’s responsibilities are:o To know the car’s make, model, color, license number, and the number of minutes that the car has been parked• The ParkingMeter Class: This class should simulate a parking meter. The class’s only responsibility is:o To know the number...

  • When parking a car in a downtown parking lot, drivers pay according to the number of...

    When parking a car in a downtown parking lot, drivers pay according to the number of hours or fraction thereof. The probability distribution of the number of hours cars are parked has been estimated as follows: X 1 2 3 4 5 6 7 8 P(X) 0.224 0.142 0.106 0.08 0.057 0.039 0.033 0.319 A. Mean = B. Standard Deviation = The cost of parking is 2.25 dollars per hour. Calculate the mean and standard deviation of the amount of...

  • When parking a car in a downtown parking lot, drivers pay according to the number of hours or fraction thereof.

    When parking a car in a downtown parking lot, drivers pay according to the number of hours or fraction thereof. The probability distribution of the number of hours cars are parked has been estimated as follows: X12345678P(X)0.2130.1170.120.0850.0620.0280.0230.352A. Mean = _______ B. Standard Deviation = _______ The cost of parking is 3.25 dollars per hour. Calculate the mean and standard deviation of the amount of revenue each car generates A. Mean = _______ B. Standard Deviation = _______ 

  • using java: For this exercise, you will design a set of classes that work together to simulate a parking officer checkin...

    using java: For this exercise, you will design a set of classes that work together to simulate a parking officer checking a parked car issuing a parking ticket if there is a parking violation. Here are the classes that need to collaborate: • The ParkedCar class: This class should simulate a parked car. The car has a make, model, color, license number. •The ParkingMeter class: This class should simulate a parking meter. The class has three parameters: − A 5-digit...

  • Use the description from Parking Ticket Simulator from Chapter 14 as a basis, where you need...

    Use the description from Parking Ticket Simulator from Chapter 14 as a basis, where you need to create a Car class and Police Officer class, to create a new simulation. Write a simulation program (refer to the Bank Teller example in the PPT) that simulates cars entering a parking lot, paying for parking, and leaving the parking lot. The officer will randomly appear to survey the cars in the lot to ensure that no cars are parked beyond their time...

  • 30. Create a program that will create a "number battle" between two users. Ask each user to enter three numbers that sum to a maximum of 30. Then the program will compare each users 1st, 2nd...

    30. Create a program that will create a "number battle" between two users. Ask each user to enter three numbers that sum to a maximum of 30. Then the program will compare each users 1st, 2nd and 3rd number and determine who won each battle. For instance if user A enters 18,11,1 and user B enters 6,17,7 then user B would win because they won 2 of 3 battles. Have a check to see if the sum to 30 rule...

  • Write a program to run the following methods in C#. 2) Write a method that takes...

    Write a program to run the following methods in C#. 2) Write a method that takes in a teacher’s last name and exam number via parameters. Ask the teacher (using her name) to tell you the highest score on that exam. Your question should look something like “Ms. Jones, what was the highest grade on test two?” Return the value of the highest grade to the calling method. 3) Write a function called MinOfThree that takes in three numbers and...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT