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

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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