Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

Analyzing Age and Weight

In this project you will combine the use of arrays and objects to perform some analysis of the age and weight relationships among a group of people. You have been contracted to write a program into which data about people, including their ages and weights, will be entered. As output the program will provide two listings of people who have particular characteristics within the group:

People who are both above the average age and above the average weight.
People who are both below the average age and below the average weight.

The program will ask the user for the number of people who need to be added to the list. It will then get the name, age, and weight data for that number of people. After the list has been entered it will analyze the data and generate lists of the people who fall into each of the categories listed above. If no one falls into one of these categories the program will just report "NONE" in place of the listing of people. The order that people appear in the lists is not important. Prior to displaying the two listings it will display the average age and average weight.

The following technical characteristics are requirements for the program:

The Person class from the previous program will be modified to include a weight field and the getter and setter for it.
The Person objects will be stored in an array.
Once the array has been created whenever the number of people in the array is needed by the program the length attribute will be used to provide that information.

The size of the array will the number of people to be added to the list.
A method named loadData() will be created to load all the data from the keyboard into a Person object. This method will take two parameters: a reference to the object to be loaded with data and a reference to a Scanner object to be used for input of the data.

A template program, AgeAndWeight.java is attached below. It provides some structure and guidance for the development of this program. You will use a modified version of the Person class developed for the previous project as the Person class for this project. I will make the sample solution for Person.java available to you as soon as you turn in the homework but you can alternatively use your own if you want to.

*****NOTE***** it is necessary to add a default constructor to the Person class. (in addition to the existing constructor that sets the name components). OR create the new Person objects inside the loadData() method and return the newly created and loaded object instead of receiving an empty object as a parameter and loading the data into it that will be OK. In that case Person would not have to have a default constructor and loadData() would receive only the Scanner object as a parameter. In the second case it is OK for Person to have a default constructor if you want one and you can use it instead of the parameterized constructor to create the new object if you want to and then load all the data into the object with the setters.

The following is a sample run of the program. User input is in bold blue text. Your input/output format should duplicate this as closely as possible.

Enter the number of people in the group: 4

Enter the data for the 4 people:

Person #1:
First name: George
Middle initial: M
Last name: Jones
Age: 25
Weight: 146.8

Person #2:
First name: Elizabeth
Middle initial: H
Last name: Morton
Age: 63
Weight: 225.7

Person #3:
First name: Alex
Middle initial: B
Last name: Butler
Age: 17
Weight: 92.3

Person #4:
First name: Amy
Middle initial: C
Last name: Rockwell
Age: 46
Weight: 179.3

Average age: 37.8
Average weight: 161.0

People above average age and weight:
Morton, Elizabeth H.
Rockwell, Amy C.

People below the average age and weight:
Jones, George M.
Butler, Alex B.

The following is a second data set that you can use for testing along with the expected results:

Arnold K. Smith, 56 yrs, 136.2 lbs
Joe S. Perez, 74 yrs, 136.0 lbs
Alice R. Styles, 17 yrs, 254.7 lbs
Rick E. Rudd, 23 yrs, 237.4 lbs

Average age: 42.5
Average weight: 191.1

People above average age and weight:
NONE

People below the average age and weight:
NONE

Attachment:- AgeAndWeight.zip

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M91621348
  • Price:- $30

Priced at Now at $30, Verified Solution

Have any Question?


Related Questions in Programming Language

Task working with arraysoverviewin this task you will

Task: Working with Arrays Overview In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, w ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Assignment - haskell program for regular expression

Assignment - Haskell Program for Regular Expression Matching Your assignment is to modify the slowgrep.hs Haskell program presented in class and the online notes, according to the instructions below. You may carry out th ...

Overviewthis tasks provides you an opportunity to get

Overview This tasks provides you an opportunity to get feedback on your Learning Summary Report. The Learning Summary Report outlines how the work you have completed demonstrates that you have met all of the unit's learn ...

Assignmentquestion onegiving the following code snippet

Assignment Question One Giving the following code snippet. What kind of errors you will get and how can you correct it. A. public class HelloJava { public static void main(String args[]) { int x=10; int y=2; System.out.p ...

Task arrays and structsoverviewin this task you will

Task: Arrays and Structs Overview In this task you will continue to work on the knight database to help Camelot keep track of all of their knights. We can now add a kingdom struct to help work with and manage all of the ...

1 write a function named check that has three parameters

1. Write a function named check () that has three parameters. The first parameter should accept an integer number, andthe second and third parameters should accept a double-precision number. The function body should just ...

Extend the adworks applicationi add dialogs to allow the

Extend the AdWorks application I. Add Dialogs to allow the user to Add, Edit, Read and Delete a Customer and refresh the view accordingly. 1. The user should be able to select a specific customer from the DataGrid and cl ...

Php amp session managment assignment -this assignment looks

PHP & SESSION MANAGMENT ASSIGNMENT - This assignment looks at using PHP for creating cookies and session management. Class Exercise - Web Project: Member Registration/Login This exercise will cover adding data connectivi ...

Question 1 what is hadoop explaining hadoop 2 what is

Question: 1. What is Hadoop (Explaining Hadoop) ? 2. What is HDFS? 3. What is YARN (Yet Another Resource Negotiator)? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow t ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As