JAVA-SE-Tutorial-codeswithpankaj icon indicating copy to clipboard operation
JAVA-SE-Tutorial-codeswithpankaj copied to clipboard

Student Report Card System

Open Pankaj-Str opened this issue 1 year ago • 7 comments
trafficstars

Objective

Create a Java application that accepts student details and their marks in various subjects, calculates the total and percentage, determines the pass/fail status, and assigns grades if the student passes. The application should handle input and output operations effectively and display the results in a formatted manner.

Requirements

Input Section

  1. Student Details:

    • Name
    • Roll Number
  2. Marks:

    • JAVA
    • C++
    • Go
    • Ruby
    • C#
    • Python

Output Section

  1. Display the marks for each subject.
  2. Calculate and display the total marks and percentage.
  3. Determine and display the pass/fail status based on the percentage.
  4. If the student passes, display the grade according to the grading system.

Grading System

  • 80 - 100: Grade A
  • 60 - 80: Grade B
  • 40 - 60: Grade C
  • 30 - 40: Grade D

Pass/Fail Criteria

  • A student must have a minimum percentage of 40% to pass.

Instructions

  1. Create a Student class to store the student's name, roll number, and marks for each subject.
  2. Create methods for calculating total marks, percentage, and determining the pass/fail status.
  3. Create methods for assigning grades if the student passes.
  4. Implement input validation to ensure marks are between 0 and 100.

Example

Input

Enter your name: Nishant
Enter Your Roll Number: A1023

Enter Your JAVA Marks: 50
Enter Your C++ Marks: 20
Enter Your Go Marks: 25
Enter Your Ruby Marks: 96
Enter Your C# Marks: 70
Enter Your Python Marks: 65

Output

Student Report Card
-------------------
Name: Nishant 
Roll Number: A1023

Marks:
JAVA = 50/100 
C++ = 20/100 F
Go = 25/100 F
Ruby = 96/100
C# = 70/100
Python = 65/100

Total = 326/600
Percentage = 54%
Status: FAIL

Grading System (if passed):
80 - 100 = Grade A
60 - 80 = Grade B
40 - 60 = Grade C
30 - 40 = Grade D

Assignment Submission

Submit the Java source code file along with a document explaining the implementation, including how the input validation was handled and how the grading system was implemented.

Pankaj-Str avatar Jul 20 '24 12:07 Pankaj-Str

Java Student Report Card

package loop;

import java.util.Scanner;

public class Student_Report_Card {
    String Name, Id;
    int java, c_plus, Go, Ruby, C_sharp, python, total = 100, Pass_Marks = 40;

    void value() {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter the name ");
        Name = scanner.next();
        System.out.print("Enter Your Roll Number: ");
        Id = scanner.next();
    }

    void Marks() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("Enter the Java Mark");
        java = scanner.nextInt();
        System.out.println("Enter the C++ Mark");
        c_plus = scanner.nextInt();
        System.out.println("Enter the GO Mark");
        Go = scanner.nextInt();
        System.out.println("Enter the Ruby Mark");
        Ruby = scanner.nextInt();
        System.out.println("Enter the C_sharp Mark");
        C_sharp = scanner.nextInt();
        System.out.println("Enter the Python Mark");
        python = scanner.nextInt();

    }

    void output() {
        System.out.println("Student Report Card");
        System.out.println("-------------------");
        System.out.print("Name :" + Name);
        System.out.println();
        System.out.println("Roll Number: " + Id);
        System.out.println();
        System.out.println("Marks: ");
        System.out.println();
        System.out.println();
        if (java >= Pass_Marks)
            System.out.println("Java = " + java + "/" + total);
        else System.out.println("Java = " + java + "/" + total + "F");
        if (c_plus >= Pass_Marks)
            System.out.println("C++ = " + c_plus + "/" + total);
        else System.out.println("C++ = " + c_plus + "/" + total + "F");
        if (Go >= Pass_Marks)
            System.out.println("Go = " + Go + "/" + total);
        else System.out.println("Go = " + Go + "/" + total + "F");
        if (Ruby >= Pass_Marks)
            System.out.println("Ruby = " + Ruby + "/" + total);
        else System.out.println("Ruby = " + Ruby + "/" + total + "F");
        if (C_sharp >= Pass_Marks)
            System.out.println("C# = " + C_sharp + "/" + total);
        else System.out.println("C# = " + c_plus + "/" + total + "F");
        if (python >= Pass_Marks)
            System.out.println("Java = " + python + "/" + total);
        else {
            System.out.println("Java = " + python + "/" + total + "F");
        }
        System.out.println();
    }

    int total() {
        int total = java+c_plus+python+Ruby+C_sharp+Go;
        return total;
    }

    float percent() {
        float percent = (float) (total()*100)/600;
        return percent;
    }
float percent=percent();
    void final1() {
        if (Pass_Marks <= java && Pass_Marks <= python && Pass_Marks <= Go && Pass_Marks <= Ruby && Pass_Marks <= c_plus && Pass_Marks <= C_sharp && percent <= Pass_Marks)
        {
            System.out.println("Status : Pass");
            if (percent() >= 80){
                System.out.println("You got Grade A");}
            else if (percent() >= 60){
                System.out.println("You got Grade B");}
            else if (percent() >= 40) {
                System.out.println("You got Grade C");
            }
        }
            else System.out.println("Status : Fail");


    }

        public static void main (String[]args){
            Student_Report_Card whil = new Student_Report_Card();


            whil.value();
            whil.Marks();
            whil.output();

            System.out.println("Total =" + whil.total() + "/ 600");
            System.out.println("Percentage =" + whil.percent() + "%");
            whil.final1();

        }
    }


AlokSingh100 avatar Jul 21 '24 09:07 AlokSingh100

import java.util.Scanner;

class student{
    Scanner sc=new Scanner(System.in);
    String name;
    int rollno,java,c_plus,go,ruby,c,python,total=100;

     public void input(){
         System.out.println("enter the student name: ");
         name=sc.next();
         System.out.println("enter the student roll_no: ");
         rollno=sc.nextInt();

         System.out.println("----------------Subject marks here------------------");

     }
     public void marks(){
         System.out.println("enter the java marks: ");
         java= sc.nextInt();
         System.out.println("enter the c_plus marks: ");
         c_plus=sc.nextInt();
         System.out.println("enter the go marks: ");
         go=sc.nextInt();
         System.out.println("enter the ruby marks: ");
         ruby=sc.nextInt();
         System.out.println("enter the c marks: ");
         c=sc.nextInt();
         System.out.println("enter the python marks: ");
         python=sc.nextInt();
     }
     public void display() {
         System.out.println("---------------------------------------STUDENT  REPORT  CARD ----------------------------------------------------");
         System.out.println("Name of Student: " + name);
         System.out.println("Roll_number: " + rollno);
         System.out.println("-----------------------------------Subject Marks-----------------------------------------------------");
         if (java <= 30) {
             System.out.println("Java: " + java + "/" + total + " Fail");
         } else if (java <=40) {
             System.out.println("Java: " + java + "/" +  total + " D");
         } else if (java<=60) {
             System.out.println("Java: " + java + "/" +  total + " c");

         }else if(java<=80){
             System.out.println("Java: " + java + "/" +  total + " B");
         }else if(java<=100){
             System.out.println("Java: " + java + "/" +  total + " A");
         }
       
         if (c_plus <= 30) {
             System.out.println("C_Plus: " +c_plus  + "/" +  total + " Fail");
         } else if (c_plus <=40) {
             System.out.println("C_Plus: " + c_plus  + "/" +  total + " D");
         } else if (c_plus <=60) {
             System.out.println("C_Plus: " +c_plus + "/" +  total+ " c");

         }else if(c_plus <=80){
             System.out.println("C_Plus: " + c_plus + "/" +  total + " B");
         }else if(c_plus <=100){
             System.out.println("C_Plus: " +c_plus + "/" +  total + " A");
         }
         if (go <= 30) {
             System.out.println("C_Plus: " +go  + "/" +  total + " Fail");
         } else if (go  <=40) {
             System.out.println("C_Plus: " + go + "/" +  total + " D");
         } else if (go <=60) {
             System.out.println("C_Plus: " +go + "/" +  total + " c");

         }else if(go <=80){
             System.out.println("C_Plus: " + go  + "/" +  total + " B");
         }else if(go <=100){
             System.out.println("C_Plus: " + go  + "/" +  total + " A");
         }
         if (ruby <= 30) {
             System.out.println("Ruby: " + ruby  + "/" +  total + " Fail");
         } else if (ruby  <=40) {
             System.out.println("Ruby: " +ruby  + "/" +  total + " D");
         } else if (ruby <=60) {
             System.out.println("Ruby: " + ruby  + "/" +  total + " c");

         }else if(ruby <=80){
             System.out.println("Ruby: " + ruby  + "/" + total + " B");
         }else if(ruby <=100){
             System.out.println("Ruby: " + ruby  + "/" +  total + " A");
         }


         if (c <= 30) {
             System.out.println("C: " + c  + "/" +  total + " Fail");
         } else if (c  <=40) {
             System.out.println("C: " +c  + "/" +  total + " D");
         } else if (c <=60) {
             System.out.println("C: " +c + "/" +  total + " c");

         }else if(c <=80){
             System.out.println("C: " +c  + "/" +  total + " B");
         }else if(c <=100){
             System.out.println("C: " +c + "/" +  total + " A");
         }
         if (python  <= 30) {
             System.out.println("Python: " + python   + "/" +  total + " Fail");
         } else if (python  <=40) {
             System.out.println("Python: " +python   + "/" +  total + " D");
         } else if (python  <=60) {
             System.out.println("Python: " +python  + "/" +  total + " c");

         }else if(python  <=80){
             System.out.println("Python: " +python  + "/" +  total + " B");
         }else if(python  <=100){
             System.out.println("Python: " +python  + "/" +  total + " A");
         }

     
     }
    int total_marks(){
        int total_marks=java+c_plus+go+c+python;
        return total_marks;

    }
    float percentage(){
         float percentage=(float) (total_marks()*100/600);
         return percentage;

    }

     public void status(){
         if (java>30 && go>30 && c_plus>30 && ruby>30 && c>30 && python>30 || percentage()>30){
             System.out.println("status: pass");
         }else{
             System.out.println("status: Fail");
         }
     }


}

public class grade_system_with_function {
    public static void main(String[] args) {
        student grade=new student();
        grade.input();
        grade.marks();
        grade.display();
        System.out.println("total marks is : "+(grade.total_marks()));
        System.out.println("Percentage  is : "+(grade.percentage()));
        System.out.println(("........................"));
        grade.status();

    }

}

shubh9819 avatar Jul 22 '24 14:07 shubh9819

Student Report Card System

package Java;

import java.util.Scanner;

public class Student {
    Scanner sc=new Scanner(System.in);
    String Name,RollNo,result="Pass";
    int JAVA,Cpp,Go,Ruby,Csrp,Python;


    void Student_details(){

        System.out.println("Enter your Name: ");
        Name=sc.next();
        System.out.println("Enter Roll No: ");
        RollNo=sc.next();

    }
    void Marks(){
        System.out.println("Enter Your JAVA Marks: ");
        JAVA=ensureMarks();
        System.out.println("Enter Your C++ Marks:");
        Cpp=ensureMarks();
        System.out.println("Enter Your Go Marks:");
        Go=ensureMarks();
        System.out.println("Enter Your Ruby Marks:");
        Ruby=ensureMarks();
        System.out.println("Enter Your C# Marks:");
        Csrp=ensureMarks();
        System.out.println("Enter Your Python Marks:");
        Python=ensureMarks();

    }

    int ensureMarks(){
        int x=0;
        while(true){
            x= sc.nextInt();
            if (x>=0&&x<=100){
                break;
            }
            System.out.println("Invalid Input!!! Enter a no between 0-100");
        }
        return x;
    }


    void displayMarks(){
        System.out.println("Java = "+JAVA+"/100"+result(JAVA));
        System.out.println("C++ = "+Cpp+"/100"+result(Cpp));
        System.out.println("Go = "+Go+"/100"+result(Go));
        System.out.println("Ruby = "+Ruby+"/100"+result(Ruby));
        System.out.println("C# = "+Csrp+"/100"+result(Csrp));
        System.out.println("Python = "+Python+"/100"+result(Python));
    }

    int total(){
        return JAVA+Cpp+Go+Ruby+Csrp+Python;
    }

    String result(int marks){
        if(marks>=40){
            return " P";
        }
        else{
            result="Fail";
            return " F";
        }
    }


    public static void main(String[] args) {
        Student obj=new Student();
        obj.Student_details();
        obj.Marks();
        System.out.println("Student Report Card");
        System.out.println("-------------------");
        System.out.println("Name: "+obj.Name);
        System.out.println("Roll Number: "+obj.RollNo);
        System.out.println();
        System.out.println("Marks:");
        obj.displayMarks();
        System.out.println();
        System.out.println("Total = "+obj.total()+"/600");
        System.out.println("Percentage = "+obj.total()*100/600+"%");
        System.out.println("Status: "+obj.result);
        System.out.println();

        //Grading System
        if(obj.total()>=480){
            System.out.println("Grade A");
        }
        else if(obj.total()>=360){
            System.out.println("Grade B");
        }
        else if (obj.total()>=240) {
            System.out.println("Grade C");
        }
        else if (obj.total()>=120) {
            System.out.println("Grade D");
        }

    }
}

Nishant-Varma-23 avatar Jul 22 '24 17:07 Nishant-Varma-23

package Suman;
import java.util.Scanner;
class Student{
    Scanner sc=new Scanner(System.in);
    String name,roll_number;
    int java,c,go,ruby,csharp,python;

    public void name(){
        System.out.println("Student Report Card System");
        System.out.println("...........................");
        System.out.println("Enter Your Name");
        name=sc.nextLine();
        System.out.println("Enter Your Roll Number");
        roll_number=sc.nextLine();
    }

    void sub_marks(){
        System.out.println("Enter Your Java Marks: ");
        java=sc.nextInt();
        System.out.println("Enter Your C++ Marks: ");
        c=sc.nextInt();
        System.out.println("Enter Your Go Marks: ");
        go=sc.nextInt();
        System.out.println("Enter Your Ruby Marks: ");
        ruby=sc.nextInt();
        System.out.println("Enter your C# Marks: ");
        csharp=sc.nextInt();
        System.out.println("Enter Your Python Marks: ");
        python=sc.nextInt();
    }
    
    void name_marks(){
        System.out.println("Student Report Card System ");
        System.out.println("...........................");
        System.out.println("Name: "+name);
        System.out.println("Roll Number: "+roll_number);
        System.out.println();
        System.out.println("Marks: ");
        if(java<=30){
            System.out.println("Java = "+java+"/100"+" F");
        }else{
            System.out.println("Java = "+java+"/100");
        }

        if(c<=30){
            System.out.println("C++ = "+c+"/100"+" F");
        }else{
            System.out.println("C++ = "+c+"/100");
        }

        if(go<=30){
            System.out.println("Go = "+go+"/100"+" F");
        }else{
            System.out.println("Go = "+go+"/100");
        }

        if(ruby<=30){
            System.out.println("Ruby = "+ruby+"/100"+" F");
        }else{
            System.out.println("Ruby = "+ruby+"/100");
        }

        if(csharp<=30){
            System.out.println("C# = "+csharp+"/100"+" F");
        }else{
            System.out.println("C# = "+csharp+"/100");
        }

        if(python<=30){
            System.out.println("Python = "+python+"/100"+" F");
        }else{
            System.out.println("Python = "+python+"/100");
        }
    }


    int total(){
        int total=java+c+go+ruby+csharp+python;
        return total;
    }

   float percentage(){
        float percentage=(float)(total()*100/600);
        return percentage;
   }

    void status(){
        if(java>30 && c>30 && go>30 && ruby>30 && csharp>30 && python>30){
            System.out.println("Status: Pass");
        }else{
            System.out.println("Status: Fail");
        }
    }
    
    void grade(){
        if(percentage()<=40 ){
            System.out.println("Grade D");
        } else if (percentage()<=60) {
            System.out.println("Grade C");
        } else if (percentage()<=80) {
            System.out.println("Grade B");
        }else if (percentage()<=100) {
            System.out.println("Grade A");
        }
    }

}

public class Report_Card {
    public static void main(String[] args) {
        Student ob=new Student();
        ob.name();
        ob.sub_marks();
        System.out.println();
        ob.name_marks();
        System.out.println();
        System.out.println("Total = "+(ob.total())+"/600");
        System.out.println("Percentage = "+(ob.percentage())+"%");
        ob.status();
        ob.grade();
    }
}


Suman11Gupta avatar Jul 23 '24 14:07 Suman11Gupta

package Assignment;
import java.util.Scanner;
public class Student {
	static String name, roll_num;
	static int java,cplus,go,ruby,chash,python;
	float total_marks , perc;
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		System.out.println("Enter your name:");
		
		 name=sc.next();
		System.out.println("Enter your Roll Number:");
		 roll_num=sc.next();
		System.out.println();
		System.out.println("Enter your JAVA Marks:");
		 java = sc.nextInt();
		System.out.println("Enter your C++ Marks:");
		 cplus = sc.nextInt();
		System.out.println("Enter your Go Marks:");
		 go = sc.nextInt();
		System.out.println("Enter your Ruby Marks:");
		 ruby = sc.nextInt();
		System.out.println("Enter your C# Marks:");
		  chash = sc.nextInt();
		System.out.println("Enter your Python Marks:");
		 python = sc.nextInt();
		System.out.println("Student Report Card");
		System.out.println("--------------------");  
		System.out.println("Name: "+name);
		System.out.println("Roll Number: "+roll_num);
		System.out.println();
		
		Student ob = new Student();
		ob.output();
		ob.total();
		ob.percentage(); 
		ob.pass_fail();
	}
		
	    void output()
	  
	    {
	    	System.out.println("Marks:");
	    	if(java < 30 )
			{
				System.out.println("java = "+java+"/100"+"F");
			}
			else
			{
				System.out.println("java = "+java+"/100");
			}
			if(cplus < 30)
			{
			System.out.println("C++ = "+cplus+"/100"+"F");
			}
			else
			{
			System.out.println("C++ = "+cplus+"/100");
			}
			if(go < 30) {
				System.out.println("Go = "+go+"/100"+"F");
			}
			else
			{
			System.out.println("Go = "+go+"/100");
			}
			if(ruby < 30)
			{
			System.out.println("Ruby = "+ruby+"/100"+"F");
			}
			else
			{
				System.out.println("Ruby = "+ruby+"/100");
			}
			if(chash < 30)
			{
			System.out.println("C# = "+chash+"/100"+"F");
			}
			else
			{
				System.out.println("C# = "+chash+"/100");

			}
			if(python < 30)
			{
			System.out.println("Python = "+python+"/100"+"F");
			}
			else
			{
				System.out.println("Python = "+python+"/100");

			}
	    }
    
	
	     
		void total()
		{
			total_marks= java+cplus+go+ruby+chash+python;
			System.out.println("Total = "+total_marks+"/"+"600");
		}
		void percentage()
        {
			perc=((total_marks/600)*100);
			System.out.println("Percentage = "+perc+"%");
		}
		void pass_fail()
        {
			if(java>29 && cplus>29 && go>29 && ruby>29 && chash>29 && python>29)
			{
			
				System.out.println("Status: PASS");
			}
			else
			{
				
				System.out.println("Status: FAIL");
			}
			
		}
		
	
		
	

}

JanhaviSatam avatar Jul 25 '24 10:07 JanhaviSatam

package June_22;
import java.util.Scanner;
public class Student {
        String name;
        int rollNo;
        int JAVA, CPlus, Go, Ruby, CSharp, Python;
        int total = 100;
        int min = 27;

        void details() {
            Scanner sc = new Scanner(System.in);
            System.out.print("Enter your name:");
            name = sc.nextLine();
            System.out.print("Enter Your Roll Number:");
            rollNo = sc.nextInt();
        }

        void marks() {
            Scanner sc = new Scanner(System.in);
            System.out.print("Enter Your JAVA Marks:");
            JAVA = sc.nextInt();
            while(JAVA<0 || JAVA>100){
                System.out.println("Marks must be between 0-100");
                System.out.println("Enter Your JAVA Marks:");
                JAVA=sc.nextInt();
            }
             System.out.print("Enter Your C++ Marks:");
             CPlus = sc.nextInt();
             while(CPlus<0 || CPlus>100){
                System.out.println("Marks must be between 0-100");
                System.out.println("Enter Your C++ Marks:");
                CPlus=sc.nextInt();
            }
             System.out.print("Enter Your Go Marks:");
             Go = sc.nextInt();
             while(Go<0 || Go>100){
                System.out.println("Marks must be between 0-100");
                System.out.println("Enter Your Go Marks:");
                Go=sc.nextInt();
            }
             System.out.print("Enter Your Ruby Marks:");
             Ruby = sc.nextInt();
             while(Ruby<0 || Ruby>100){
                System.out.println("Marks must be between 0-100");
                System.out.println("Enter Your Ruby Marks:");
                Ruby=sc.nextInt();
            }
             System.out.print("Enter Your C# Marks:");
             CSharp = sc.nextInt();
              while(CSharp<0 || CSharp>100){
                System.out.println("Marks must be between 0-100");
                System.out.println("Enter Your C# Marks:");
                CSharp=sc.nextInt();
            }
             System.out.print("Enter Your Python Marks:");
             Python = sc.nextInt();
              while(Python<0 || Python>100){
                System.out.println("Marks must be between 0-100");
                System.out.println("Enter Your Python Marks:");
                Python=sc.nextInt();
            }
        }


        void result() {
            System.out.println("Student Report Card\n" +
                    "-------------------");
            System.out.println("Name:" + name);
            System.out.println("Marks:");
            if (JAVA >= min) {
                System.out.println("JAVA=" + JAVA + "/" + total);
            } else {
                System.out.println("JAVA=" + JAVA + "/" + total + "F");
            }
            if (CPlus >= min) {
                System.out.println("C++=" + CPlus + "/" + total);
            } else {
                System.out.println("C++=" + CPlus + "/" + total + "F");
            }
            if (Go >= min) {
                System.out.println("Go=" + Go + "/" + total);
            } else {
                System.out.println("Go=" + Go + "/" + total + "F");
            }
            if (Ruby >= min) {
                System.out.println("Ruby=" + Ruby + "/" + total);
            } else {
                System.out.println("Ruby=" + Ruby + "/" + total + "F");
            }
            if (CSharp >= min) {
                System.out.println("C#=" + CSharp + "/" + total);
            } else {
                System.out.println("C#=" + CSharp + "/" + total + "F");
            }
            if (Python >= min) {
                System.out.println("Python=" + Python + "/" + total);
            } else {
                System.out.println("Python=" + Python + "/" + total + "F");
            }
        }
        void calc(){
            int sum=JAVA+ CPlus+Go+ Ruby + CSharp+ Python;
            System.out.println("Total="+sum+"/600");
            float percentage=(float)(sum*100/600);
            System.out.println("Percentage="+percentage+"%");
            if (min <= JAVA && min <= Python && min <= Go && min <= Ruby && min <= CPlus && min <= CSharp)
            {
                System.out.println("Pass");
                if(percentage>80 && percentage<100){
                    System.out.println("Grade A");
                } else if (percentage>60 && percentage<80) {
                    System.out.println("Grade B");
                } else if (percentage>40 && percentage<60) {
                    System.out.println("Grade C");
                } else if (percentage>30 && percentage<40) {
                    System.out.println("Grade D");
                }
            }
            else{
                System.out.println("Fail");
            }
        }
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            Student st = new Student();
            st.details();
            st.marks();
            st.result();
            st.calc();
        }
    }

Moumita0710 avatar Jul 26 '24 09:07 Moumita0710


import java.util.Scanner;

public class Student {
    Scanner sc=new Scanner(System.in);
    String name,roll_number;
    int java,c,go,ruby,csharp,python;
    
    public void name() {
    	System.out.println("Student report card system");
    	System.out.println("-----------------------------");
    	System.out.println("Enter your name:");
    	name=sc.nextLine();
    	System.out.println("Enter your roll number");
    	roll_number=sc.nextLine();
    }
    
    void sub_marks() {
    	System.out.println("Enter your java marks:");
    	java=sc.nextInt();
    	System.out.println("Enter your c marks:");
    	c=sc.nextInt();
    	System.out.println("Enter your go marks:");
    	go=sc.nextInt();
    	System.out.println("Enter your ruby marks:");
    	ruby=sc.nextInt();
    	System.out.println("Enter your csharp marks:");
    	csharp=sc.nextInt();
    	System.out.println("Enter your python marks:");
    	python=sc.nextInt();
    }
    
    void name_marks() {
    	System.out.println("Student report card system");
    	System.out.println("------------------------------");
    	System.out.println("Name:"+name);
    	System.out.println("Roll number:"+roll_number);
    	System.out.println();
    	System.out.println("Marks:");
    	
    	if(java<=30) {
    		System.out.println("Java="+java+"/100"+"F");
    	}else {
    		System.out.println("Java="+java+"/100");
    	}
    	if(c<=30) {
    		System.out.println("C="+c+"/100"+"F");
    	}else {
    		System.out.println("C="+c+"/100");
    	}
    	if(go<=30) {
    		System.out.println("Go="+go+"/100"+"F");
    	}else {
    		System.out.println("Go="+go+"/100");
    	}
    	if(ruby<=30) {
    		System.out.println("Ruby="+ruby+"/100"+"F");
    	}else {
    		System.out.println("Ruby="+ruby+"/100");
    	}
    	if(csharp<=30) {
    		System.out.println("CSharp="+csharp+"/100"+"F");
    	}else {
    		System.out.println("CSharp="+csharp+"/100");
    	}
    	if(python<=30) {
    		System.out.println("Python="+python+"/100"+"F");
    	}else {
    		System.out.println("Python="+python+"/100");
    	}
    	
    }
    
    int total() {
    	int total=java+c+go+ruby+csharp+python;
    	return total;
    }
    
    float percentage() {
    	float percentage=(float)(total()*100/600);
    	return percentage;
    }
    
    void status() {
    	if(java>30 && c>30 && go>30 && ruby>30 && python>30) {
    		System.out.println("Status:Successful");
    	}else {
    		System.out.println("Status:Failed");
    	}
    }
    
    void grade() {
    	if(percentage()<=40) {
    		System.out.println("Grade D");
    	}else if(percentage()<=60) {
    		System.out.println("Grade C");
    	}else if(percentage()<=80){
    		System.out.println("Grade B");
    	}else if(percentage()<=100) {
    		System.out.println("Grade A");
    	}
    }
    
}

public class Report_Card {

	public static void main(String[] args) {
		Student ob=new Student();
		ob.name();
		ob.sub_marks();
		System.out.println();
		ob.name_marks();
		System.out.println();
		System.out.println("Total="+(ob.total())+"/600");
		System.out.println("Percentage="+(ob.percentage())+"%");
		ob.status();
		ob.grade();

	}

}


omkaraair20 avatar Sep 16 '24 13:09 omkaraair20