THREE SUBJ MARKS & PERCENTAGES USING PRIVATE PART-2

NOTE: YOU HAVE TO CREATE ANOTHER NEW CLASS WITH ANY NAME

PART -2: WE WILL USE SET COMMAND.

IN PART 2 OUTPUT DISPLAY NOT IN PART 1 OF THREE SUBJ MARKS & PERCENTAGES USING PRIVATE PART-1


import java.io.*;

import java.util.Scanner;

public class List {


public static void main(String[] args) {

// TODO Auto-generated method stub

Scanner sc = new Scanner(System.in);

Subject it = new Subject();

System.out.println("Entre your name");

String name = sc.next();

it.setName(name);

System.out.println("Maths marks");

double math = sc.nextDouble();

it.setMath(math);

System.out.println("Physics marks");

double physics = sc.nextDouble();

it.setPhysics(physics);

System.out.println("Chemistry marks");

double chemistry = sc.nextDouble();

it.setCheminstry(chemistry);

double total = math +physics+chemistry;

double per=total/300*100;

if(per>=90) {

System.out.println("Excellent");

}

else if(per>=80 && per<=90){

System.out.println("A+");

}

else if(per>=70 && per<=80){

System.out.println("A");

}

else if(per>=60 && per<=70){

System.out.println("B+");

}

else if(per>=50 && per<=60){

System.out.println("B+");

}

else {

System.out.println("C");

}

     it.display();


}


}


Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.