Home » JAVA Programming

JAVA Programming

Submission Guidelines

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

READ ALL SPECIFICATIONS. You only need to create one Java program for this assignment using Eclipse.

Overview

There are two main parts to this assignment.

1. Write a project and package that contains definitions for the Pet class and the Procedure class (see below for specifications).

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

2. Write a project and package that unit tests the Pet and Procedure classes. You will have to import the package that has the definitions of the Pet and Procedure classes.

Part 1 – Class Specifications

Class – Pet

Store in project/package: <your last name>.bcs345.hwk.vet.business

Member Variables (all private)

Variable Data Type Description
Name String Contains the name of the pet.
Species String Contains the pet’s species.
Gender String Contains the pet’s gender.

Member Method Signatures and Descirptions (all public)

Signature Description
Pet() Default constructor. Sets the values of each member variable to a default value.
Pet(String name, String Species, String gender) Constructor. Sets the values of each member variable to the corresponding parameter values.
Get/Set methods Write get/set methods for all member variables.
void Read(Scanner s) Read the contents of all member variables from the given instance of Scanner. Assume the following:

1. Scanner is already open.

2. Member variable values are on separate lines.

void Write(PrintStream ps) Write the contents of all member variables to the given instance of PrintStream. Assume the PrintStream is already open and ready to use. Data should be written on to separate lines. DO NOT ADD ANY DESCRIPTIVE TEXT IN THE OUTPUT. JUST PRINT THE VALUES.

IMPORTANT – Whatever data is written out should be readable by the Read method of this class. If descriptive text is added then Read will not work.

String GetJSON() This method should return a string using JSON formatting (www.json.org). Here is the format:

{ “variable name” : value, … }

Each variable name should be surrounded by quotes. If the variable data type is String then the value should be surrounded by double quotes. There should be a comma between each <variable name, value> pair (no comma after the last <variable name, value> pair).

Example (Snickers, dog, male):

{“name” : “Snickers”, “species” : “dog”, “gender” : “male”}

Example (Princess, cat, female):

{“name” : “Princess”, “species” : “cat”, “gender” : “female”}

@Override

String toString()

This method should return a String instance (not print on the screen) that contains the values of member variables with descriptive text. Here is an example of a string that gets returned from the method.

Example date string:

Name: Snickers

Species: dog

Gender: male

Class – Procedure

Store in project/package: <your last name>.bcs345.hwk.vet.business

Member Variables (all private)

Variable Data Type Description
Name String Name of the procedure.
Price double Price of the procedure.

Member Method Signatures and Descirptions (all public)

Signature Description
Default Constructor Default constructor. Sets the values of each member variable to a default value.
Constructor – Two Parameters Constructor that sets the values of the member variables. There should be a corresponding parameter for each member variable.
Get/set methods for all member variables
void Write(PrintStream ps) Write the contents of all member variables to the given instance of PrintStream. Assume the PrintStream is already open and ready to use. Data should be written on to separate lines. DO NOT ADD ANY DESCRIPTIVE TEXT IN THE OUTPUT. JUST PRINT THE VALUES.

IMPORTANT – Whatever data is written out should be readable by the Read method of this class. If descriptive text is added then Read will not work.

void Read(Scanner s) Read the contents of all member variables from the given instance of Scanner. Assume the following:

1. Scanner is already open.

2. Member variable values are on separate lines.

String GetJSON() This method should return a string using JSON formatting (www.json.org). Here is the format:

{ “variable name” : value, … }

Each variable name should be surrounded by quotes. If the variable data type is String then the value should be surrounded by double quotes. There should be a comma between each <variable name, value> pair (no comma after the last <variable name, value> pair).

Example :

{“name” : “Rabies Shot”, “price” : 25.5}

@Override

String toString()

This method should return a String instance (not print on the screen) that contains the values of member variables with descriptive text. Here is an example of a string that gets returned from the method.

For example:

Name: Rabies Shot

Price: $25.50

Class – Main

Store in project/package: <your last name>.bcs345.hwk.vet.presentation

Member Variables (all private)

Variable Data Type Description
No member variables

Member Method Signatures and Descirptions (all public)

Signature Description
public static void main(String args[]) Write unit testing and other code in main. See below for details.

Automated Test

Use the Automated Testing slides on Blackboard as a guide when coding this section.

Create an automated test in main.

1. There should be unit tests of ALL get/set methods of both classes. GetJSON is NOT included here.

2. You need to write code that runs the other methods that are not being unit tested on each class (this includes GetJSON, constructors, Read, Write, toString etc…).

The automated test should contain code that demonstrates that ALL methods work on both classes. DO NOT TAKE THE TESTING CODE LIGHTLY. IT IS VERY IMPORTANT TO SHOW THAT EVERYTHING ON EACH CLASS WORKS.

Hint: To truly test if the output produced by the Write method of either class works you need to try and read in the file that it class generates with its Read method. For example, assume you write data to a file named “abc.txt” using the write method. You should now use “abc.txt” file as input to the read method. If the program fails on this read there is an error.

Deliverables

One winzip file containing all Eclipse projects necessary to run the program.

Project Description
<your last name>.bcs345.hwk.vet.business This project should contain a package named <your last name>. bcs345.hwk. vet.business. Create the package under the src directory in the project. This package contains the implementation for the program (Java class files).
<your last name>.bcs345.hwk.vet.presentation This project should contain a package named <your last name>. bcs345.hwk. vet.presentation. Create the package under the src directory in the project. This package contains the implementation for the program (Java class files).

Contains the test program that imports and uses the business package you created. The test program should be an automated test as described above.

Example Project/Package Setup:

hoskey.bcs345.hwk.vet.business Project

hoskey.bcs345.hwk.vet.business Package

Pet.java Source file

Procedure.java Source file

hoskey.bcs345.hwk.vet.presentation Project

hoskey.bcs345.hwk.vet.presentation Package

Main.java Source file

Pet File Format

PetName

PetSpecies

PetGender

Pet Sample Input File (Pet.txt)

Snickers

Dog

Male

Procedure File Format

ProcedureName

ProcedureCost

Procedure Sample Input File (Procedure.txt)

Rabies Shot

25.50


Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
Live Chat+1 763 309 4299EmailWhatsApp

We Can Handle your Online Class from as low as$100 per week