Advance Java Program

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.javaPreview the document, which represents a seat on the plane. Please review Seat.javaPreview the document and understand it before you start this assignment. You are to use Seat.javaPreview the document in this assignment. You are not to change Seat.javaPreview the document.

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

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our Guarantees

Money-back Guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism Guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision Policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy Policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation Guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
error: