English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

The details stored should include at least:
Firstname, surname, age, sex and telephone number

2007-02-15 01:18:21 · 2 answers · asked by boom* 1 in Computers & Internet Programming & Design

2 answers

This is extremely basic. A little research on the subject shouldn't kill you.

// file Person.java

public class Person {
private String firstname;
private String surname;
private int age;
private char sex;
private String phone;

public Person(String firstname, String lastname) {
this.firstname = firstname;
this.lastname = lastname;
}

public void setFirstname(String newname) {
firstname = newgame;
}

public String getFirstname() {
return firstname;
}

// similar get and set for other variables
// that is a good start
}

PS Happy to disappoint the clown below me, I left some for him to do. Maybe he will learn something if he finishes it.

2007-02-15 01:25:54 · answer #1 · answered by scruffy 5 · 1 0

This sounds like homework. If you've been paying any attention at all in class this should be very simple.

What a shame the person above solved it for you.

2007-02-15 12:09:10 · answer #2 · answered by Daniel R 6 · 0 1

fedest.com, questions and answers