This is my first semester using matlab and I need some help with this.
My class had an assignment to create a code that estimates your final course grade. I wanted to modify it so it had some more practical use.
This is based on the score and weight of quizzes, homework and exams. Then it takes your final exam weight and it displays your final grade based on how you do on your final from 0-100%
Say a class is only based on homework and exams, if I put zero for the quiz input, it breaks the code. How do I get around this?
Also, is there a better way to display the results? Still new to using matlab.
Here is what I have so far:
clear,clc;AskQuiz= input('How many quizzes do you have? ');QuizWeight=input('What is your quiz weight as a decimal? ');AskExam= input('How many exams do you have? ');ExamWeight=input('What is your exam weight? ');AskHomework= input('How many homework assignments do you have? ');HomeworkWeight=input('What is your homework weight? ');numQuiz = AskQuiz;numExam= AskExam;numHomework=AskHomework;for i=1:numQuiz quiz(i)=input('What is your quiz score? '); totalquiz=sum(quiz(i)); QuizScore=totalquiz*QuizWeight;endfor j=1:numExam exam(j)=input('What is your exam score? '); totalexam=sum(exam(j)); ExamScore=totalexam*ExamWeight;endfor k=1:numHomework homework(k)=input('What is your homework score? '); totalhomework=sum(homework(k)); HomeworkScore=totalhomework*HomeworkWeight;endTotalGrade=QuizScore+ExamScore+HomeworkScore;FinalWeight=input('What is your final weight? ');m=[0:10:100];FinalScore=m*FinalWeight;FinalGrade=FinalScore+FinalWeight;table=[m' FinalGrade'];fprintf('Final Exam Projected Grade Percent\n')disp(table)
Best Answer