Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

THIS IS MATLAB CODE NOT JAVA PYTHON OR C++ plEASE HELP 1. The cost per mile for a rented vehicle is $ 1.00 for the

THIS IS MATLAB CODE NOT JAVA PYTHON OR C++ plEASE HELP

1. The cost per mile for a rented vehicle is $ 1.00 for the first 50 miles, $0.75 for the next 200 miles, and $0.50 for all miles in excess of 250 miles. Write a MATLAB program (rentalcar,m) to determine the total cost for a user given number of miles.

2. Write a program that accepts a month and a year (both in numbers) from the user and prints out the number of days in that month. Background: There are 31 days in January, March, May, July, August, October, or December, and 30 days in April, June, September, or November. If the year is a leap year, February has 29 days, otherwise it has 28 days. Any year that is evenly divisible by 4 is a leap year. For example, 1988, 1992, and 1996 are leap years. However, there is still a small error that must be accounted for. To eliminate this error, a year that is evenly divisible by 100 (for example, 1900) is a leap year only if it is also evenly divisible by 400. For this reason, the following years are not leap years: 1700, 1800, 1900, 2100, 2200, 2300, 2500, 2600. This is because they are evenly divisible by 100 but not by 400. The following years are leap years: 1600, 2000, 2400. To determine if a number x is evenly divisible by another number y, in MATLAB, you can call a build-in function mod(x,y). If mod(x,y) is equal to 0, x is evenly divisible by y. For example, mod(1900, 100) is 0 and mod(1900,400) is 300

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions

Question

How does the concept of hegemony relate to culture?

Answered: 1 week ago

Question

Define Management or What is Management?

Answered: 1 week ago

Question

Lo6 Identify several management development methods.

Answered: 1 week ago