programming help

Posted by user208639 on Stack Overflow See other posts from Stack Overflow or by user208639
Published on 2010-05-28T15:49:01Z Indexed on 2010/05/28 15:51 UTC
Read the original article Hit count: 113

Filed under:
|
|

class Person holds personal data Its constructor receives 3 parameters, two Strings representing first and last names and an int representing age public Person(String firstName, String lastName, int age) { its method getName has no parameters and returns a String with format "Lastname, Firstname" its method getAge takes no parameters and returns an int representing the current age its method birthday increases age value by 1 and returns the new age value

Create the class Person and paste the whole class into the textbox below

public class Person
{

public Person(String first, String last, int age)
    {


       getName = "Lastname, Firstname";
       System.out.print(last + first);

       getAge = age + 1;
       return getAge;
       System.out.print(getAge);

       birthday = age + 1;
       newAge = birthday;
       return newAge;


    }
}

im getting errors such as "cannot find symbol - variable getName" but when i declare a variable it still not working, i also wanted to ask if i am heading in the right direction or is it all totally wrong? im using a program called BlueJ to work on.

© Stack Overflow or respective owner

Related posts about java

Related posts about beginner