Solved-The goal of this assignment is to practice array of objects Assignment #3- Solution

$30.00 $19.00

Objective: The goal of this assignment is to practice array of objects. Background: El Paso Packaging and Supply Co. has contracted you to create a software to summarize their inventory. The client saves dimensions of packages in the inventory in a text file. While it sounds inefficient, the client is an angel from programmer’s point…

You’ll get a: . zip file solution

 

 
Categorys:
Tags:

Description

5/5 – (2 votes)

Objective: The goal of this assignment is to practice array of objects.

Background: El Paso Packaging and Supply Co. has contracted you to create a software to summarize their inventory.

The client saves dimensions of packages in the inventory in a text file. While it sounds inefficient, the client is an angel from programmer’s point of view. J This is because it is possible to write a program that will directly read from the file and create a summary of the inventory. A sample file is shown below.

20108

4.5 8.45 12.2

8.0 2.5 4.0

1.0 15.0 18.0

3.5 3.5 3.5

6.0 5.0 10.0

That is, each line contains the width, height, and length of a package. The dimensions are separated by spaces.

Assignment: You need to write a program using object oriented programming idea for packages. That is, each package must be considered an object. To achieve this, you must write a class named Package. Make sure to create a Java file for the Package class. Some other required properties of the Package class are as follows.

  1. All status variables of the Package class must be private.

  1. Write no more than two constructors.

  1. Must have a public method named getVolume() that will return the volume of the package.

  1. Must have a public method named isCube() that will return true if the package is cubic, false otherwise.

  1. The Package class must NOT contain any main method.

Feel free to write any additional method in the Package class, as you see fit.

The program file (the Java file that contains the main method) must be written in a file named Runner.java. The Runner class must not have any status variable. Runner must have the following functionalities. Each functionality must be implemented in a separate method in Runner.

  1. Read the input text file provided by the client and create an array of Package objects. The sequence of the lines should be used in the sequence of objects in the array.

  2. Find the largest package in the array. Report the index, dimensions, and volume of the largest object.

  3. How many cubic and non-cubic packages are there in the array?

  1. Report the indices and dimensions of the cubic packages.

  1. Report average volume of cubic packages only.

Deliverables: You are expected to submit two Java files (Package.java and Runner.java) via Blackboard. Your TA will instruct you with further details.