public boolean changeShip() { boolean b = false; try { view.displayPrintMessages("shipaccess"); String sn = view.getInput(); Ship ship = new Ship(); for (Ship s : sql.getAllShips()) { if (s.getShipName().equals(sn)) { ship = s; } } view.displayPrintMessages("entershipname"); String shipName = view.getInput(); view.displayPrintMessages("entershipclass"); String shipClass = view.getInput(); view.displayPrintMessages("enterguncaliber"); int shipGunCaliber = Integer.parseInt(view.getInput()); view.displayPrintMessages("enternguns"); int shipnguns = Integer.parseInt(view.getInput()); view.displayPrintMessages("entershiplength"); int shiplength = Integer.parseInt(view.getInput()); shipHandler.changeShip(ship, shipName, shipClass, shipGunCaliber, shiplength, shipnguns); b = true; } catch (Exception e) { } return b; }
public boolean deleteShip() { boolean b = false; try { view.displayPrintMessages("shipaccess"); String sn = view.getInput(); Ship ship = new Ship(); for (Ship s : sql.getAllShips()) { if (s.getShipName().equals(sn)) { ship = s; } else { view.displayPrintMessages("nosuchship"); } } shipHandler.deleteShip(ship); b = true; } catch (Exception e) { } return b; }