Advertisement
saimanova

OOP

Aug 13th, 2020
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. package javaapplication116;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Fees{
  6. public int m;
  7. public double total, s, h, f;
  8. Scanner input=new Scanner(System.in);
  9.  
  10.  
  11.  
  12. public void calculate(double fee, double hsc, double ssc)
  13. {
  14.  
  15.  
  16. this.f=f;
  17. this.h=h;
  18. this.s=s;
  19. if(h<=4.79) System.out.println("Course Fee: "+f);
  20. else if(h==5 && s==5)
  21. {
  22. System.out.println("1 for Golden GPA 5 in HSC \n 2 for General GPA 5 in HSC");
  23. m=input.nextInt();
  24. if(m==1)
  25. {
  26. total=f;
  27. f-=total;
  28. }
  29. else
  30. {
  31. total=f*0.5;
  32. f-=total;
  33. }
  34. System.out.println("Course Fee: "+f);
  35. }
  36. else if(h==5)
  37. {
  38. System.out.println(" 1 for Golden GPA 5 in HSC \n 2 for General GPA 5 in HSC");
  39. m=input.nextInt();
  40. if(m==1)
  41. {
  42. total=f*0.75;
  43. f-=total;
  44. }
  45. else
  46. {
  47. total=f*0.3;
  48. f-=total;
  49. }
  50. System.out.println("Course Fee: "+f);
  51. }
  52. else if(hsc>=4.90 && hsc<=4.99)
  53. {
  54. total=f*0.2;
  55. f-=total;
  56. System.out.println("Course Fee: "+f);
  57. }
  58. else if(hsc>=4.80 && hsc<=4.89)
  59. {
  60. total=f*0.1;
  61. f-=total;
  62. System.out.println("Course Fee: "+f);
  63. }
  64. }
  65. public static void main(String[]args)
  66. {
  67. Fees c = new Fees();
  68.  
  69. Scanner input = new Scanner(System.in);
  70.  
  71. System.out.print("\n GPA of SSC: ");
  72. c.s=input.nextDouble();
  73. System.out.print("\n GPA of HSC: ");
  74. c.h=input.nextDouble();
  75. System.out.print("\nSemester Fee: ");
  76. c.f=input.nextDouble();
  77. c.calculate(c.f,c.h,c.s);
  78. }
  79. }
  80.  
  81.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement