Advertisement
_MuradPro_

ExelentStudent

Apr 6th, 2020
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.16 KB | None | 0 0
  1. public class ExelentStudent {
  2. String name;
  3. double average;
  4. boolean principalLove;
  5.  
  6. public ExelentStudent(String name, double average, boolean principalLove) {
  7.     this.name = name;
  8.     this.average = average;
  9.     this.principalLove = principalLove;
  10. }
  11.  
  12. public void famelyDonateAlot() {
  13.     if(average*1.1 <= 100)
  14.         average *= 1.1;
  15.     else
  16.         average = 100;
  17. }
  18.  
  19. public int compare(ExelentStudent other) {
  20.     if((this.principalLove == true && other.isPrincipalLove() == true) || (this.principalLove == false && other.isPrincipalLove() == false)) {
  21.         if(this.average == other.getAverage())
  22.             return 0;
  23.         else if(this.average > other.getAverage())
  24.             return 1;
  25.         else
  26.             return -1;
  27.     }
  28.     if(this.principalLove == true && other.isPrincipalLove() == false)
  29.         return 1;
  30.     return -1;
  31. }
  32.  
  33. public String getName() {
  34.     return name;
  35. }
  36.  
  37. public void setName(String name) {
  38.     this.name = name;
  39. }
  40.  
  41. public double getAverage() {
  42.     return average;
  43. }
  44.  
  45. public void setAverage(double average) {
  46.     this.average = average;
  47. }
  48.  
  49. public boolean isPrincipalLove() {
  50.     return principalLove;
  51. }
  52.  
  53. public void setPrincipalLove(boolean principalLove) {
  54.     this.principalLove = principalLove;
  55. }
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement