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 public class Seat
3 private int row;
4 private int seat;
5 private boolean aisle;
7 private boolean occupied;
8 private int cost;
9 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

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)

Benefits of our college essay writing service

  • 80+ disciplines

    Buy an essay in any subject you find difficult—we’ll have a specialist in it ready

  • 4-hour deadlines

    Ask for help with your most urgent short tasks—we can complete them in 4 hours!

  • Free revision

    Get your paper revised for free if it doesn’t meet your instructions.

  • 24/7 support

    Contact us anytime if you need help with your essay

  • Custom formatting

    APA, MLA, Chicago—we can use any formatting style you need.

  • Plagiarism check

    Get a paper that’s fully original and checked for plagiarism

What the numbers say?

  • 527
    writers active
  • 9.5 out of 10
    current average quality score
  • 98.40%
    of orders delivered on time
error: