Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please i need quick help with this codind question ma SA 14 Q Question 2 Object Oriented Programming: Description: BYG City has few airline companies

please i need quick help with this codind question
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
ma SA 14 Q Question 2 Object Oriented Programming: Description: BYG City has few airline companies that provides flight services. The airport authority wants to automate its process. The design is given in the class diagram Write a Java program to implement the below class diagram 63 Class Diagram Passenger -passengerName: String passenger Agesint pasteemal String Passenger passengerame string passenger Age: Int. passengermat: Strings - validate PassengerDetails: boolean +tos String flicht counterint-static airline ClassArr:String statie aittineClassPriceArri intl -> stati airlineName Song -engine: String -Capacity: int passenger: Passenger tiketidi Sung -ticketPrice: double Fight airlineName Surine enginestre capacity. Int. passenger: Passenger geCapacity int get PassengertiPassenger getAirlineName(): String getEngine): String .getTicketid: String .getTicketPrice: double set Ticketid ticketid: String vold set TicketPrice ticketPrice: double vold checkEngine: boolean generate ideid vold calculate Price flightClass String destination: String void .toString(): Sering Charter Plane amenitier: Stringit -amerties Price Incl -> Matic uuryAmenities: Stringil Charter Plane (airlineName: String engineString capacitydint, passenger: Passenger, luxury Amenities: StringFight (airlineame engine, capacity passenger costofur Amenities int calculate Price (distance in void .tostringati Notes . Do not include any extra instance/static variables and instance/static methods in the given classes Case In-sensitive comparison is required to be done unless until specified explicitly . Do not change any value or case of the given variables Read notes and examples for better understanding of the logic o Note: 8P Do not include any extra instance/static variables and instance/static methods in the given classes Case In-sensitive comparison is required to be done unless until specified explicitly - Do not change any value or case of the given variables . Read notes and examples for better understanding of the logic Implementation Details: es Class Name Passenger Flight Charter Plane Implementation Details Fully Implemented Partially Implemented Partially Implemented Flight Class airlineClassArr: This is a statie array (string) which contains available airline ClassiString) The initial values of the airlineClassArr are given below: airlineClassArt ["firstclass", "businessclass","economyclass") Note: The array is supplied. Hence no need to code . Do not change the CASE of elements in the array airlineClass PriceArr: . This is a static array(int[which contains airline CletsPricelints for the corresponding airlineClass(String in airlineClass ClassArt The initial values of the airlineClass PriceArr are given below airlineClassPriceArr(7000, 15000, 4000) Note: The array is supplied. Hence no need to code generate Ticketido): This method auto-generates and sets the ticketid (String) The ticketid must be prefixed with first letter of airlineName in uppercase followed by auto-generated value starting from 1001 The auto-generated value should be incremented by 1 for the next ticketid DAS Feta Selection Vs Go Run Terminal Exam Help Qachon Solution 02:48 generate Ticked This method auto-generates and as the ticket Singh The ticketid must be prefined with first letter of wirlineName in uppercase followed by auto-generated value starting from 1001 The generated value should be incremented by for the ticket Use the static variable counter appropriately to implement auto-generatin lagi tuample in the listintame is Taninge her 18 int ticked oud enorcard tickold generated would LA TA1007 the airlineName no son calculate Prices, de . This method accepts no pameting and den String The method is and weathe ticketPrice data generale ticket based on below logic Invoks valida esanger Detalls method of Passengers the methods and check Engineer and capacity or 9.200 m Check fightclaw is present in reclamar and then is that are then . For the fighters obtain the consondig wave of the airlines PriceAr Note Performance company forest and center Apply ricoration Set there the damage theld by inking generate Tickedy mero Onde se ticePrice cald . Other settiketPrice and kid NA Notes for selve comparison why Examples of the riniame is Taming engine is "URORET, capacity=10 passengeraneh pengerage 22. passengerimail lejohnhalygmail.com primis business and demons ther videreude 17700 cuency and schedule F1001 uningded CharterPlane Claus amenities statka ingin contemente ring The initial values of the Amennessee below amenities WIFE Bed TV Note Tepedente no need to code Dange the CASE elements in the amenities Price NENORMAS File Edit Selection View Go Run Terminal Eram Help Refranco Question Solution Tusturva Charter Plane Class: amenitiesArr: o This is a static array (String containing available omenities String! The initial values of the amenitiesArr are given below amenitiesArt "WIFI", "Bed","TV" Note: The array is supplied. Hence no need to code Do not change the CASE of elements in the array amenities PriceArr: This is a static array in which contains amenities Priceint) for the corresponding amenities String) in amenitiesArt The initial values of the amenitiesPriceArr are given below: amenities PriceArT (700, 2000, 1500) Note: . This array is supplied. Hence no need to code costofluxury Amenities: This method calculates and returns amenitiesCarint) for luxuryAmenities If the luxury Amenities is null return the amenities Costas Otherwise . For every amenity present in luxury Amenities, check if the amenity is present as one of the elements in amenitiesArr i present identify the corresponding amenities Price for the amenity from the amenities PriceAr 0 Add all the above identified amenities Price to obtain the amenities Retum amenities Cost Note The luxury Amenities accepts value as null or array of amenities Perform ease-insensitive comparison Example if the luxury Amenities ist wifi"), then the above method would return amenities Cost as 700 currency calculate Price distance . This method accept one parameteras distance in OAS Add the above dere mensPrice to obtain the amenitost Note The luxuryAmenities accepts value sullor i of amenities Perfom se insensitive comparison trampler 11 the hasury Ameninle at will then the above method would mum amenities Cair an 700 currency calculatrica) Thethod centras) This methods and set the Price and gestand on below me validassarrenger Detalle method at Passenger cousif the seventh Ted checking and capacity where and materia requal to 100mhet Check it valued by costrymentes no yes then Obine by iming confirmed fitness the real to 700 adet of Tourney for everyone cancel added to Owe Toyota Fort ditance and cry for every nice to the rest of de Shtice that cand este atid by working generate Ticket Ontheticesindeksid . Ockstreet teketidas Note the potentie taample if the minimame u bates engine opet 30. opariterpengame pc pavergtigtestengerimanga.com and dance 2013 na di mencerit would be 17000 and ticket A1002 and the Power Taggar Solo Et Selection Vw Go Run Terminal Exam Help an Qeshon Chatranjava Fight package progusingjavapart2 2 3 Leport java.util.Arrays 7/Do NOT MOOY THE CODE PROVIDED TO YOU 7 Venty public class charterplane extends Fight private static stengt) amenitiesArried", TV): private static int ritiesPriceArr(200,2000, 1500); private String luxury menities: CharterPlane(string airlinelane, string engine, int capacity, Passer der passenger, string luxuryAmenities) superfairlinelane, engine, capacity.assenger) This luxurylenities-luxuryanenities: 9 10 11 12 11 14 15 16 12 18 19 20 21 22 22 Y/To Trainee public int costoforo intentiescost-1 Uplot your there return menitiescast: 25 26 27 2 20 30 7/To Trainees public void calculatepriecint distance) plument your logic here 2 3 14 35 - Poverride public string tostring) return Charteretane Carline this.getrilineame() . engine" this.getEngine + , capacity. this.getCapacity). passenger". this.getPassenger luxuryenities Arrays.tostring(luxuryenities) + "): NEONTMASMUMANIMCONGOS Flo Edit Selection View Go Run Terminal Exam Help Passenger sva Testava progusinsport2 Reference Question Charter Planjava Flight java package progusingjavaparta; 2 //00 NOT MOOIFY THE CODE PROVIDED TO YOU 4 6 7 Verify public class Flight private static int counter 1000; private static string[] airlineclassArr-firstclass", "businessclass","econcayclass"); private static int[] airlineclassPriceArr(7000, 1500, 400e; private String airlinettame; private String engine; private int capacity; private Passenger passenger; private string ticketid; private double ticketPrice; Flight(string airlinellame, string engine, int capacity, Passenger passenger) ( this.airlinelane airlinetiane, this.engine-engine; this.capacity capacity; this.passenger passenger this.ticketId null; this.ticketPrice=0.0; 9 10 11 12 13 24 15 16 12 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 28 39 40 public int getcapacity return this.capacity; wn5mm public string getAirlineName() { return airlineName; } public string getEngine() { return engine; ) public Passenger getPassenger return this.passenger; } public string getTicketid return this.ticket Id: public double getTicketPrice NEN Passengerjava Tester je proguting apart2 Solution File Est Selection View Go Run Terminal Exam Help Reference Question Charter Plane Flightjava x 37 public String getTicketido 38 return this.ticketid; 39 } 40 public double getTicketPriceo 41 return this.ticketPrice; 42 43 4.4 public void setTicketid string ticket14) this.ticket Id-ticketid; 48 public void setticketprice(double ticketprice) this.ticketPrice ticketPrice; aga swamns ungs 50 51 52 53 54 55 56 57 58 59 60 61 62 63 public boolean checkEngine if(this.engine.equalsignorecase("turboprop") this.engine.equalsignoreCase("turbojet")) return true; :) return false; } // To Trainees public void generateTicket //implement your logic hure // to Trainees public void calculatePrice(string flightclass, Strine destination) Vitplement your logic here 65 66 62 68 69 20 71 72 72 74 75 70 22 @Override public String tostring() { return "Flight (airlineame airlinellame . engine" .engine "capacity capacity, passenger" passenger + "); NEYMSMIMI F Edt Selection View Go Run Terminal Exam Help Rolerance doston CharPlaneja Fidjava 1 package progusing javaparta: Passengerjava Tistejava progusngvart Solution W/60 HOT MOIFY THE CODE PROVIDED TO YOU 6 2 public class Passenger private strine passengertian private int passenger cei private string passenger Email; Passenger (Strine passengerame, in passenger, strimit passengerEmail) this.passenger toepassengertiane; this.passenger gepassengerige: this.passenger all passengerEmail; 10 11 12 13 14 15 16 17 18 19 20 21 22 public boolean validatieassenger DeLa 15(this.passengertiane, length(2 88 this.passengerage RR this.passengerEmail.contains(">> return true return false; RENRANS 24 override public string to tento return Passenger (passenger and passengertiane, passenger * passenger", passengerfil passenger Email : 3 NENEYMSMMM F6 Lut Selection View Go Run Terminal Exam Heb Reference Chart Fight package progusinjavapart2; Puiger ave Testerjad Sell Test 3 public class Tester Run Debug public static void main(stringargs) Passenger passenger new Passenger John 22, oohollygall.com) Flight flightiene Hilamingos "LURBOJET, 150, passenger), flighti.calculate ace("businessclass"X> System.out.println("Ticket dis "flight.getTicketId); System.out.printre ticket price is "flight1 et ticketprice) System.out.println ) Passer passenger en passenger 27. jackantonymail.com) Strine) luxuryenities-wit Chacterplane charter planen tross Turboprop", 30.passengera, luxury Amenities); charterPlanet.caulice System.out.printing ticket Id charter Planel.getTick()); System.out.printineaticket pric charter Planel.geride Price) 10 11 10 15 16 12 NENMAMMANIME

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions