Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

Purpose: This assignment will provide more practice in processing file data in Java.  It will also require the declaration of a class type, the creation of a list of objects, and some simple processing of the list that will involve sorting and computation of a couple of summary statistics about the data.

Problem description: The input file supplied contains information about animals (no more than 1000) that have been processed by an animal shelter in Washington state.  Your program will parse the data file, create an object for each animal represented, and store the objects in an array.  An output file with various information about the animals will be generated as output (described below).

Details of the input: Each line of the data file contains the following information about an animal including:

  • ID number
  • Status - ADOPTABLE, LOST, or FOUND
  • Name (if known)
  • Type of animal - Cat, Dog, etc.
  • Age
  • Gender
  • Breed
  • Color
  • City
  • State
  • Zip

Within a line, each field of information is separated from the next by a comma.  If a piece of information is unknown, there is still a comma for that field (i.e., the pattern ,, can be observed at some points in the file.  Some fields contain multiple words (e.g., Domestic Shorthair) and other types of special characters (e.g. dash, slash, colon).

Details of the output: The output file will begin with a listing of the animals sorted by the status field using the array.sortfunctionality provided in Java.  The listing will have one animal per line of output and contain the following fields in the following order, each separated from the next by a colon (:)

  • Status
  • Type of animal
  • Gender
  • Breed

An example output line is

ADOPTABLE:Cat:Female:Domestic Longhair

Following the listing will be a single blank line and then the following summary statistic:

Percentage not dogs or cats: (computed percentage rounded to nearest integer)

Lost Labrador Retrievers: (integer count computed)

Note that your output must follow the stated format exactly.  It will be evaluated for correctness based upon whether or not it matches the correct output file.

Requirements of the class design:

  • All data members must be declared private. That is, your main application must obtain access to any data of an object by invoking an accessor method within the class and not by accessing a data member directly.
  • The class must implement the Comparable interface and define and implement a compareTo method that will enable sorting the animals as described above.
  • Mutator methods should be provided on an "as needed" basis only. That is, don't make a bunch of methods like "setStatus", "setBreed", etc. that can alter the values in an object unless they are absolutely necessary. It is the limitation of the ability to modify the data in an object that results in a more reliable program. Giving unnecessary access to modify data members increases the likelihood that an application will misuse the class type.

Documentation:

  • Any assumptions that the method is making; e.g., all supplied parameter values are initialized with valid data.
  • A summary of the result of calling the method; e.g., the returned string contains the gender of the animal or the method modifies the name of the animal (hint: you don't need this one!).

Attachment:- pets.txt

Java, Programming

  • Category:- Java
  • Reference No.:- M91419763
  • Price:- $30

Priced at Now at $30, Verified Solution

Have any Question?


Related Questions in Java

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Solving 2nd degree equationsbull write the following java

Solving 2nd degree equations • Write the following Java methods • boolean real-sols(double a, double b, double c): it returns true if the 2nd degree equation ax2 + bx + c has real solutions • double solution1(double a, d ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Retail price calculatorwrite a java program that asks the

Retail Price Calculator Write a JAVA program that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: (If an item's wholesale cost is 5. ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

In ruby the hash class inherits from enumerable suggesting

In Ruby, the Hash class inherits from Enumerable, suggesting to a programmer that Hashes are collections. In Java, however, the Map classes are not part of the JCF (Java Collections Framework). For each language, provide ...

Assignment game prototypeoverviewfor this assessment task

Assignment: Game Prototype Overview For this assessment task you are expected to construct a prototype level/area as a "proof of concept" for the game that you have designed in Assignment 1. The prototype should function ...

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

Assignment - method in our madnessthe emphasis for this

Assignment - "Method in our Madness" The emphasis for this assignment is methods with parameters. In preparation for this assignment, create a folder called Assign_3 for the DrJava projects for the assignment. A Cityscap ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

  • 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