Question

By using if-statements in MATLAB:- Let's assume the following per credit hour costs: Undergrad in-state =...

By using if-statements in MATLAB:-

Let's assume the following per credit hour costs:

Undergrad in-state = 400, graduate in-state = 500

Undergrad out of state = 700, graduate out of state = 800

Write a program that takes user input for 3 questions:

Are you in-state? (1 for yes, 0 for no)

Are you an undergraduate? (1 for yes, 0 for no)

How many credit hours are you taking?

If the number of credit hours is greater than 18 or less than 1, display a message that the credit hours are not in the required range. Similarly, if the answers to the other two questions are not either 0 or 1, display a message that a 0 or 1 is required (use the Matlab function "disp"). Otherwise, calculate the student’s tuition and display that tuition amount to the screen.

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

program code:

clc;
clear all;
ugi=400; %ugi is under graduate in state cost per credit hour
gi=500; %gi is graduate in state cost per credit hour
ugo=700; %ugo is undergraduate out of state
go=800; %%g is graduate out of state
prompt='are you in state? enter 1 if yes 0 if no';
a=input(prompt);
prompt='are you under graduate? 1 if yes 0 if no';
b=input(prompt);
prompt='enter number of credit hours?';
t=input(prompt);
if t>18|t<1
disp('credit hours are not in range');
else
if a==1
if b==1
fee=t*gi;
fprintf('graduate fee in state is %d',fee);
else
fee=t*ugi;
fprintf('under graduate fee in state is %d',fee);
end
elseif a==0
if b==1
fee=t*go;
fprintf('graduate fee out state is %d',fee);
else
fee=t*ugo;
fprintf('under graduate fee out of state is %d',fee);
end
else
disp('0 or 1 is required');
end
end

PLEASE LIKE

Add a comment
Know the answer?
Add Answer to:
By using if-statements in MATLAB:- Let's assume the following per credit hour costs: Undergrad in-state =...
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
  • CS 1050 Homework Assignment 2 – SUMMER 2017 DUE Friday, July 7th at 5PM WARNING –...

    CS 1050 Homework Assignment 2 – SUMMER 2017 DUE Friday, July 7th at 5PM WARNING – Technology failing is not an excuse to turn in your assignment late. START EARLY so you will have time to fix problems before the deadline. Directions: Complete the following homework assignment using the description given in each section. Purpose: The Tuition.c program will be used to Read in the Student ID (an integer value) and use an array search see if the ID is...

  • Description. A university calculates tuition based on student classifications. Resident undergraduate students (living in state) pay...

    Description. A university calculates tuition based on student classifications. Resident undergraduate students (living in state) pay a set amount per credit for 12 or fewer credits and pay 75% of set amount per credit for all additional credits. Non-resident undergraduate students (living out of state) pay $5,000 plus 80% of the set amount for all credits taken. Graduate students pay $9,500 per semester regardless of the number of credits taken. Alumni returning to the university are allowed to audit a...

  • We wish to keep track of student advisees. Each advisee consists of a name, student id, concentra...

    We wish to keep track of student advisees. Each advisee consists of a name, student id, concentration, number of hours completed, name of advisor, whether or not they have completed a major sheet for graduation and whether or not they have filed an intent to graduate. An advisor needs the ability to: o update as well as access each advisee’s information o display all student advisees in the system including all information formatted as shown in the example o display...

  • 1. Evaluate the following expressions if p = 8, 9 = 3, and the value of...

    1. Evaluate the following expressions if p = 8, 9 = 3, and the value of the variable found is False. Show your work. . q <= p . not (p == 4-5) . q != p % 5 . found or p > 5 and q == p + 5 2. Are you able to draw the truth tables for AND, OR, and NOT logical expressions? - Translate the following problem descriptions into Python. 3. If score is greater...

  • use MATLAB to upload the following: an image that you want to process (can be taken...

    use MATLAB to upload the following: an image that you want to process (can be taken yourself or downloaded from the internet) a script that processes the image in TWO ways. manipulates the colors averages pixels together Please make sure the script displays the images (like how I did with the 40 and 80 pixel averaging) so I can easily compare them to the original. Make sure to COMMENT your code as well. Homework 13 Please upload the following: an...

  • Budgeting for an Academic Department at a State University: Can You Believe the Numbers? INTRODUCTION You...

    Budgeting for an Academic Department at a State University: Can You Believe the Numbers? INTRODUCTION You are the senior accounting faculty member in the business school and your dean, Dean Weller, is asking for help. She is very discouraged after a midyear budget meeting with the Vice President of Finance. The college's Department of Social Work has a large budget deficit, and because of this the VP is inclined towards closing the department entirely or closing its bachelor's program. The...

  • Please do this by JAVA!!!!!!! This program can assume all inputs are integers representing whole dollar...

    Please do this by JAVA!!!!!!! This program can assume all inputs are integers representing whole dollar amounts. 1) Ask the user for a stake amount (initial amount of money available to bet). Check to make the sure user enters a correct number (over 0). State a descriptive error to re-prompt the user if the stake amount is not a correct amount like a negative number). 2) Ask the thrower for their bet. The amount of money the thrower has to...

  • Instructions Using the BCException.java and the BankCustomer.java from the first part of the assignment you will...

    Instructions Using the BCException.java and the BankCustomer.java from the first part of the assignment you will implement a driver class called Bank.java to manipulate an ArrayList of BankCustomer objects. Your code should read bank customers’ information from the user. It will then create a bank customer objects and add them to an arraylist in a sorted fashion (sorted by account number). The arraylist should be sorted in ascending order at all times. The arraylist should not contain null objects at...

  • The ACME Manufacturing Company has hired you to help automate their production assembly line. Cameras have...

    The ACME Manufacturing Company has hired you to help automate their production assembly line. Cameras have been placed above a conveyer belt to enables parts on the belt to be photographed and analyzed. You are to augment the system that has been put in place by writing C code to detect the number of parts on the belt, and the positions of each object. The process by which you will do this is called Connected Component Labeling (CCL). These positions...

  • Balance Adjustments Debit Credit Debit Credit Adjusted Trial Balance Debit Credit Income Statement Credit Debit Balance...

    Balance Adjustments Debit Credit Debit Credit Adjusted Trial Balance Debit Credit Income Statement Credit Debit Balance sheet accounts: Cash Accounts receivable Prepaid rent Unexpired insurance Office supplies Rental equipment Notes payable Accounts payable Unearned rental fees Dividends payable Capital stock Retained earnings Dividends Interest payable Accumulated depreciation: rental equipment Salaries payable Income taxes payable Income statement accounts: ERET FE 13 382 Rental fees earned Salaries expense Maintenance expense Utilities expense FILL Rent expense Interest expense Depreciation expense Office supplies expense...

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
ADVERTISEMENT