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
import java.util.Random;
public class Seat
{
private int row;
private int seat;
private boolean aisle;
private boolean window;
private boolean occupied;
private int cost;
private static int revenue = 0;
public Seat()
{
row = 0;
seat = 0;
aisle = false;
window = false;
occupied = false;
cost = 0;
}//end constructor
public Seat(int rowPassed, int seatPassed)
{
Random randNumGen = new Random();
row = rowPassed;
seat = seatPassed;
if(seatPassed == 1 || seatPassed == 2)
aisle = true;
else
aisle = false;
if(seatPassed == 0 || seatPassed == 3)
window = true;
else
window = false;
occupied = false;
cost = randNumGen.nextInt(301) + 200;
//revenue = revenue + cost;
}//end constructor
//getters
public int getRow()
{
return row;
}//end method getRow
public int getSeat()
{
return seat;
}//end method getSeat
public boolean getAisle()
{
return aisle;
}//end method getAisle
public boolean getWindow()
{
return window;
}//end method getWindow
public boolean getOccupied()
{
return occupied;
}//end method getOccupied
public int getCost()
{
return cost;
}//end method getCost
public static int getRevenue()
{
return revenue;
}//end method getRevenue
//////
//setters
public void setRow(int rowPassed)
{
row = rowPassed;
}//end method setRow
public void setSeat(int seatPassed)
{
seat = seatPassed;
}//end method setSeat
public void setAisle(boolean aislePassed)
{
aisle = aislePassed;
}//end method setAisle
public void setWindow(boolean windowPassed)
{
window = windowPassed;
}//end method setWindow
public void setOccupied(boolean occupiedPassed)//Revised to take care of gaming the system
{
if(occupiedPassed == true && occupied == false)//unoccupied becomes occupied
{
occupied = occupiedPassed;
revenue = revenue + cost;
}
else if (occupiedPassed == false && occupied == true) //occupied becomes unoccupied
{
occupied = occupiedPassed;
revenue = revenue – cost;
}
//no need to deal with occupied become occupied or
//unoccupied becomes unoccupied as no change in status
//of seat and renevue
}//end method setOccupied
public void setCost(int costPassed)
{
cost = costPassed;
}//end method setCost
public String toString()
{
return
“Row: ” + row + “\n” +
“Seat: ” + seat + “\n” +
“Aisle: ” + aisle + “\n” +
“Window: ” + window + “\n” +
“Occupied: ” + occupied + “\n” +
“Cost: $” + cost + “\n”;
}//end toString
}//end class
We provide professional writing services to help you score straight A’s by submitting custom written assignments that mirror your guidelines.
Get result-oriented writing and never worry about grades anymore. We follow the highest quality standards to make sure that you get perfect assignments.
Our writers have experience in dealing with papers of every educational level. You can surely rely on the expertise of our qualified professionals.
Your deadline is our threshold for success and we take it very seriously. We make sure you receive your papers before your predefined time.
Someone from our customer support team is always here to respond to your questions. So, hit us up if you have got any ambiguity or concern.
Sit back and relax while we help you out with writing your papers. We have an ultimate policy for keeping your personal and order-related details a secret.
We assure you that your document will be thoroughly checked for plagiarism and grammatical errors as we use highly authentic and licit sources.
Still reluctant about placing an order? Our 100% Moneyback Guarantee backs you up on rare occasions where you aren’t satisfied with the writing.
You don’t have to wait for an update for hours; you can track the progress of your order any time you want. We share the status after each step.
Although you can leverage our expertise for any writing task, we have a knack for creating flawless papers for the following document types.
Although you can leverage our expertise for any writing task, we have a knack for creating flawless papers for the following document types.
From brainstorming your paper's outline to perfecting its grammar, we perform every step carefully to make your paper worthy of A grade.
Hire your preferred writer anytime. Simply specify if you want your preferred expert to write your paper and we’ll make that happen.
Get an elaborate and authentic grammar check report with your work to have the grammar goodness sealed in your document.
You can purchase this feature if you want our writers to sum up your paper in the form of a concise and well-articulated summary.
You don’t have to worry about plagiarism anymore. Get a plagiarism report to certify the uniqueness of your work.
Join us for the best experience while seeking writing assistance in your college life. A good grade is all you need to boost up your academic excellence and we are all about it.
We create perfect papers according to the guidelines.
We seamlessly edit out errors from your papers.
We thoroughly read your final draft to identify errors.
Work with ultimate peace of mind because we ensure that your academic work is our responsibility and your grades are a top concern for us!
Dedication. Quality. Commitment. Punctuality
Here is what we have achieved so far. These numbers are evidence that we go the extra mile to make your college journey successful.
We have the most intuitive and minimalistic process so that you can easily place an order. Just follow a few steps to unlock success.
We understand your guidelines first before delivering any writing service. You can discuss your writing needs and we will have them evaluated by our dedicated team.
We write your papers in a standardized way. We complete your work in such a way that it turns out to be a perfect description of your guidelines.
We promise you excellent grades and academic excellence that you always longed for. Our writers stay in touch with you via email.