Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class CourseFee {
- public int n;
- public double total, ssc, hsc, fee;
- Scanner input = new Scanner(System.in);
- public void calculate(double fee, double hsc, double ssc)
- {
- this.hsc=ssc;
- this.ssc=hsc;
- this.fee=fee;
- if(hsc<=4.79 && ssc==5)
- {
- total = fee;
- }
- else if(hsc==5 && ssc==5)
- {
- System.out.println("Press 1: Golden GPA 5\nPress 2: General GPA 5");
- n=input.nextInt();
- if(n==1)
- {
- total = fee;
- fee -= total;
- }
- else
- {
- total = fee * 0.5;
- fee -= total;
- }
- }
- else if(hsc==5)
- {
- System.out.println("Press 1: Golden GPA 5\nPress 2: General GPA 5");
- n=input.nextInt();
- if(n==1)
- {
- total = fee * 0.75;
- fee -= total;
- }
- else
- {
- total = fee * 0.3;
- fee -= total;
- }
- }
- else if(hsc>=4.90 && hsc<=4.99)
- {
- total = fee * 0.2;
- fee -= total;
- }
- else if(hsc>=4.80 && hsc<=4.89)
- {
- total = fee * 0.1;
- fee -= total;
- }
- System.out.println("Course Fee Based On Result: " + fee);
- }
- public static void main(String[] args) {
- CourseFee c=new CourseFee();
- Scanner input = new Scanner(System.in);
- System.out.println("Your HSC GPA: ");
- c.hsc=input.nextDouble();
- System.out.println("Your SSC GPA: ");
- c.ssc=input.nextDouble();
- System.out.println("Total Semester Course Fee: ");
- c.fee=input.nextDouble();
- c.calculate(c.fee, c.ssc, c.hsc);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment