Perform some analysis of the age and weight relationships

Assignment Help Programming Languages
Reference no: EM13950507

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

Reference no: EM13950507

Questions Cloud

Compute the amount of estate tax due on charles kamps estate : Assuming the uni?ed transfer tax rates set forth in the text and a uni?ed credit for 2009, determine the amount of estate tax due on Charles Kamp's estate.
Entropy change of the system : A closed system undergoes a process in which work is done on the system and the heat transfer Q occurs only at temperature Tb. For each case, determine whether the entropy change of the system is positive, negative, zero, or indeterminate.
Find amount of estate tax that both edith and gerald leppert : Based on the above information, determine the amount of estate tax that both Edith and Gerald Leppert would be exposed to given
Describe what a branch hazard is, and what causes to it : Fully describe at least TWO of the techniques, OTHER than stalling, that can be used (in an attempt) to overcome branch hazards.
Perform some analysis of the age and weight relationships : 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..
Mass of water in a piston-cylinder assembly : 1. One pound mass of water in a piston-cylinder assembly, initially a saturated liquid at 1 atm, undergoes a constant- pressure, internally reversible expansion to x 5 90%. Determine the work and heat transfer, each in Btu. Sketch the process on p..
Compare and contrast eukaryotic and prokaryotic cells : Compare and contrast eukaryotic and prokaryotic cells. Your assignment should be 250-500 words in length. Include all references with a reference page
What is the exchange rate of the swedish krona : Suppose a Swedish krona is selling for $0.1121 and a Maltan lira is selling for $2.7878. What is the exchange rate (cross rate) of the Swedish krona to the Maltan lira?
Primary difference between pilferage and theft : Based on cost, speed, and capacity, which of the following modes is most suitable for high-value, low-volume products (may be perishable or otherwise require urgent delivery)?

Reviews

Write a Review

Programming Languages Questions & Answers

  English sentences into statements of predicate calculus

Translate the following English sentences into statements of predicate calculus. All programmers enjoy discrete mathematics. Some integers are not odd

  Create a new console application project

Create a new console application project and name it "Week1Lab_BirdN". Create the necessary member functions that will perform the required operations outlined in the lab summary above.

  How can you use a hash function

How can you use a hash function to evaluate duplicate files (even when the file name is changed) - Give the answer of given question and also provide details.

  Write down a program to input widths of both hallways

Write down a program which prompts user to input widths of both hallways. The program then outputs length of longest pipe.

  Function that normalizes a numeric vector

Create a function that normalizes a numeric vector (returns a unit vector).

  Explain the problem of storing data in matrix

Each such element is accompanied by its two indexes (the row and the column). Explain in what ways such structure is similar to and/or different than list.

  Choose one 1 of the working groups in the ietf or ieee and

write a three to four 3-4 page paper in which youquestion 1. select one 1 of the working groups in the ietf or

  Design a grade average program using raptor

Design a grade average program using raptor that will produce the numerical grade average of test scores input by a user

  Program to compute grade point average

Write a program that uses such a file to calculate your grade point average(GPA). A GPA is based on a scale from 5, where A is 4, B is 3, C is 2, D is 1 and F is 0.

  How write the program to calculate simple matrix

How to write the program to calculate simple 3x3 spreadsheet containing integers and strings. First, input spreadsheet source values from console.

  Create an xml file with markup tags

Create an XML file with markup tags and some sample data to represent a list of invoices. Include the XML tags for two invoices in the list.

  Write program to permit user to enter last names

Write down the program which permits the user to enter last names of five candidates in local election and number of votes received by each candidate.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd