Advertisement
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.fee=fee;
- this.hsc=hsc;
- this.ssc=ssc;
- if(hsc<=4.79) System.out.println("Course Fee: "+fee);
- else if(hsc==5 && ssc==5)
- {
- System.out.println("Press 1: Golden GPA 5 in HSC\nPress 2: General GPA 5 in HSC");
- n=input.nextInt();
- if(n==1)
- {
- total=fee;
- fee-=total;
- }
- else
- {
- total=fee*0.5;
- fee-=total;
- }
- System.out.println("Course Fee: "+fee);
- }
- else if(hsc==5)
- {
- System.out.println("Press 1: Golden GPA 5 in HSC\nPress 2: General GPA 5 in HSC");
- n=input.nextInt();
- if(n==1)
- {
- total=fee*0.75;
- fee-=total;
- }
- else
- {
- total=fee*0.3;
- fee-=total;
- }
- System.out.println("Course Fee: "+fee);
- }
- else if(hsc>=4.90 && hsc<=4.99)
- {
- total=fee*0.2;
- fee-=total;
- System.out.println("Course Fee: "+fee);
- }
- else if(hsc>=4.80 && hsc<=4.89)
- {
- total=fee*0.1;
- fee-=total;
- System.out.println("Course Fee: "+fee);
- }
- }
- public static void main(String[]args)
- {
- CourseFee c = new CourseFee();
- Scanner input = new Scanner(System.in);
- System.out.print("Your SSC GPA: ");
- c.ssc=input.nextDouble();
- System.out.print("\nYour HSC GPA: ");
- c.hsc=input.nextDouble();
- System.out.print("\nTotal Semester Course Fee: ");
- c.fee=input.nextDouble();
- c.calculate(c.fee,c.hsc,c.ssc);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement