outprintln Responder Log in enter your user name print

Outprintln responder log in enter your user name print

This preview shows page 25 - 28 out of 39 pages.

System.out.println("-----Responder Log in-----"); System.out.println("Please enter your user name"); // print line on screen to prompt user for username resName = resLogin.nextLine(); // store the user input in 'resName' System.out.println("Please enter your password"); // print line on screen to prompt user for password resPwd = resLogin.nextLine(); // store the user input in 'resPwd' // loop through the responder arraylist to look for the responder for(int i=0;i<resList.size();i++) { // if the input name and password is equal to the responder's name and password at 'i' position if(resName.equals(resList.get(i).getCustName()) && resPwd.equals(resList.get(i).getCustPwd())) { int rAge = resList.get(i).getCustAge(); // set rAge = responder's age at position 'i' int rIncome = resList.get(i).getCustIncome(); // set rIncome = responder's age at position 'i' String rGender = resList.get(i).getCustGender(); // set rGender = responder's age at position 'i' System.out.println("Welcome Back " + resName + " !"); // loop through the advertiser arraylist for(int j=0;j<adList.size();j++) {
Image of page 25
int aMinAge = adList.get(j).getPartnerDescription().getMinAge(); // set aMinAge = advertiser's ideal minimum age at position 'i' int aMaxAge = adList.get(j).getPartnerDescription().getMaxAge(); // set aMaxAge = advertiser's ideal maximum age at position 'i' int aMinIncome = adList.get(j).getPartnerDescription().getMinIncome(); // set aMinIncome = advertiser's ideal minimum income at position 'i' int aMaxIncome = adList.get(j).getPartnerDescription().getMaxIncome(); // set aMaxIncome = advertiser's ideal maximum income at position 'i' String aGender = adList.get(j).getPartnerDescription().getpGender(); // set aGender = advertiser's ideal gender // comparison between responder's details with the advertiser's ideal details if(rAge>=aMinAge && rAge<=aMaxAge && rIncome>=aMinIncome && rIncome<=aMaxIncome && rGender.equals(aGender)) { // print out the matched advertiser's ID and name System.out.println("Your match ID-" + adList.get(j).getCustId() + " Name-" + adList.get(j).getCustName()); matchFound=true; } } if(matchFound==false) { System.out.println("Sorry no match"); } else { Scanner response = new Scanner(System.in); // create a new scanner = response // prompt user to select the match's ID System.out.println("Enter the ID of the person that you want to response"); int resID = response.nextInt(); // loop throught the advertiser arraylist for(int y=0;y<adList.size();y++) { // if the advertiser's ID = the user input of match's ID if(adList.get(y).getCustId() == resID) { System.out.println("Please enter a message to send"); Scanner textScanner = new Scanner(System.in); String text = textScanner.nextLine(); adList.get(y).addMessage(resName, text, resList.get(i).getResPhone(), resList.get(i).getResEmail()); } } System.out.println("Message was sent to your match! Good luck!"); } resFound=true; }
Image of page 26
} if(resFound==false) { System.out.println("Incorrect user name and password, Please try again."); } } // input option 5 else if(in==5) { System.out.println("-----Detail list of advertiser-----"); //loop through the advertiser arraylist for(int i=0;i<adList.size();i++) { // print the advertiser's details at postion 'i' adList.get(i).print(); } } // input option 6 else if(in==6) { System.out.println("-----Detail list of responder-----"); //loop through the responder arraylist for(int i=0;i<resList.size();i++) {
Image of page 27
Image of page 28

You've reached the end of your free preview.

Want to read all 39 pages?

  • One '14
  • Login, partner

  • 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