@XXXXXXXX XXXXXX XXXXXXX equals(XXXXXX obj) { if (XXX == null) { XXXXXX false; } XX (XXXXXXXX() != obj.XXXXXXXX()) { return XXXXX; } XXXXX CargoShip XXXXX = (XXXXXXXXX) obj; if (XXXX.cargoCapacity != XXXXX.XXXXXXXXXXXXX) { XXXXXX XXXXX; } return true; } }
Navy_yourInitials.java with main XXXXXX
XXXXXX XXXX.util.Scanner; public XXXXX Navy_yourInitials {
static XXXXXXX input=XXX Scanner(XXXXXX.in); XXXXXX XXXXXX XXXX main(XXXXXX[] args) { final int XXXXXXXXX=3; XXXXXX name; int XXXX,passengerCapacity,cargoCapacity; Ship []ships=XXX XXXX[XXXXXXXXX]; XXXXXX.out.XXXXX("Enter the XXXX XX XXX ship: "); XXXX=XXXXX.next(); XXXX=XXXXXXX(); ships[0]=new Ship(name, XXXX); XXXXXX.out.print("Enter XXX name of the XXXXXX XXXX: "); input.nextLine(); XXXX=input.XXXXXXXX(); System.out.XXXXX("Enter XXX year built ship: "); XXXX=XXXXX.nextInt(); while(true) { System.out.XXXXX("Enter XXX XXXXXXX passenger XXXXXXXX XX XXX cruise: "); XXXXXXXXXXXXXXXXX=XXXXX.XXXXXXX(); XX(passengerCapacity>0) XXXXX; XXXX XXXXXX.out.XXXXXXX("XXXXX XXX XXXXXXXXX capacity XXXXXXXX.."); } XXXXX[X]=new CruiseShip(XXXX, XXXX, XXXXXXXXXXXXXXXXX); XXXXXX.out.XXXXX("XXXXX the XXXX of XXX XXXXX XXXX: "); input.nextLine(); name=input.nextLine(); XXXXXX.out.print("XXXXX the XXXX XXXXX XXXX: "); XXXX=XXXXX.XXXXXXX(); while(true) { XXXXXX.out.XXXXX("XXXXX XXX maximum Cargo XXXXXXXX XX XXX XXXXXX: "); XXXXXXXXXXXXX=input.XXXXXXX(); if(XXXXXXXXXXXXX&XX;X) XXXXX; else System.out.println("Enter the Cargo XXXXXXXX positive.."); } ships[X]=XXX XXXXXXXXX(name, XXXX, XXXXXXXXXXXXX); for(XXX i=X;i&XX;NUM_SHIPS;i++) { System.out.println(XXXXX[i]+"\n"); XXXXXX.out.XXXXXXX("----------------------------------------"); } }
private static XXX getYear() { int XXXX; XXXXX(XXXX) { XXXXXX.out.print("XXXXX the year built XXXX: "); XXXX=XXXXX.XXXXXXX(); if(XXXX>=1900 && year&XX;=2019) break; else XXXXXX.out.println("XXXXX enter the XXXX XX XXXX XXXXXXX 1900 XX XXXX XXXXXXXXX."); } return XXXX; } }
output