Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Assignment help!!!!

Options
  • 25-02-2008 10:18pm
    #1
    Closed Accounts Posts: 20


    (in java) i have to make an email address in java through an abstract method called makeEmail()
    its has to take first and second names in and take the first letter from the first name followed by a dot, three letters from the second name and then the string @hotmail.co.uk.
    please help if you can


Comments

  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    Show us the code you have done so far.


  • Closed Accounts Posts: 20 heavy482


    public abstract class Person
    {
    //Private Variables
    private String firstName;
    private String lastName;
    private int credits;
    private int status;

    //Default Constuctor
    public Person(String first, String last)
    {
    firstName = first;
    lastName = last;
    }

    public int getCredits()
    {
    return credits;
    }

    public void setCredits()
    {
    this.credits=credits;
    }

    public int getStatus()
    {
    return status;
    }


    public String showInitials()
    {


    }

    public abstract String makeEmail();


    }


    public class Student extends Person
    {

    public Student(String firstName, String lastName,int credits,int status)

    //Default Constuctor
    {
    super(firstName,lastName, credits, status);

    }

    public String getStatus()
    {
    return status;
    }

    public void setStatus(int newStatus)
    {
    this.status=newStatus;
    }

    public void addCredits(int additionalPoints)
    {
    credits += additionalPoints;
    }

    public int getCredits()
    {
    return credits;
    }

    public String makeEmail()
    {

    }

    }
    dont have anything for how to show initials.
    THE MAKE EMAIL ONE IS THE PROBLEM BECAUSE OF THE FIRST LETTER AND FIRST 3 LETTERS FROM THE NAMES


  • Registered Users Posts: 1,636 ✭✭✭henbane




  • Closed Accounts Posts: 20 heavy482


    how do i take in a variable in with this or can i ???


  • Registered Users Posts: 26,558 ✭✭✭✭Creamy Goodness


    you don't necessarily take in a variable you can invoke it on a variable and store the result in another variable if you wish like so.


    psuedocode
    String fname
    String fullname = "joe bloggs"
    
    fname = fullname.substring(0,2)
    
    this will place the string "joe" into fname. the 0 is the starting point and the two is where i want to finish, but that's all explained to you in the javadocs link henbane posted.


  • Advertisement
Advertisement