I have my code but my directions are to add new person to replace the first pers
ID: 3537752 • Letter: I
Question
I have my code but my directions are to add new person to replace the first person that I already have. How do I do this?
Here is what I have so far. It runs great like this but I just need to figure out the replacing of a person. Please don't change code. I just want to know what I am doing wrong.
public class lab2
{
public static void main(String[] args)
{
Contact Contact();
one.setName("Billy");
one.setBirthDate("11/10/1998");
one.setnumber("3082610987");
one.setAddress("112 Ct. Rd");
one.setEyeColor("blue");
Contact two = new Contact();
two.setName("Bob");
two.setBirthDate("12/09/1976");
two.setnumber("3893843216");
two.setAddress("13 college hills drive");
two.setEyeColor("green");
System.out.println("Contact: " + one.getName() + " " +
"BirthDate: " + one.getBirthDate() + " " +
"Phonenumber: " + one.getnumber() + " " +
"Address: " + one.getAddress() + " " +
"Eye Color: " + one.getEyeColor());
System.out.println(" ");
System.out.println("Contact: " + two.getName() + " " +
"BirthDate: " + two.getBirthDate() + " " +
"Phonenumber: " + two.getnumber() + " " +
"Address: " + two.getAddress() + " " +
"Eye Color: " + two.getEyeColor());
System.out.println(" ");
System.out.println("Enter a new first contact name");
Contact Contact("Mark");////////////////////////////////HERE IS WHERE I AM HAVING TROUBLE!!!
} // end main
}
Here is my class code
//import java.util.Date;
//Server type Class
public class Contact
{
//Instance Variables
private String Name;
private String BirthDate;
private String number;
private String Address;
private String EyeColor;
//Mutator Methods
public void setName(String newName)
{Name=newName;}
public void setBirthDate(String newBirthDate)
{BirthDate=newBirthDate;}
public void setnumber(String newnumber)
{number=newnumber;}
public void setAddress(String newGetAddress)
{Address=newGetAddress;}
public void setEyeColor(String newGetEyeColor)
{EyeColor=newGetEyeColor;}
//Accessor Methods
public String getName()
{return Name;}
public String getBirthDate()
{return BirthDate;}
public String getnumber()
{return number;}
public String getAddress()
{return Address;}
public String getEyeColor()
{return EyeColor;}
}
Explanation / Answer
Sample output
Contact: Billy
BirthDate: 11/10/1998
Phonenumber: 3082610987
Address: 112 Ct. Rd
Eye Color: blue
Contact: Bob
BirthDate: 12/09/1976
Phonenumber: 3893843216
Address: 13 college hills drive
Eye Color: green
Enter a new first contact name
Enter the name of the person
Will Smith
Enter the birthDate of the person
10/06/1989
Enter your number
343823223
Enter your address
WallStreet
Enter your eye color
brown
Contact: Will Smith
BirthDate: 10/06/1989
Phonenumber: 343823223
Address: WallStreet
Eye Color: brown
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.