EssayGhost Assignment代写,Essay代写,网课代修,Quiz代考

EssayGhost-Essay代写,作业代写,网课代修代上,cs代写代考

一站式网课代修,论文代写

高质量的Assignment代写、Paper代写、Report代写服务

EG1hao
网课代修代上,cs代写代考
Java代写
您的位置: 主页 > 编程案例 > Java代写 >
代写Java: array代写 AACS2204 OBJECT-ORIENTED PROGRAMMING - Java代写,
发布时间:2021-07-25 20:44:57浏览次数:
if (fName == null || fName.isEmpty()) {System.out.println("First name must not be empty!");return;System.out.print("Please input the last name: ");lName = scan.nextLine();if (lName == null || lName.isEmpty()) {System.out.println("Last name must not be empty!");return;System.out.print("Please input the iC: ");iC = scan.nextLine();System.out.print("Please input the phone number: ");phoneNo = scan.nextLine();System.out.print("Please input the street address: ");streetAddress = scan.nextLine();while (true) {System.out.print("Please input the postcode: ");try {postcode = Integer.parseInt(scan.nextLine());} catch (Exception e) {System.out.println("Postcode must be a number!");continue;break;System.out.print("Please inout the city: ");city = scan.nextLine();System.out.print("Please input the state: ");state = scan.nextLine();System.out.print("Please input the country: ");country = scan.nextLine();Address address = new Address(streetAddress, postcode, city, state, country);Member member = new Member(new Name(fName, lName), iC, phoneNo, address);addMember(member);* search member by member id or member name* @param scan scanner for command line toolpublic void search(Scanner scan) {System.out.print("Search by (1. member ID 2. member name): ");int option = 0;try {option = Integer.parseInt(scan.nextLine());} catch (Exception e) {System.out.println("Must input a number!");return;if (option = 0 || option 2) {System.out.println("The number of option must be 1 or 2!");return;if (option == 1) {System.out.print("Please input the member ID: ");String memberID = scan.nextLine();Member member = search(memberID);if (member == null) {System.out.println("This member not found.");return;} else {System.out.print(member);} else {String fName = "";String lName = "";System.out.print("Please input the first name: ");fName = scan.nextLine();System.out.print("Please input the last name: ");lName = scan.nextLine();Member member = search(fName, lName);if (member == null) {System.out.println("This member not found.");return;} else {System.out.print(member);* change information for a selected member* @param scan scanner for command line toolpublic void changeInformation(Scanner scan) {System.out.print("Please input the member ID: ");String memberID = scan.nextLine();Member member = search(memberID);if (member == null) {System.out.println("This member not found.");return;} else {boolean quit = false;while (true) {System.out.print("Please select a field to modify (1.first name "+ "2.last name 3.ic number 4.phone number 5.street address "+ "6.postcode 7.city 8.state 9.country 10.quit) ");String optionStr = scan.nextLine();int option = 0;try {option = Integer.parseInt(optionStr);} catch (Exception e) {System.out.println("Must input a number!");continue;if (option = 0 || option 10) {System.out.println("The number of option must be between 1 and 10!");continue;switch (option) {case 1:System.out.print("Please input the updated first name: ");String fName = scan.nextLine();if (fName == null || fName.isEmpty()) {System.out.println("First name must not be empty!");continue;member.setName(new Name(fName, member.getName().getlName()));System.out.println("Update successfully.");break;case 2:System.out.print("Please input the updated last name: ");String lName = scan.nextLine();if (lName == null || lName.isEmpty()) {System.out.println("Last name must not be empty!");continue;member.setName(new Name(member.getName().getfName(), lName));System.out.println("Update successfully.");break;case 3:System.out.print("Please input the updated iC: ");String iC = scan.nextLine();if (iC == null || iC.isEmpty()) {System.out.println("IC number must not be empty!");continue;member.setIC(iC);System.out.println("Update successfully.");break;case 4:System.out.print("Please input the updated phone number: ");String phoneNo = scan.nextLine();member.setPhoneNo(phoneNo);System.out.println("Update successfully.");break;case 5:System.out.print("Please input the updated street address: ");String streetAddress = scan.nextLine();member.getaddress().setStreetAddress(streetAddress);System.out.println("Update successfully.");break;case 6:int postcode;System.out.print("Please input the updated postcode: ");try {postcode = Integer.parseInt(scan.nextLine());} catch (Exception e) {System.out.println("Postcode must be a number!");continue;member.getaddress().setPostcode(postcode);System.out.println("Update successfully.");break;case 7:System.out.print("Please inout the updated city: ");String city = scan.nextLine();member.getaddress().setCity(city);System.out.println("Update successfully.");break;case 8:System.out.print("Please input the updated state: ");String state = scan.nextLine();member.getaddress().setState(state);System.out.println("Update successfully.");break;case 9:System.out.print("Please input the updated country: ");String country = scan.nextLine();member.getaddress().setCountry(country);System.out.println("Update successfully.");break;case 10:quit = true;break;if (quit)break;* input a member id, delete this member if exists* @param scan scanner for command line toolpublic void deleteMember(Scanner scan) {System.out.print("Please input the member ID: ");String memberID = scan.nextLine();Member member = search(memberID);if (member == null) {System.out.println("This member not found.");return;} else {memberList.remove(member);System.out.println("Deleting this member successfully.");* add credit for a selected member* @param scan scanner for command line toolpublic void addCredit(Scanner scan) {System.out.print("Please input the member ID: ");String memberID = scan.nextLine();Member member = search(memberID);if (member == null) {System.out.println("This member not found.");return;} else {System.out.print("Please input the credit value: ");int topUpValue = 0;try {topUpValue = Integer.parseInt(scan.nextLine());} catch (Exception e) {System.out.println("Must input a number.");return;member.addCredit(topUpValue);member.addPoint(topUpValue, 0);System.out.println("Adding credit successfully.");* while loop runningpublic void run() {boolean quit = false;Scanner scan = new Scanner(System.in);while (true) {System.out.println("*********************************************** Membership Management System **********************************************");System.out.println("1. Add member 2. Search member 3. Change infomation 4. Delete member 5. Add credit 6. Membership report 7. quit");System.out.println("***************************************************************************************************************************");System.out.print("Please select one option: ");String optionStr = scan.nextLine();int option = 0;try {option = Integer.parseInt(optionStr);} catch (Exception e) {System.out.println("Must input a number!");continue;if (option = 0 || option 7) {System.out.println("The number of option must be between 1 and 7!");continue;switch (option) {case 1:addMember(scan);break;case 2:search(scan);break;case 3:changeInformation(scan);break;case 4: deleteMember(scan);break;case 5:addCredit(scan);break;case 6:System.out.print(report());break;case 7:quit = true;break;if (quit)break;public static void main(String[] args) {Membership membership = new Membership();Address address = new Address("street1", 123456, "city1", "state1", "country1");Member member1 = new Member(new Name("fn1", "ln1"), "ic1", "11111", address);member1.setPoint(100);Member member2 = new Member(new Name("fn2", "ln2"), "ic2", "22222", address);member2.setPoint(200);Member member3 = new Member(new Name("fn3", "ln3"), "ic3", "33333", address);member3.setPoint(50);membership.addMember(member1);membership.addMember(member2);membership.addMember(member3);// System.out.println(membership.report());membership.run();}/*** @(#)Name.java* @author * @version 1.00 2019/8/1

所有的编程代写范围:essayghost为美国、加拿大、英国、澳洲的留学生提供C语言代写、代写C语言、C语言代做、代做C语言、数据库代写、代写数据库、数据库代做、代做数据库、Web作业代写、代写Web作业、Web作业代做、代做Web作业、Java代写、代写Java、Java代做、代做Java、Python代写、代写Python、Python代做、代做Python、C/C++代写、代写C/C++、C/C++代做、代做C/C++、数据结构代写、代写数据结构、数据结构代做、代做数据结构等留学生编程作业代写服务。