I created two separate classes, main and leads. The following is from 'leads' , I am trying to apply Leads.primeLead();
if the user answers Yes on the first question, and if not, I'd like to write a different method to add all the necessary information.
My problem is that, I don't quite understand why the primeLead() wont apply on Lead constructor or how am I supposed to define it so it will.
import java.util.ArrayList;
import java.util.Scanner;
public class Lead {
String nameLead;
int ageLead;
int phoneLead;
String cityLead;
String email;
String otherNotes;
int indexOfLead = 0;
int i = indexOfLead;
ArrayList<String> names = new ArrayList<String>();
ArrayList<Integer> ages = new ArrayList<Integer>();
ArrayList<Integer> phones = new ArrayList<Integer>();
ArrayList<String> cities = new ArrayList<String>();
ArrayList<String> emails = new ArrayList<String>();
ArrayList<String> notes = new ArrayList<String>();
Scanner leads = new Scanner(System.in);
Lead() {
System.out.println("Is this the first lead? (Y/N) ");
if (leads.nextLine() == "Y") {
this.primeLead();
}
}
/* public mainMenuLead(){
System.out.println("Please choose one of the following options");
} */
Lead newLeads = new Lead();
public void primeLead() {
i = 0;
System.out.println("============================================");
System.out.println(" Please enter by the following order : ");
System.out.println(" Name, age, phone , city, mail ");
System.out.println("============================================");
System.out.println("Please enter the name of the Lead : ");
names.add(leads.nextLine());
System.out.println("Age? : ");
ages.add(Integer.parseInt(leads.nextLine()));
System.out.println("Phone number? ");
phones.add(Integer.parseInt(leads.nextLine()));
System.out.println("Would you like to add ... ");
System.out.println("1) City? ");
System.out.println("2) Email? ");
System.out.println("3) Notes? ");
if (leads.nextLine() == "1") {
System.out.println("Please add City: ");
cities.add(leads.nextLine());
} else if (leads.nextLine() == "2") {
System.out.println("Please add email : ");
emails.add(leads.nextLine());
} else if (leads.nextLine() == "3") {
System.out.println("Please add any other notes you may have: ");
notes.add(leads.nextLine());
}
}
}