Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

there is an array of letter grade {A+, A, A-, B+, B, B-, C+, C, C-, D+,D, D-,FNS} ask the user enter a valid input

there is an array of letter grade {A+, A, A-, B+, B, B-, C+, C, C-, D+,D, D-,FNS}

ask the user enter a valid input

such as:"Please enter the letter grade of course: "

if input is not valid, ask the user to try again.

if it is a valid input, it has to be stored in an array called course_letter_grade.

it is a part of code of my assignment

the out put should look like this:

Please enter the letter grade of course number 2: a

ERROR: course grade has to be the following...

"A+, A, A-, B+, B, B-, C+, C, C-, D+, D, D-, FNS

Please enter the letter grade of course number 2:

Here is my code, I don't know what's wrong, pls help me and don't use complex code, I'm just a beginner. Thank you so much!!!

do

{

course_letter_grade = new String [nb_courses];

System.out.print("Please enter the letter grade of course number " + (i+1) + ": ");

grade= keyIn.next();

for(int j=0; j<the_letter_grades.length; j++)

{

if(the_letter_grades[j] == grade)

{

course_letter_grade[i] = grade;

break;

}

else

{

System.out.println(" ERROR: course grade has to be the following... "+

"A+, A, A-, B+, B, B-, C+, C, C-, D+, D, D-, FNS ");

again = !again;

}

}

}while(again);

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions