Advertisement
Naimul_X

Untitled

Aug 23rd, 2020
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. **********************************3************************************
  2.  
  3.  
  4. package mid_ooplab;
  5.  
  6.  
  7. abstract public class Employee {
  8. String name;
  9. double salary;
  10.  
  11. public Employee(String name, double salary) {
  12. this.name = name;
  13. this.salary = salary;
  14. }
  15.  
  16.  
  17. abstract void printSalary();
  18.  
  19. }
  20.  
  21. ***************************************************
  22.  
  23.  
  24. package mid_ooplab;
  25.  
  26.  
  27. public class PlatinumEmployee extends Employee {
  28.  
  29. PlatinumEmployee(String name,double salary)
  30. {
  31. super(name,salary);
  32. }
  33.  
  34. @Override
  35. void printSalary(){
  36. System.out.println("Name: "+name);
  37.  
  38. double x=0.0;
  39. x = this.salary*15/100;
  40.  
  41. System.out.println("After Bonus 15% : "+(this.salary+x));
  42. }
  43.  
  44.  
  45. }
  46. ***********************************************************
  47.  
  48.  
  49. package mid_ooplab;
  50.  
  51.  
  52. public class SilverEmployee extends Employee {
  53.  
  54. SilverEmployee(String name,double salary)
  55. {
  56. super(name,salary);
  57. }
  58.  
  59.  
  60. @Override
  61. void printSalary(){
  62. System.out.println("Name: "+name);
  63.  
  64. double n=0;
  65. n = this.salary*7/100;
  66.  
  67. System.out.println("After Bonus 7% : "+(this.salary+n));
  68. }
  69.  
  70.  
  71.  
  72.  
  73. }
  74.  
  75. **************************************************
  76.  
  77.  
  78. package mid_ooplab;
  79.  
  80. import java.util.Scanner;
  81.  
  82.  
  83. public class Test {
  84. public static void main(String[] args) {
  85. Scanner input =new Scanner(System.in);
  86. int [][] a=new int[3][4];
  87. int i,j,sum=0;
  88. for(i=0;i<a.length;i++)
  89. {
  90. for(j=0;j<a[i].length;j++)
  91. {
  92. a[i][j]=input.nextInt();
  93. }
  94. System.out.println();
  95. }
  96.  
  97. for(i=0;i<3;i++)
  98. {
  99. for(j=0;j<4;j++)
  100. {
  101. sum=sum+a[i][j];
  102.  
  103. }
  104.  
  105. //System.out.print(sum+",");
  106. if(i==2)
  107. {
  108. System.out.println(sum);
  109. }
  110. else{
  111. System.out.print(sum+",");
  112. }
  113. sum=0;
  114. }
  115.  
  116.  
  117.  
  118. }
  119. }
  120.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement