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