public boolean addNewShip() { boolean check = false; try { view.displayPrintMessages("entercaptainid"); String memID = view.getInput(); Member mem = new Member(); for (Member m : sql.getAllMembers()) { if (m.getMemberID().equals(memID)) { mem = m; } else { view.displayPrintMessages("nocushcaptain"); } } 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.addShip(mem, shipName, shipClass, shipGunCaliber, shipnguns, shiplength); check = true; } catch (Exception e) { } return check; }
public boolean deleteCaptain() { boolean b = false; try { view.displayPrintMessages("entercaptainid"); String memID = view.getInput(); Member mem = new Member(); for (Member m : sql.getAllMembers()) { if (m.getMemberID().equals(memID)) { mem = m; } else { view.displayPrintMessages("nocushcaptain"); return deleteCaptain(); } } memHandler.deleteMember(mem); b = true; } catch (Exception e) { } return b; }
public boolean changeCaptain() { boolean b = false; try { view.displayPrintMessages("entercaptainid"); String memID = view.getInput(); Member mem = new Member(); for (Member m : sql.getAllMembers()) { if (m.getMemberID().equals(memID)) { mem = m; } else { view.displayPrintMessages("nosuchcaptain"); } } view.displayPrintMessages("enternewfirstname"); String n1 = view.getInput(); view.displayPrintMessages("enternewlastname"); String n2 = view.getInput(); memHandler.changeMember(mem, n1, n2); b = true; } catch (Exception e) { } return b; }