DatingService.java - package datingservice import [email protected] Title Date File name Purpose Lee Ci Rong(33084365 Assignment 1 5 October 2018

DatingService.java - package datingservice import...

This preview shows page 1 - 4 out of 17 pages.

package datingservice; import java.util.*; /** * @author Lee Ci Rong(33084365) * Title: Assignment 1 * Date: 5 October 2018 * File name: DatingService.java * Purpose: Methods and Main class of the program */ public class DatingService { public static Scanner kb = new Scanner (System.in); public static ArrayList<Advertiser> advList = new ArrayList<>(); public static ArrayList<Responder> resList = new ArrayList<>(); public static ArrayList<Admin> admList = new ArrayList<>(); public static Advertiser advertiseR; public static Responder respondeR; public static Admin admiN; /** * Print student info at the beginning of the program. */ public static void studentInfo() { System.out.println("My name is Lee Ci Rong."); System.out.println("My student number is CT0278938."); System.out.println("My mode of enrolment is internal."); System.out.println("My tutor name is Sarita Singh."); System.out.println("Lessons on Wednesday 7pm to 10.30pm."); } /** * Method that shows the menu to run the different options at the start * of the program. Options include logging in, creating new advertiser * or responder, and viewing of advertisers and responders. */ public static void menu() { int option; System.out.println("Welcome to the Online Dating Services. \nPlease select one of the following options"); System.out.println("Option 1:Log in \nOption 2:New Advertiser \nOption 3:New Responder \nOption 4:Quit"); System.out.print("Option: "); while(!kb.hasNextInt()) { System.out.println("Invalid option. Please re-enter!"); System.out.print("Option: "); kb.next(); } option = kb.nextInt(); switch(option) { case 1: System.out.println(); logIn(); break; case 2: System.out.println(); createNewAdvertiser();
Image of page 1
break; case 3: System.out.println(); createNewResponder(); break; case 4: System.out.println("Thank you!"); break; default: System.out.println("Invalid option. Please re-enter!\n"); menu(); } } /** * Method that shows the Admin menu to view all advertisers/responders or delete existing * customers in the arraylist. */ public static void adminMenu() { int option; boolean b = false; do { System.out.println("Option 1:View all advertiser \nOption 2:View all responder \nOption 3:Delete customer \nOption 4:Return"); System.out.println("Please enter an option above:"); System.out.print("Option: "); while(!kb.hasNextInt()) { System.out.println("Invalid option. Please re-enter!"); System.out.print("Option: "); kb.next(); } option = kb.nextInt(); switch(option) { case 1: System.out.println(); printAdvertiser(); break; case 2: System.out.println(); printResponder(); break; case 3: System.out.println(); deleteCust(); break; case 4: System.out.println(); logIn(); b = true; break; default: System.out.println("Invalid option. Please re-enter!"); System.out.println(); adminMenu(); } }while(!b); }
Image of page 2
/** * Method that shows the advertiser menu after the user logs in. * Consist of options that allow users to view messages, delete messages * or return to the previous menu. */ public static void advMenu() { int option; boolean b = false; do { System.out.println("Option 1:View Messages \nOption 2:Return"); System.out.println("Please enter an option above:"); System.out.print("Option: "); while(!kb.hasNextInt()) { System.out.println("Invalid option. Please re-enter!"); System.out.print("Option: "); kb.next(); } option = kb.nextInt(); switch(option) { case 1: System.out.println(); advertiseR.getReply(); // view messages break; case 2: System.out.println();
Image of page 3
Image of page 4

You've reached the end of your free preview.

Want to read all 17 pages?

  • Summer '17
  • partner, public class DatingService

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes