Question

In: Computer Science

using matlab: 1- Using ‘input’ command, ‘prompt’ your name and ask for a grade (A, B,...

using matlab:

1- Using ‘input’ command, ‘prompt’ your name and ask for a grade (A, B, C, D, F should be accepted only, otherwise it should ask again)

2- Use ‘display’ command for the previous problem and display your name and your grade

Solutions

Expert Solution

Please follow the code and comments for description :

CODE :

prompt = 'What is your Name.? '; % prompt for the name
str = input(prompt,'s'); % read the data using the input command

prompt1 = 'What is your Grade.? '; % prompt for the grade
str1 = input(prompt1,'s'); % read the data using the input command
while 1 % itarate over the while loop consition is satisfied
    prompt1 = 'What is your Grade.? '; % re prompt the grade
    str1 = input(prompt1,'s'); % read the data using the input command
    if ((str1 == 'A') || (str1 == 'B') || (str1 == 'C') || (str1 == 'D') || (str1 == 'F')) % check for the condition
        break % break the loop if condition is satisfied
    end
end

% display the data entered
display('Your Name is : ');
display(str);
display('Your Grade is : ');
display(str1);

OUTPUT :


Hope this is helpful.


Related Solutions

using python 3 1. Two-line input: print a prompt (e.g Enter your first name) and then...
using python 3 1. Two-line input: print a prompt (e.g Enter your first name) and then assign the input to a variable print ("Enter your first name")# the word prompt is the message the user should see firstName = input() print (firstName)
USE MATLAB Write a program in Matlab that would continuously ask the user for an input...
USE MATLAB Write a program in Matlab that would continuously ask the user for an input between 1 and 6, which would represent the result of rolling a die. The program would then generate a random integer between 1 and 6 and compare its value to the value entered by user. If the user’s die is larger, it should display, “Mahahanap mo na ang forever mo. Sana all!” If the user’s die is smaller, it should display, “Gising na friend,...
Prompt the user for their name, get and store the user input. Prompt the user for...
Prompt the user for their name, get and store the user input. Prompt the user for their age, get and store the user input. We will assume that the user will enter a positive integer and will do no error checking for valid input. Determine and store a movie ticket price based on the user's age. If their age is 12 or under, the ticket price is $5. If their age is between 13 and 64, inclusive, the ticket price...
Create a small program that contains the following. ask the user to input their name ask...
Create a small program that contains the following. ask the user to input their name ask the user to input three numbers check if their first number is between their second and third numbers
Part 1. Call your program by the name: "program_001_print_primes_between_a_and_b". Input two integers a and b. Your...
Part 1. Call your program by the name: "program_001_print_primes_between_a_and_b". Input two integers a and b. Your program must print all the prime numbers between a and b.  You must use the function int is_prime(int n) in your solution.  The  is_prime( ) function takes an integer n as input, and returns 1 if n is prime and 0 if n is prime, i.e., if n is composite. NOTE: Upload ONLY your source code. Do not upload the entire executable or the solution file/folder.
Write a recursive function (using Matlab) moreFactors(a,b,fact) that does the following: 1. Takes as an input...
Write a recursive function (using Matlab) moreFactors(a,b,fact) that does the following: 1. Takes as an input 3 positive integers. 2. Of the two integers a and b, the function returns the integer that has the most factors fact. 3. If both integers a and b have the same amount of factors fact, the function will return the larger integer. Test your function with the following: >> result=moreFactors(24,32,3) result = 24 (24 = 3^1 · 2^3 , 32 = 2^5 )...
Write a program that uses input to prompt a user for their name and then welcomes...
Write a program that uses input to prompt a user for their name and then welcomes them. Note that input will pop up a dialog box. Enter Sarah in the pop-up box when you are prompted so your output will match the desired output.(In Python)
1. At the command prompt, use the where command to locate the where.exe file. Copy and...
1. At the command prompt, use the where command to locate the where.exe file. Copy and paste the full path and filename for the where.exe file into the space provided below. 2. At the command prompt, enter the following command and press enter. find "free beer" "c:\Program Files (x86)\Notepad++\*.txt" This command searches for the string "free beer" in all .TXT files in the Notepad++ program folder. According to the output of the find command, which of the files listed below...
Create a python program that will: prompt a user for a command Command get_data Level 1:...
Create a python program that will: prompt a user for a command Command get_data Level 1: Take one of the commands my_max my_min my_range my_sum mean median mode fib factorize prime Requirements: Your commands should be case-insensitive You should use python lists to store data You should NOT use built-in python math functions, or math libraries to compute these values Tips: Write one function that will convert a string with comma-separated numbers into a python list with the numbers. You...
Python #Use an input statement to ask the user for his/her age (no prompt) and assign...
Python #Use an input statement to ask the user for his/her age (no prompt) and assign the user entry to a variable #Convert the user input to an integer and assign to a variable #Write if-elif-else statements with the following conditions and actions #Important: For each Action below, use the same variable name for the rating in all the if, elif, and else statements #Condition: user input less than or equal to 9 Action: assign the letter G as a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT