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 3 of 3

Thread: Help please?

  1. #1
    Junior Member
    Join Date
    Mar 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help please?

    a. Assume that we have a list of employees' names of a company and their ages.
    Write a program that reads from the user several lines of input. Each line includes an employee's name and his/her age (as an integer). The program should calculate and print the following:
     The average age of all employees (rounded to 2 decimal places).
     The oldest employee and his/her age.

    Hints:
    You could assume that the user will insert valid data and at least one employee.
    You could assume that the oldest employee is only one person.
    User could stop the program via entering the word "end" as an employee's name.

    Sample Input and Output: In each line, insert an employee's name and his/her age To halt the program, insert "end" as an employee's name

    -----------
    Adam 30
    Tom 41
    Ted 45
    Karl 30
    end
    -----------
    The average age of all employees is 36.50
    The oldest employee is Hisham whose age is 45

  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Help please?

    Did you have a question, or did you just want to post your homework? Please read the link in my signature on asking questions the smart way.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Help please?

    Welcome to the forum! Please read this topic to learn how to post code correctly and other useful info for new members.