Please find the required MATLAB code below along with necessary details in comments:
clear all
clc
% prompt user to enter the choice
prompt= '\nDo you wish to enter grade (Yes/No):';
decision=input(prompt,'s');
decision=lower(decision); % convert the response to lower
case
count=0; % no. of subject whose info has been sucessfully
eneterd
while strcmp(decision,'yes'); % if the choice to enter is
yes
trail=1; % attempt one to enter the data
flag=0; % indicate the sucessfull attempt to enter info. flag=0
indicate data has not been entered
while flag~=1 && (trail==1 || trail==2 || trail==3)
flag=0;
% eneter the subject info
subject=input('\nEnter the name of subject:','s');
grade=input('\nEnter the grade (A-F):','s');
grade=upper(grade); % convert th grade to upper case
% if grade eneterd is not correct, issue a warning and repeat the
process
if isempty(grade) || (~strcmp(grade,'A')&&
~strcmp(grade,'B')&& ~strcmp(grade,'C')&&
~strcmp(grade,'D') && ~strcmp(grade,'E')&&
~strcmp(grade,'F'))
warning('\nNot a valid grade. Please try again!');
trail=trail+1;
flag=0;
continue;
else
flag=1; % turn flag to 1 to indicate sucess status
end
% enter credit hour infomation
credit_hours=input('\nEnter the number of Credit hours:');
if isempty(credit_hours) || credit_hours<0
warning('\nCredit hours can not be negative. Please try
again!');
flag=0;
trail=trail+1;
continue;
else
flag=1;
end
end
% check if information has been sucessfully enterd or not
if flag==0
fprintf('\nInvalid information. Terminating...');
break;
else % display the collected information
count=count+1;
fprintf('\nCourse \t Grade \t Credits\n');
fprintf('%s \t %s \t %3.2f',subject,grade,credit_hours);
Final_subject{count,1}=subject;
Final_grade(count,1)=grade;
Final_credit(count,1)=credit_hours;
end
decision=input(prompt,'s'); % ask user if he/she want to enter more
data
decision=lower(decision);
end
% if user has stopped enetering new data
if ~strcmp(decision,'yes') && count~=0
% display the collected data
fprintf('\n The data entered is as follows:\n');
fprintf('\nCourse \t Grade \t Credits\n');
for k=1:size(Final_grade,1)
fprintf('\n%s \t %s \t
%3.2f',Final_subject{k,1},Final_grade(k,1),Final_credit(k,1));
% find corresponding grade point for each grade
if strcmp(Final_grade(k,1),'A')
grade_point(k,1)=10;
elseif strcmp(Final_grade(k,1),'B')
grade_point(k,1)=9;
elseif strcmp(Final_grade(k,1),'C')
grade_point(k,1)=8;
elseif strcmp(Final_grade(k,1),'D')
grade_point(k,1)=7;
elseif strcmp(Final_grade(k,1),'E')
grade_point(k,1)=6;
else
grade_point(k,1)=10;
end
end
fprintf('\n GPA: %3.2f',mean(grade_point)); % report grade point
average
end
------------------------ SCREENSHOT OF CODE
----------------------------------- SAMPLE OUTPUT
TEST CASE 1:
TEST CASE 2:
In Matlab. Use loops. 2. Create an algorithm to allow the user to enter a list...
Matlab a) Write a MATLAB code that takes the grade letters from the user and provide him/her with the GPA for that semester Enter your grades (letters): AABBC (input) Your GPA is 3.2 output) b) Write a Matlab user defined function to that takes a letter grade and return a numeric grade as shown in the table below. Any other value should give an error message (Invalid Grade). You function name should be Letter2Grade Use the following information to calculate...
write inputs and outputs declare variables promt user b. Modify the program written for Exercise 9a to determine wener e eReTeO evenly divisible by a user-specified value, with no remainder. That is, is it evenly divisible by 3, 7, 13, or any other user-specified value? 10. (Data processing) As a part-time student, you took two courses last term. Write, run, and test a C++ program that calculates and displays your grade point average (GPA) for the term. Your program should...
Using Python INST-FS-IAD-PROD.INS LAB1 Lab: Create User Account 2. get-password() #promt the user and create password, check the password fits the requirement USE the EXACT file names! Create a user login system. Your code should do the following: 3, create-user_name() #use this function to create the user name 1.Create your user database called "UD.txt", this should be in CSV format 4, write-file() #user this function to save the user name and password into "UD.txt" Deliverables: Sample: the data you saved...
This is a simple program that I'm struggling with. Java is not my forte... It's way too verbose for my liking. Anyways... The criteria for the prog is as follows: No issues with the GUI, I can do this on my own, but for a reference see the following: A combo box should allow the user to select one of the four database actions shown. The database should be implemented as a HashMap, with the ID field as the key...
12.8 GPA reports using files Prompt the user by "Enter name of input file: " for the name of an input file and open that file for reading. The two input files for the tests are already at the zyBooks site.They each have a list of student names with the course they have taken, of the form Jacobs, Anthony ECS10 4 B- ECS20 4 C+ ANS17 3 A ANS49H 2 D Wilson, Elaine ECS10 4 B+ ECS20 4 C+ ANS17...
RandomGame.cpp (2pt) Write a program that asks the user to enter his/her name. Then begin a do while loop that asks the user to enter a number between 1 and 10. Have the random number generator produce a number 1 and 10. Display the user’s name and both numbers to the screen. Compare the two numbers and report if the entered number is greater than, less than, or the same as the generated number. Ask the user if he/she’d like...
In Matlab Create a single script (.m file) to solve these problems. Unless directed otherwise, use meaningful variable names for each variable; do not use the default variable ans to store your results. For this project, suppress your output with semi-colons (;). Each problem should be in a separate cell, using the cell mode feature of MATLAB. Problem 4 Video games are rather complicated to program, not least of which because of the graphics work that needs to be completed...
Programming Instructions:Using Java Object Oriented Principles, write a program which produces the code as indicated in the following specifications: Your program must be a console application that provides a user this exact menu:Please select one of the following:1: Add Client to Bank2: Display Clients in the Bank3: Set Bank Name4: Search for a Client5: Exit Enter your Selection: <keyboard input here> The menu must be displayed repeatedly until 5...
I need atleast 1000 words in this assignment, thank you. Create Activity diagram Use-case diagram CRC cards Class diagrams for developing a new online attendance system to be developed for a university. The steps of the activity diagram are as follows: (You have to follow every step to create the complete activity diagram) a) The faculty is asked to first enter valid username and password in the system. b) If an invalid username or password is entered, a message is...
Write a contacts database program that presents the user with a menu that allows the user to select between the following options: (In Java) Save a contact. Search for a contact. Print all contacts out to the screen. Quit If the user selects the first option, the user is prompted to enter a person's name and phone number which will get saved at the end of a file named contacts.txt. If the user selects the second option, the program prompts...