Processing file data in java

Assignment Help JAVA Programming
Reference no: EM13849986

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

Reference no: EM13849986

Questions Cloud

Find flap retraction speed : Find Maximum Takeoff Weightfor the given conditions.Assume takeoff is at Max Recommended Takeoff weight accounting for Density altitude -
What actions might you expect from a company : Many companies say that their goal is to provide quality products or services. What actions might you expect from a company that intends quality to be more than a slogan or buzzword?
Discussing the history of the death penalty : 750 Word paper discussing the history of the death penalty, examining the impact the court case Furman v. Georgia (1972) and what it had on the death penalty across America
List the five skills that your group came up with : List the five skills that your group came up with. (Note: Make sure that you list who was in your group, to ensure that you are acknowledging all those to contributed ideas within your group.)
Processing file data in 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 com..
What is the cbm : If the length is 1.6 meters, and the width is 3.2 meters, and the height is 2.8 meters, what is the CBM - what is the freight rate in both volume and weight?
Describing what the terminated employee may target : Write a 1,400- to 1,750-word paper describing what the terminated employee may target, what methods they may use, and the damage their activities might cause to the IS. Include your preventive actions and responses as the chief information securit..
Describe the military events which composed d-day : Outline the factors which resulted in the choice of Normandy as the site of D-Day. What other options did the Allies contemplate, and where these alternatives sites ruled out. Describe the military events which composed D-Day on the beaches of bot..
How will help in re-branding maya : How will help in re-branding Maya? What changes must Maya conduct to attract community the confidence of the community? In your opinion should Maya go on a MBO or offer of sale?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Determines and displays the smallest and largest

Create a method that determines and displays the smallest and largest of the ten values. Then, pass the array to the method - Create a GUI application whose button's Click() method accepts ten integer values from a TextBox and stores them in an arra..

  Design an adt for the problem

Design an ADT for this problem. Be sure to consider all necessary operations to maintain the appointment book for one year, to archive the yearly book and create a new book for the following year.

  Calculate the largest divide by the smallest number

Please also calculate the largest divide by the smallest number provide the quotient and remainder and also put the information as a string on the applet. All the numbers will presented in two decimal places.

  Ask the user how many times you want to run

c the algorithm. 2. Then choose a word at random from the array of Strings as the target (Use the integer random number generator)

  Better with age

You and your roommates, all at least 21 years of age, have gotten hooked brewing your own beer from kits. You've made quite a few batches, each from a different mix,

  Calculate the cross product of two numeric vectors function

Create a function that calculate the cross product of two numeric vectors Function Name: calcCrossProduct

  Write sql statement to delete dept_id 1

Add 2 employees into EMPLOYEE12 table with one employee should belong to dept_id  1 and another employee should belong to dept_id 2. Remember to create and use Sequence number for employee_id which will start from 1000 and increment by 1 20.Write SQL..

  supply a student tester class that tests all methods

Implement a class Student. For the purpose of this exercise, a student has a name and a total quiz score. Supply an appropriate constructor and methods getName( ), addQuiz(int score), getTotalScore( ), and getAverageScore ( ).

  Hash-join algorithm

In this assignment, you will have a chance to implement the hash-join algorithm for a DBMS. You can use C, C++, or Java to write the program. However, your program should include su- cient comments to make it readable. You need to turn in

  Write a java application program called largest.java

Write a Java application program called Largest.java that inputs a series of 10 single-digit numbers and determines and prints the largest of the numbers

  Identify the first character of the name and lengthof length

Write a Java application that stores the names of your family and friends in a one-dimensional array of Strings. The program should show all names in upper case and lower case, identify the first character of the name, and the lengths of the names.

  Document the current application describing major classes

Add to the Project Management tool the different planned activities needed to implement the changes to the solution and document the current application describing the major classes used by the application.

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