Talk about the intelligence level of creature makes perfect

Assignment Help Computer Engineering
Reference no: EM132210339

Write a program in Java following the given description:

There are many different types of Creatures, and talking about the intelligence level of a Creature makes perfect sense.

HumanBeing is a Creature, each possessing, in addition to the intelligence level, a name and age. Male is a HumanBeing, and so is Female.

Animal is another Creature which possesses some Intelligence Level, and so is Bird.

In this assignment, you are required to implement a Creature as an abstract class containing an abstract method getIntLevel; a HumanBeing class described as above; a Male class and a Female class.

For each male, we wish to keep track of his height and weight, whereas for every female, we wish to keep track of her last degree.

Male and Female classes have all required accessor methods to return the values of their attributes. Both, Male and Female classes allow users to calculate intelligence level defined (absurdly) as follows:

Male: (Calculation proceeds in the order given here)

If age > 40, then IntLevel = 5

If age is < 5 years, then IntLevel = 1

If weight >= 150 pounds and height is > 70 inches then IntLevel = 5

If weight is between 120 and 149 pounds, and height > 70 inches, then IntLevel = 4

If weight is between 50 and 119 pounds, then IntLevel = 3

If weight is between 120 and 149 pounds, and height is between 55 and 69 inches,

then IntLevel = 2

In all other cases, the IntLevel = 3.

Female:

If lastDegree = "Ph.D.", then IntLevel = 5

If lastDegree = "MS", then IntLevel = 4

If last Degree = "BS", then IntLevel = 3

If last Degree = "AA", then IntLevel = 2

In all other cases, IntLevel = 1.

When a Male or Female object is created, the constructor checks if this is indeed a "valid" person. A "valid" male is someone whose weight is less than 400 pounds and height is less than 100 inches.

A "valid" female is someone whose age is less than 110 years. If the user tries to create an "invalid" person, the class constructors throw an exception called notHumanBeingException to the calling program. The calling program rejects that person from consideration.

In case the person was "valid", the constructor calculates the person's Intlevel and initializes it. Obviously, HumanBeing must provide a method that allows setting of one's IntLevel.

The test program will do the following:

From an input file (as always, get the name of the file from the user), read the basic information about Human Beings. Don't hardcode the file name, askt he user for the filename. Input file is given below. The first character identifies what type of Human Being this person is - M or F.

Information in the input file is in the following order:

Male: name, age, height (in inches), weight (in pounds).

Female: name, age, last degree.

Create an ArrayList of all persons, an array of males, and an array of females from this given data. That is, each person will be included in an ArrayList and one array.

Output unsorted ArrayList of persons.

Sort the ArrayList based on names, using "sort" method of the Collections interface.

Output the sorted ArrayList of persons.

Output unsorted list of Males.

Sort the array of males based on their heights using Arrays.sort (array_of_males, comparator) call.

Output the sorted array of males.

Output the unsorted list of females.

Sort this array based on age using Arrays.sort (array_of_females) call. Note that no comparator is passed in this call. Do whatever you need to do to achieve this.

Output the sorted list of females.

The output should be sent to an output file, and should be completely self-explanatory.

INPUT FILE:

M DanMarino 45 75 220
M SteveSmith 35 57 110
F MiaHamm 25 MS
F OhYeah 120 AA
M JackSmith 34 60 128
F Alexandra 55 Ph.D.
F Maria 24 BS
M DanMarinoJr 4 24 24
M MarkWho 38 72 144
M DumbOne 27 66 410
M Great! 77 110 333
F Alicia 46 BS
F Haydee 44 AA
F Irene 22 BS
F Martha 55 Ph.D.
M DavidWhite 39 71 155
M BillBlack 33 76 144
M WeiChen 28 55 112
M NormanSmith 33 55 166
F AnaSmith 52 Ph.D.
M PaulGirard 38 58 211
M PeterPan 3 18 22
M HumptyDumpty 77 36 500
F PaulaGrant 44 MS
F BonnieBert 27 AA
F BerthaTravis 11 Ph.D.
F YolyGarcia 23 BS
M JoseSanchez 2 18 22
M JulioSmith 38 55 165

Reference no: EM132210339

Questions Cloud

How many days should contractor budget : A contractor intends to bid on a job installing 30 airport security systems. How many days should the contractor budget for
Which firms would choose toadopt the new technology : Could it be profit maximizing for some firms to adopt the new technology but not profitmaximizing for other firm to adopt that same technology?
Representative sample and simple random sample in surveys : Briefly explain the difference between a representative sample and simple random sample in surveys
Estimate the effect of the car price rise in sales : Sales of cars declined by 15 percent in a recent recession. During this period the price of cars rose by 6 percent, average income fell by 4 percent.
Talk about the intelligence level of creature makes perfect : There are many different types of Creatures, and talking about the intelligence level of a Creature makes perfect sense.
Characterize the energy beverage category and competitors : How would you characterize the energy beverage category, competitors, consumers, channels, and DPSG's category participation in late 2007?
What will be the change in the money supply : The Federal Reserve buys $5,000 in bonds from Fidelity, which then deposits the money in a checking account at Chase Morgan Bank.
Cultural differences can cause conflict resolution : Cultural differences can cause conflict resolution among international teams to be more difficult. Discuss a method that would be effective.
How much will each student have a year later : If borrowing and lending is prohibited, so each student uses only his or her own saving to finance his or her own project, how much will each student have.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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