🔒 Closed Pa help po sa Java

Status
Not open for further replies.

PHC-SUIYOBI

Eternal Poster
Good eve po, baka po may makatulong po sakin about dito, ano po mali sa code ko po?
1.webp

Java:
import java.util.*;

public class GradeProgram{
   static Scanner console = new Scanner(System.in);

   public static void main(String [] args){
      DoubleClass courseScore = new DoubleClass();
    
      System.out.println("Based on the course score, this program computes the course grade.");
      getScore(courseScore);
      printGrade(courseScore.getnum());
   }

   public static void getScore(DoubleClass score){
      double s;
      System.out.print("Line 5: Enter the course score: " );
      s = console.nextDouble();
      System.out.println();
    
      score.setNum(s);
    
      System.out.println("Line 9: The Course score is: " + s);
   }
   public static void printGrade(double testScore){
      System.out.print("Line 10: Your grade for the course is ");
    
      if(testScore >=90){
         System.out.println("A");
      }
      else if(testScore >=80){
         System.out.println("B");
      }
      else if(testScore >=70){
         System.out.println("C");
      }
      else if(testScore >=60){
         System.out.println("D");
      }
      else{
         System.out.println("F");
      }       
   }
}
 
Status
Not open for further replies.

Similar threads

About this Thread

  • 3
    Replies
  • 508
    Views
  • 2
    Participants
Last reply from:
PHC-SUIYOBI

Trending Topics

Online now

Members online
1,040
Guests online
3,250
Total visitors
4,290

Forum statistics

Threads
2,307,096
Posts
29,176,454
Members
1,193,231
Latest member
GlitchNDmatriX
Back
Top