LinkLists和节点

时间:2015-03-07 23:38:25

标签: java linked-list

有一个我一直在研究的项目,它要求我使用java创建小型社交网站,这是通过IntellJ运行的,所有的导航都是通过控制台完成的。我可以做一些事情,如登录,创建新用户,添加朋友等。但是,部分作业要求我创建一个允许我“喜欢”网站的链接列表。任何帮助将不胜感激。以下是我已经完成的一些方法,但我不确定如何建立我的链接列表以“喜欢”网页。我附加的代码包含菜单和登录系统的一部分。我一直在尝试使用节点和链表,但无济于事。感谢所有帮助。

  public class LoginRegistration
  {
  static Scanner keyboard = new Scanner(System.in);
  private static User[] userAccount;
  private static User[] newUser;
  private static User newAccount;
  private static int noOfUsers = 0;

 protected static void menuPage()
 {
  int numberChoice;
  boolean menuChoice = false;

  System.out.println("Welcome to social network.");

  do
  {
     System.out.println("Existing user: Press '1'");
     System.out.println("Create a new account: Press '2'");
     System.out.println("Administrator: Press '3'");
     System.out.println("Press '4' to exit");
     numberChoice = keyboard.nextInt();

     keyboard.nextLine();
     switch (numberChoice)
     {
        case 1:
           loginPage();
           break;
        case 2:

           createNewAccount();
           break;
        case 3:
           System.out.println("\nSite Administrator");
           break;
        case 4:
           System.out.println("\nYou have chosen to Exit the system");
           break;
        default:
           System.out.println("\nInvalid choice");
     }//switch
  } while (numberChoice != 4);

  protected static void activitiesPage(User userOptions)
  {
  int numberChoice;

      "Welcome to your  account.\n What activity would you   
       like to do today?");
       "Please select one of the following:\n" +
          "Press '1' to search for another Gamer\n" +
          "Press '2' to edit your profile\n" +
          "Press '3' to like games, teams, gaming websites 
           and sports       websites\n" +

          "Press '6' to delete your account");
            System.out.println();


  do
  {
     numberChoice = keyboard.nextInt();

     keyboard.nextLine();
     switch (numberChoice)
     {
        case 1:

           searchForUser(userOptions.getUserEmail(),
      userOptions.getUserLastName());
           break;
        case 2:

           //edit profile
           break;
        case 3:
           //like websites
           break;
        case 4:
           //check sport websites
           break;

        case 5:
           //check gaming websites
           break;
        case 6:
           //delete account
           break;
        default:
           System.out.println("\nInvalid choice");
     }//switch
  } while (numberChoice != 6);

0 个答案:

没有答案