Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: Java Program Help

  1. #1
    Junior Member
    Join Date
    Jul 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java Program Help

    http://timlin.net/csm/cis254/Lab6.html

    Can someone do this very quick.
    If iI do not get it done I ill fail the semester.

    I will donate $30 to anyone that finishes this soon.


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Java Program Help

    Hello javakid93,

    This doesn't look like a quick job. How long do you have to complete it?

    Do you already have the Person and/or Employee classes?
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  3. #3
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Java Program Help

    That looks like homework Oh well... Add your own header comments
    public class Student
    {
        private String address;
        private String city;
        private String state;
        private String zip;
        private String dateOfBirth;
     
        /**
         * Constructor
         * 
         * @param address
         * @param city
         * @param state
         * @param zip
         * @param dateOfBirth
         * @throws NumberFormatException
         *             Zip code is not a 5 digit number
         */
        public Student (String address, String city, String state, String zip, String dateOfBirth)
        {
            setAddress(address);
            setCity(city);
            setState(state);
            setDateOfBirth(dateOfBirth);
            setZip(zip);
        }
     
        /**
         * @return the address
         */
        public String getAddress ()
        {
            return this.address;
        }
     
        /**
         * @param address
         *            the address to set
         */
        public void setAddress (String address)
        {
            this.address = address;
        }
     
        /**
         * @return the city
         */
        public String getCity ()
        {
            return this.city;
        }
     
        /**
         * @param city
         *            the city to set
         */
        public void setCity (String city)
        {
            this.city = city;
        }
     
        /**
         * @return the state
         */
        public String getState ()
        {
            return this.state;
        }
     
        /**
         * @param state
         *            the state to set
         */
        public void setState (String state)
        {
            this.state = state;
        }
     
        /**
         * @return the zip
         */
        public String getZip ()
        {
            return this.zip;
        }
     
        /**
         * @param zip
         *            the zip to set
         * @throws numberFormatException
         *             Zip code is not a 5 ditit number
         */
        public void setZip (String zip)
        {
            // make sure valid zip is inputted
            if (zip.length() == 5)
            {
                Integer.parseInt(zip);
                this.zip = zip;
            }
            else
            {
                throw new NumberFormatException();
            }
        }
     
        /**
         * @return the date Of Birth
         */
        public String getDateOfBirth ()
        {
            return this.dateOfBirth;
        }
     
        /**
         * @param dateOfBirth
         *            the date Of Birth to set
         */
        public void setDateOfBirth (String dateOfBirth)
        {
            this.dateOfBirth = dateOfBirth;
        }
    }
    public class Employee
    {
        private String address;
        private String city;
        private String state;
        private String zip;
        private String dateOfBirth;
        private double HourlyRate;
        private String title;
        private String startDate;
     
        /**
         * Constructor
         * 
         * @param address
         * @param city
         * @param state
         * @param zip
         * @param dateOfBirth
         * @throws NumberFormatException
         *             Zip code is not a 5 digit number
         */
        public Employee (String address, String city, String state, String zip, String dateOfBirth, String title,
                         String startDate, double hourlyRate)
        {
            setTitle(title);
            setHourlyRate(hourlyRate);
            setStartDate(startDate);
            setAddress(address);
            setCity(city);
            setState(state);
            setDateOfBirth(dateOfBirth);
            setZip(zip);
        }
     
        /**
         * @return the hourly rate
         */
        public double getHourlyRate ()
        {
            return this.HourlyRate;
        }
     
        /**
         * @param hourlyRate
         *            the hourly Rate to set
         */
        public void setHourlyRate (double hourlyRate)
        {
            this.HourlyRate = hourlyRate;
        }
     
        /**
         * @return the title
         */
        public String getTitle ()
        {
            return this.title;
        }
     
        /**
         * @param title
         *            the title to set
         */
        public void setTitle (String title)
        {
            this.title = title;
        }
     
        /**
         * @return the start Date
         */
        public String getStartDate ()
        {
            return this.startDate;
        }
     
        /**
         * @param startDate
         *            the start Date to set
         */
        public void setStartDate (String startDate)
        {
            this.startDate = startDate;
        }
     
        /**
         * @return the address
         */
        public String getAddress ()
        {
            return this.address;
        }
     
        /**
         * @param address
         *            the address to set
         */
        public void setAddress (String address)
        {
            this.address = address;
        }
     
        /**
         * @return the city
         */
        public String getCity ()
        {
            return this.city;
        }
     
        /**
         * @param city
         *            the city to set
         */
        public void setCity (String city)
        {
            this.city = city;
        }
     
        /**
         * @return the state
         */
        public String getState ()
        {
            return this.state;
        }
     
        /**
         * @param state
         *            the state to set
         */
        public void setState (String state)
        {
            this.state = state;
        }
     
        /**
         * @return the zip
         */
        public String getZip ()
        {
            return this.zip;
        }
     
        /**
         * @param zip
         *            the zip to set
         * @throws numberFormatException
         *             Zip code is not a 5 ditit number
         */
        public void setZip (String zip)
        {
            // make sure valid zip is inputted
            if (zip.length() == 5)
            {
                Integer.parseInt(zip);
                this.zip = zip;
            }
            else
            {
                throw new NumberFormatException();
            }
        }
     
        /**
         * @return the date Of Birth
         */
        public String getDateOfBirth ()
        {
            return this.dateOfBirth;
        }
     
        /**
         * @param dateOfBirth
         *            the date Of Birth to set
         */
        public void setDateOfBirth (String dateOfBirth)
        {
            this.dateOfBirth = dateOfBirth;
        }
    }

    Hehe, thank goodness for Eclipse's generate getters and setters.
    Last edited by helloworld922; July 26th, 2009 at 01:05 PM.

  4. #4
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Java Program Help

    helloworld922 loves doing peoples homework

    Nice work helloworld922. I hope you are going to claim the $30 reward!!
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  5. #5
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: Java Program Help

    I laughed when I saw this

    Use proper variable names, for example Data of birth should probably be called birthDate
    Would you not just call the variable "dateOfBirth"? HAHAHAHAHA

    // Json

  6. #6
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Thumbs up Re: Java Program Help

    Quote Originally Posted by Json View Post
    I laughed when I saw this
    Would you not just call the variable "dateOfBirth"? HAHAHAHAHA

    // Json
    lol yeah I did think that actually.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  7. #7
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Java Program Help

    Haha, i don't think i even read that line

    The whole thing was maybe 10 minutes, top. Enter all the fields that applied, use the generate getters/setters option, and wrote the constructor. Then i copied and pasted for the other classes (generating the extra getters/setters for the new fields)

    I wish i made $180/hour everyday
    Last edited by helloworld922; July 27th, 2009 at 11:07 AM.

Similar Threads

  1. Java program Square root
    By Hey in forum Java Theory & Questions
    Replies: 5
    Last Post: August 16th, 2009, 01:14 AM
  2. Redirect error and output stream using java program
    By leenabora in forum File I/O & Other I/O Streams
    Replies: 5
    Last Post: June 16th, 2009, 04:12 AM