Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Β© A+ Computer Science - www.apluscompsci.com
- //Name -
- //Date -
- //Class -
- //Lab -
- import static java.lang.System.*;
- public class Grade
- {
- private int numGrade;
- public Grade()
- {
- numGrade = 100;
- }
- public Grade(int grade)
- {
- numGrade = grade;
- }
- public void setGrade(int grade)
- {
- numGrade = grade;
- }
- public char getLetterGrade(int x, char word)
- {
- if(x>90){
- word='A';
- }
- else if(x>80){
- word = 'B';
- }
- else if(x>70){
- word ='C';
- }
- else if(x>60){
- word ='D';
- }
- else if(x>50){
- word ='F';
- }
- char letGrade= word;
- return letGrade;
- }
- public String toString()
- {
- return numGrade + " is a " + getLetterGrade() + "\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement