You work for an airline, a small airline, so small you have only one plane.  Your plane has 5 rows with 4 seats in each row, 2 seats are on each side of the plane with an aisle down the middle.
I have developed the class Seat.java, which represents a seat on the plane.  Please review Seat.java  and understand it before you start this assignment. You are to use Seat.java in this assignment. You are not to change Seat.java.

1 import java.util.Random;

 2

 3 public class Seat

 4 {

 5 private int row;

 6 private int seat;

 7 private boolean aisle;

 8 private boolean window;

 9 private boolean occupied;

 10 private int cost;

 11 private static int revenue = 0;

 12

 13 public Seat()

 14 {

 15 row = 0;

 16 seat = 0;

 17 aisle = false;

 18 window = false;

 19 occupied = false;

 20 cost = 0;

 21 }//end constructor

 22

 23 public Seat(int rowPassed, int seatPassed)

 24 {

 25 Random randNumGen = new Random();

 26 row = rowPassed;

 27 seat = seatPassed;

 28 if(seatPassed == 1 || seatPassed == 2)

 29   aisle = true;

 30   else

 31   aisle = false;

 32 if(seatPassed == 0 || seatPassed == 3)

 33   window = true;

 34   else

 35   window = false;

 36 occupied = false;

 37 cost = randNumGen.nextInt(301) + 200;

 38 //revenue = revenue + cost;

 39 }//end constructor

 40

 41 //getters

 42 public int getRow()

 43 {

 44 return row;

 45 }//end method getRow

 46

 47 public int getSeat()

 48 {

 49 return seat;

 50 }//end method getSeat

 51

 52 public boolean getAisle()

 53 {

 54 return aisle;

 55 }//end method getAisle

 56

 57 public boolean getWindow()

 58 {

 59 return window;

 60 }//end method getWindow

 61

 62 public boolean getOccupied()

 63 {

 64 return occupied;

 65 }//end method getOccupied

 66

 67 public int getCost()

 68 {

 69 return cost;

 70 }//end method getCost

 71

 72 public static int getRevenue()

 73 {

 74 return revenue;

 75 }//end method getRevenue

 76

 77 //////

 78 //setters

 79 public void setRow(int rowPassed)

 80 {

 81 row = rowPassed;

 82 }//end method setRow

 83

 84 public void setSeat(int seatPassed)

 85 {

 86 seat = seatPassed;

 87 }//end method setSeat

 88

 89 public void setAisle(boolean aislePassed)

 90 {

 91 aisle = aislePassed;

 92 }//end method setAisle

 93

 94 public void setWindow(boolean windowPassed)

 95 {

 96 window = windowPassed;

 97 }//end method setWindow

 98

 99 public void setOccupied(boolean occupiedPassed)//Revised to take care of gaming the system

100 {

101   if(occupiedPassed == true && occupied == false)//unoccupied becomes occupied

102   {

103  occupied = occupiedPassed;

104  revenue = revenue + cost;

105   }

106   else if (occupiedPassed == false && occupied == true) //occupied becomes unoccupied

107  {

108  occupied = occupiedPassed;

109  revenue = revenue – cost;

110  }

111   //no need to deal with occupied become occupied or

112   //unoccupied becomes unoccupied as no change in status

113   //of seat and renevue

114 }//end method setOccupied

115

116 public void setCost(int costPassed)

117 {

118 cost = costPassed;

119 }//end method setCost

120

121 public String toString()

122 {

123 return

124 “Row: ” + row + “n” +

125 “Seat: ” + seat + “n” +

126 “Aisle: ” + aisle + “n” +

127 “Window: ” + window + “n” +

128 “Occupied: ” + occupied + “n” +

129 “Cost: $” + cost + “n”;

130 }//end toString

131

132 }//end class

Do you need a custom written or plagiarism free solution?

Click Here to Order Now