Description
One Problem Set Java, attached
Unformatted Attachment Preview
Program Class Structure
XWingFighter
Marker
Slide 5
Slide 5
T65
T70
T85
Slide 9
Slide 9
Slide 9
XEngine
XSensor
XWeapon
Slide 7
Slide 7
Slide 8
Location
Slide 6
Marker
XWingFactory
Slide 12
XModel
XStatus
Slide 7
Slide 8
XWingStorage
Fighters
Slide 13
2
Program Structure
Organize your program exactly as shown
Create your main method exactly as shown
X-Wing
T65B
Model
Length
T70
Width
Height
Mass
T85
Engine/
Maximum Speed m/s
Sensors
Laser Cannons
(Primary/Tertiary)
Torpedo Launcher
(Secondary)
T65B
13.4 m
11.6 m
2.4 m
13.4 iso tons
Cryogenic Power Generator
Max Speed = 26.2 m/s
Tracking
ANs5D
KX9 Laser Cannons
None
MG7 Proton Torpedo
Launcher
T70
12.49 m
11.6 m
1.92 m
12.49 iso tons
Fusial Thrust Engine 5L5
Max Speed = 29.2 m/s
Tracking
ANq5v8
KX12 Laser Cannons
AX190 Heavy Laser Cannon
MG7A Proton Torpedo
Launcher
T85
15.68 m
13.65 m
2.7 m
15.68 iso tons
Fusial Thrust Engine 5L9
Max Speed = 30.1 m/s
Tracking
ANr1v3
KX14 Laser Cannon
None
MG7A Proton Torpedo
Launcher
4
XWingFighter Class
XWingFighter
+static final long serialVersionUID = 1L
-fighterID: String
-fighterModel: XModel
-fLength: double
-fWidth: double
-fHeight: double
-fMass: double
-fMaxSpeed: double
-fSensors: XSensor
-fEngines: XEngine
-fPrimaryWpns: XWeapon
-fSecondaryWpns: XWeapon
(Marker Interface)
+abstract displayFighterSpecs(): void
+abstract costToBuild(): double
class XCompare (see slide 6)
XWingFighter(FighterID: String)
displayFighterSpecs output format
may be any format you like
+displayFighterSpecs(): void
+costToBuild(): double
T65
T70
T85
See Slide
See Slide
See Slide
XCompare Class
XCompare
+compare(XWingFighter F1,XWingFighter F2): int
Location Class
Location
-static final long serialVersionUID = 1L
-X: int
-Y: int
XCompare is part of the XWingFighter class
(Marker Interface)
Enumerations
XEngine
CPG04Z(“Novaldex”,”Cryogenic Power Generator”,3700,8000)
FTE5L5(“Incom-FreiTek”,”Fusial Thrust Engine”,3800,8750)
FTE5L9(“Incom-FreiTek”,”Fusial Thrust Engine”,3925,9050)
-manufacturer: String
-engineType: String
-powerOutput: int
-int engineCost: int
XModel
T65B(“Starfighter”,”Incom”,”Rebel Alliance”,150000,”YR-1″)
T70(“Starfighter”,”Incom-FreiTek”,”Rebel Alliance”,200000,”YR-5″)
T85(“Starfighter”,”Incom-FreiTek”,”Rebel Alliance”,220000,”YR-25″)
-role: String
-manufacturer: String
-nationality: String
-modelCost: int
-yearInService: String
-XModel(role: String, manufacturer: String, String nationality: String,
modelCost: int, yearInService: String)
-XEngine(manufacturer: String, engineType: String, powerOutput:
int, engineCost: int)
XSensor
ANs5D(“Fabritech”,”Tracking”,30,1200)
ANq5v8(“Fabritech”,”Tracking”,42,1850)
ANr1v3(“Fabritech”,”Tracking”,51,1975)
-manufacturer: String
-sensorType: String
-sensorRange: int
-sensorCost: int
-XSensor(-manufacturer: String, sensorType: String, sensorRange:
int, sensorCost: int)
7
Enumerations
XWeapon
KX9(“KX9 Laser Cannon”,4,”Taim&Bak”,18,900)
KX12(“KX12 Laser Cannon”,4,”Taim&Bak”,21,990)
KX14(“KX14 Laser Cannon”,4,”Taim&Bak”,23,1250)
MG7(“MG7 Proton Torpedo Launcher”,1,”Krupx”,7,1100)
MG7A(“MG7A Proton Torpedo Launcher”,1,”Krupx”,10,1400)
AX190(“AX190 Heavy Laser Cannon”,1,”Blas Tech”,15,2700)
-weaponType: String
-numberOfWeapons: int
-manufacturer: String
-maximumRange: int
-weaponCost: int
-XWeapon(-weaponType: String, numberOfWeapons: int, manufacturer: String,
maximumRange: int, weaponCost: int)
XStatus
Operational, Damaged, Destroyed
XWingFighter Subclasses
T65
T70
+static final long serialVersionUID = 1L
-pos: Location
+static final long serialVersionUID = 1L
-pos: Location
-fTertiaryWpns: XWeapon
T65(fighterID: String)
+displayT65Location: void
+displayFighterSpecs(): void
+costToBuild(): double
T85
+static final long serialVersionUID = 1L
-pos: Location
T85(fighterID: String)
+displayT85Location: void
+displayFighterSpecs(): void
+costToBuild(): double
T70(fighterID: String)
+displayT70Location: void
+displayFighterSpecs(): void
+costToBuild(): double
displayFighterSpecs output format
XWingFighter Methods
Class
Method
Input
Processing
Output
XWingFighter
displayFighterSpecs
None
prints to the console the attributes of the XWingFighter object Console
as shown
XWingFighter
costToBuild
None
returns the cost to build the XWingFighter object using the
formula: FighterModel Cost x 0.85 + Engine Cost + Sensor Cost
double
+ Primary Weapons Cost + Secondary Weapon Cost + Tertiary Weapon Cost
T65
displayT65Location
None
prints to the console the location of the T65 object as shown
T65
displayFighterSpecs
None
prints to the console the attributes of the T65 object as shown Console
T65
costToBuild
None
same as XWingFighter method
double
T70
displayT70Location
None
prints to the console the location of the T65 object as shown
Console
T70
displayFighterSpecs
None
prints to the console the attributes of the T70 object as shown Console
T70
costToBuild
None
same as XWingFighter method
double
T85
displayT85Location
None
prints to the console the location of the T85 object as shown
Console
T85
displayFighterSpecs
None
prints to the console the attributes of the T85 object as shown Concole
T85
costToBuild
None
same as XWingFighter method
Console
double
XWingFactory Class
XWingFactory
-name: String
-factoryLoc: Location
-XWingWarehouse: ArrayDeque
-buildCapacity: int
XWingFactory(name: String, factoryLoc: Location, buildCapacity: int)
+buildFighters(T65 int, T70 int, T85 int):boolean
XWingFactory Method Specification Chart
Method
Input
Processing
Output
buildFighters
T65: Number of T65 objects to build
T70: Number of T70 objects to build
T85: Number of T85 objects to build
Creates the specified numbers of the specified XWingFighter objects and
stores them in the XWingWarehouse of this object.
returns true if this operation is successful and false otherwise.
Formatted output if
successful and
“Fighter Build Failed”
if unsuccessful.
11
XWingStorage Class
XWingStorage
-name: String
-storageLoc: Location
-holdingPlatform: ArrayDeque
+static final String DIR = [FACTORY package relative file path]
XWingStorage(name: String, storageLoc: Location)
+storeFighters(ArrayDeque wh): boolean
+retrieveFighters( ): boolean
XWingFactory Method Specification Chart
Method
storeFighters
Input
ArrayDeque wh
Processing
Writes all the objects in wh to the Fighters file
returns true.
Output
None
This method must utilize an Iterator
retrieveFighters
None
Deserializes all XWingFighter objects from the Fighter file and adds them to the
holdingPlatform of this object.
returns true if successful and false otherwise
None
12
Expected Output
Fighters file
13
Purchase answer to see full
attachment