Question

Matlab Question (Matlab Grader). Suppose a course letter grade is assigned per the following scheme: Letter...

Matlab Question (Matlab Grader).

Suppose a course letter grade is assigned per the following scheme:

Letter Grade______ Course Numerical Grade Interval

A _______________[90,100]

B_______________ [80,90)

C_______________ [70,80)

D_______________ [60,70)

F_______________ [0.60)

Write a function, called coursegrade, that takes one non-negative input, numgrade, and assigns an output, letgrade, which is the corresponding letter grade character value, i.e, 'A', 'B', etc... , assigned per the scheme above. Assume that the input will always be a non-negative number less than or equal to 100.

Use on if statement containing several elseif's and one else in your code.

Note that the script is set up to call and test your function.

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

Code:

function letter_grade = coursegrade(num_grade)
if num_grade >= 90
letter_grade = "A";
elseif (num_grade >= 80) && (num_grade < 90)
letter_grade = "B";
elseif (num_grade >= 70) && (num_grade < 80)
letter_grade = "C";
elseif (num_grade >= 60) && (num_grade < 70)
letter_grade = "D";
else
letter_grade = "F";
end
  
end

Output:

>> letter_grade = coursegrade(75)

letter_grade =

"C"

>> letter_grade = coursegrade(90)

letter_grade =

"A"

>> letter_grade = coursegrade(55)

letter_grade =

"F"

>>

Add a comment
Know the answer?
Add Answer to:
Matlab Question (Matlab Grader). Suppose a course letter grade is assigned per the following scheme: Letter...
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
  • Numerical Methods (MatLab) 2 Required information Following is the scheme to assign letter grade to a numeric grade f...

    Numerical Methods (MatLab) 2 Required information Following is the scheme to assign letter grade to a numeric grade for students. Letter Criteria A 90 s numeric grade s 100 80 s numeric grade < 90 eBook 70 s numeric grade < 80 60 s numeric grade < 70 numeric grade < 60 Hint References Using M-file, identify the letter grade for the following numeric grades. Numeric grade Letter grade 70.0001 (Click to select) A 78 C Mc Prev 2 of...

  • Matlab Question (Matlab Grader) Where indicated at the bottom of the script. write a function, called...

    Matlab Question (Matlab Grader) Where indicated at the bottom of the script. write a function, called isright, that takes three inputs, a, b, and c, and determines whether they are could be the lengths of the sides of a right triangle; the output, y, will be set equal to the following: i). -1 if at least one of the values is not positive. Also, only for this case, have the function print out an error message, which states "At least...

  • Please answer 1c, use MATLAB, and paste your entire script in your answer so that I...

    Please answer 1c, use MATLAB, and paste your entire script in your answer so that I can copy and paste to see if it works. Problem #1 400g triangle square pentagon hexagon Figure 1 For a closed geometric figure composed of straight lines (Figure 1), the interior angles in the figure must add to (n-2)(180) where n is the number of sides. Required Tasks a) Write a script that prompts the user to select from one of the following shapes:...

  • I need help solving these questions,please don’t know how to solve it by using matlab.!

    i need help solving these questions,please don’t know how to solve it by using matlab.! Solve the following questions Ol: You are required to develop a script to calculate the volume of a pyramid, which is 1/3 *base *height, where the base is length *width. Prompt the user to enter values for the length, width, and height, and then calculate the volume of the pyramid. When the user enters each value, he or she will then also be prompted to...

  • matlab 28 pts Question 8 Problem 4. Write the following function. Do NOT hard code using...

    matlab 28 pts Question 8 Problem 4. Write the following function. Do NOT hard code using any of the examples. Your function should work for all possible inputs as specified by the problem. Hard coding will result in significant point loss. (B) (28 Points) Function Name: birthday Party Input (2): (char) An Mx 11 array formatted with information about various birthdays (char) An MxN array of names Output (l): (char) A string containing information about the best birthday Function Description:...

  • can you do this js and html question. ill give you the html and js and...

    can you do this js and html question. ill give you the html and js and css files just fix my error use if and else like what i did dont use switch just fix my erorr. <!DOCTYPE html> <!-- Webpage HTML document for Lab 4. Authors: Amirhossein Chinaei, Andriy Pavlovych For: EECS 1012, York University, Lassonde School of Engineering --> <html lang="En"> <head> <meta charset="UTF-8"> <!-- title for web page --> <title> EECS1012: Lab 4 - Computational Thinking </title>...

  • Write a C++ program named, gradeProcessor.cpp, that will do the following tasks: -Print welcome message -Generate...

    Write a C++ program named, gradeProcessor.cpp, that will do the following tasks: -Print welcome message -Generate the number of test scores the user enters; have scores fall into a normal distribution for grades -Display all of the generated scores - no more than 10 per line -Calculate and display the average of all scores -Find and display the number of scores above the overall average (previous output) -Find and display the letter grade that corresponds to the average above (overall...

  • Designing functions Reminder: When designing functions, follow the given steps to reinforce good software development p...

    Designing functions Reminder: When designing functions, follow the given steps to reinforce good software development practices and problem solving strategies: a) Start by writing the documentation for the function. Use docstrings shown in lecture and lab. b) Write test calls to the function in your main function for the different cases of input the function will encounter. This will help you understand the behavior of the function and later behave as tests for your function. c) Define the function d)...

  • Nay programming languge is fine (MatLab, Octave, etc.) This is the whole document this last picture...

    Nay programming languge is fine (MatLab, Octave, etc.) This is the whole document this last picture i sent is the first page 5. Write and save a function Sphere Area that accepts Radius as input argument, and returns SurfaceArea (4 tt r) as output argument. Paste the function code below. Paste code here 6. Validate your Sphere Area function from the command line, checking the results against hand calculations. Paste the command line code and results below. 7. Design an...

  • JAVA PROJECT Part 1 - Normalize Text The first thing we will do is normalize the...

    JAVA PROJECT Part 1 - Normalize Text The first thing we will do is normalize the input message so that it’s easier to work with. Write a method called normalizeText which does the following: Removes all the spaces from your text Remove any punctuation (. , : ; ’ ” ! ? ( ) ) Turn all lower-case letters into upper-case letters Return the result. The call normalizeText(“This is some \“really\” great. (Text)!?”) should return “THISISSOMEREALLYGREATTEXT” Part 2 - Obfuscation...

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