Ask your own question, for FREE!
Computer Science 43 Online
OpenStudy (anonymous):

Write a Java program to calculate the grade of the student using the below criteria. Grade "Excellent": Marks>75 Grade "Satisfactory": 75>Marks>50 Grade "Needs Improvement": 50>Marks>40 Grade "Failing": Marks<40

OpenStudy (woodrow73):

this can be done using an if statement. Here is the proper syntax: if(Marks > 75) { System.out.println("Grade \"Excellent\"."); //basically- if variable Marks is greater than //--75, it will execute everything inside the bracuts- in this case //it will execute the System class- which will inform the user //that his grade was excellent. //you can make the rest of the program with if statements like the //one I just demonstrated. //if you're wondering what the backslashes are doing in that string //literal (string literal = what is in the parenthesis after the system class) //the backslashes allow the " quotes to print, without the quotes //opening and closing the string itself. } All of the info after // is just comments that will be ignored by the compiler. Also, when I saw your question- there is one quick issue I saw in the logic; it says excellent > 75, and it says 75 > satisfactory > 50 -- if your variable 'marks' was to equal 75, it would not fall under any catagory. To fix this, use the greater than or equals to sign: >= . there is also the less than or equals to sign: <= Notice the equals sign is after the greater/less than sign. It must be in that orientation to be proper syntax. Allright- if you have any questions lemme know.

OpenStudy (woodrow73):

all of the words after the System.out.println(""); are comments- and should not be in your program- but remember the opening & closing brackuts.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
chuu: Is it (Hunt 30-31) or (Hunt 30-1) in MLA?
10 minutes ago 0 Replies 0 Medals
luvnickk: what typa music yall listen to ?
40 minutes ago 15 Replies 2 Medals
GothgirlLillian: Is music considered art?
54 minutes ago 2 Replies 0 Medals
luvnickk: am newwww
4 hours ago 0 Replies 0 Medals
russianmafiya: can someone help me write a love song
5 hours ago 1 Reply 0 Medals
arrivhn: ADD ME ON DISCORD ICYAFFL
6 hours ago 4 Replies 1 Medal
arrivhn: whats is the accute of a cricle
6 hours ago 4 Replies 3 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!