Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA Help! PAPERPRODUCT: PaperProduct keeps track of the type of paper customers can purchase. It contains the SKU number of the product, brand name, paper

JAVA Help!

PAPERPRODUCT:

PaperProduct keeps track of the type of paper customers can purchase. It contains the SKU number of the product, brand name, paper size, weight, paper type, whether the paper uses recycled material, sheets per ream, ream per carton and price per carton. The following are the behaviors of the PaperProduct class:

Default constructor that initializes the attributes to their default values. All String types initialized to null, boolean types initialized to false, and all int and double types initialized to 0 or 0.0, respectively. Use the following signature:

public PaperProduct()

A constructor that accepts the initialization values for the attributes. Use the following signature:

public PaperProduct(String, String, String, double, String, boolean, int, int, double)

A set of methods to return the values of its attributes. Use the following method signatures:

public String getSku()

public String getBrandName()

public String getPaperSize()

public double getWeight()

public String getPaperType()

public boolean getRecycled()

public int getSheetsPerReam()

public int getReamPerCarton()

public double getPricePerCarton()

A set of methods to change the values of its attributes. Use the following method signatures:

public void setSku(String)

public void setBrandName(String)

public void setPaperSize(String)

public void setWeight(double)

public void setPaperType(String)

public void setRecycled(boolean)

public void setSheetsPerReam(int)

public void setReamPerCarton(int)

public void setPricePerCarton(double)

A method that returns the string representation of the PaperProduct. An example string output is (notice the formatting using \t and formatting of the price value):

image text in transcribed

Use the following method signature:

public String toString()

The class can check the equality of an object with another PaperProduct object. This method returns true if every attribute is the same, sku, brandName, paperSize, weight, paperType, recycled, sheetsPerReam, reamPerCarton, pricePerCarton [you can use your get methods to help you compare].

Use the method signature:

public boolean equals(PaperProduct)

PAPERPURCHASE:

This class represents individual purchases made by customers. Each purchase made is recorded through the purchasing company name, the date the purchase was made, the total cartons of the product purchased, the PaperProduct purchased and the total due for that purchase. The following are the behaviors of the PaperPurchase class:

Default constructor that initializes the attributes to their default values. All String and object types initialized to null and all int and double types initialized to 0 or 0.0, respectively. Use the following signature:

public PaperPurchase()

A constructor that accepts the initialization values for the attributes. Use the following signature:

public PaperPurchase(String, String, int, PaperProduct)

Side Note: the totalDue is not initialized by a passed in value, it is calculated by multiplying the total cartons purchased by the price per carton.

A set of methods to return the values of its attributes. Use the following method signatures:

public String getPurchasingCompany()

public String getDatePurchased()

public int getTotalCartonsPurchased()

public PaperProduct getPaperDetail()

public double getTotalDue()

A set of methods to change the values of its attributes. Use the following method signatures:

public void setPurchasingCompany(String)

public void setDatePurchased(String)

public void setTotalCartonsPurchased(int)

public void setPaperDetail(PaperProduct)

A method that sets the totalDue attribute to the calculated product of total cartons purchased multiplied by price per carton. Use the following method signature:

public void calcTotalDue()

A method that returns the string representation of the PaperPurchase. An example string output is (notice the formatting using \t, newline, and formatting of total due):

image text in transcribed

Use the following method signature:

public String toString()

The class can check the equality of an object with another PaperPurchase object. This method returns true if every attribute is the same, purchasingCompany, datePurchased, totalCartonsPurchased, paper, totalDue, [you can use your get methods to help you compare].

Use the method signature:

public boolean equals(PaperPurchase)

PAPERORDER:

This class is used to contain the complete record of all the purchases made. It uses an array to keep the records of paper purchases. The list does not contain duplicates. Define a class named PaperOrder, which has the following behaviors:

A constructor that sets an array of PaperPurchase items with a default capacity of 100 and sets a count variable to 0 to keep track of objects added to the array. Use the signature:

public PaperOrder()

A constructor that sets an array of PaperPurchase items with a given capacity (and initializes count to 0 to keep track of objects added to the array). Use the signature:

public PaperOrder(int)

A method that returns the capacity (i.e., the capacity attribute of the class). Use the method signature:

public int getCapacity()

A method that sets capacity (i.e., the capacity attribute of the class). Use the method signature:

public void setCapacity(int)

A method that adds a PaperPurchase to the PaperPurchase array. Note that the item should only be added to the array if the array is not full. Use the method signature:

public void addPurchase(PaperPurchase)

A method that deletes a PaperPurchase from the PaperPurchase array. Note that you cannot delete from an empty array and you cannot delete a purchase that is not in the array. There should be no hole (empty space) in the orders list. To avoid the hole, there may be a need to shift elements one space to the left. The method returns true if the operation is successful, false otherwise. Use the method signature:

public boolean deletePurchase(PaperPurchase)

A method that checks if the array is empty. Use the method signature:

public boolean isEmpty()

A method that checks if the array is full. Use the method signature:

public boolean isFull()

A method that prints everything out from the array. Use the method signature:

public void printAllOrders()

An example printout might look like this (notice the formatting):

image text in transcribed

A method that prints out only the purchases made by a specific company from the array (based on the passed in String value). Use the method signature:

public void printOrdersbyCompany(String)

An example printout might look like this (notice the formatting):

image text in transcribed

A method that returns the total calculated bill due for a given company based on all their purchases

recorded on the array (company name is passed into the method). Use the method signature:

public double calcTotalDueforCompany(String)

An example returned value based on the above Vance Refrigeration example would be: 4946.50.

Please Help with these 3 in java. Thanks!

SKU: 123333 Brandname: Georgia-Pacific Weight (lbs): 20.0 Paper Type: Printer Sheets per Ream: 500 Reams per Carton: 5 Price per Carton: $33.75 Paper Size: 8.5x11 Recycled: false Purchasing Company: Vance Refrigeration Date Purchased: 2/2/2021 Total Cartons Purchased: 10 Purchase Detail: SKU: 123333 Brandname: Georgia-Pacific Weight (lbs): 20.0 Paper Type: Printer Sheets per Ream: 500 Reams per Carton: 5 Price per Carton: $33.75 Paper Size: 8.5x11 Recycled: false Total Due: $337.50 Purchasing Company: Vance Refrigeration Date Purchased: 2/2/2021 Total Cartons Purchased: 10 Purchase Detail: SKU: 123333 Brandname: Georgia-Pacific Weight (lbs): 20.0 Paper Type: Printer Sheets per Ream: 500 Reams per Carton: 5 Price per Carton: $33.75 Paper Size: 8.5x11 Recycled: false Total Due: $337.50 Purchasing Company: Dwight Schrute's Gym for Muscles Date Purchased: 2/2/2021 Total Cartons Purchased: 3 Purchase Detail: SKU: 123334 Brandname: HP Paper Size: 11x17 Weight (lbs): 25.0 Paper Type: Printer Recycled: false Sheets per Ream: 500 Reams per Carton: 5 Price per Carton: $81.8 Total Due: $245.40 Purchasing Company: Cafe Disco Date Purchased: 2/2/2021 Total Cartons Purchased: 6 Purchase Detail: SKU: 123335 Brandname: Hammermill Paper Size: 13x19 Weight (lbs): 50.0 Paper Type: Printer Recycled: false Sheets per Ream: 500 Reams per Carton: 10 Price per Carton: $230.45 Total Due: $1382.70 Purchasing Company: Vance Refrigeration Date Purchased: 2/3/2021 Total Cartons Purchased: 20 Purchase Detail: SKU: 123335 Brandname: Hammermill Paper Size: 13x19 Weight (lbs): 50.0 Paper Type: Printer Recycled: false Sheets per Ream: 500 Reams per Carton: 10 Price per Carton: $230.45 Total Due: $4609.00 Purchasing Company: Vance Refrigeration Date Purchased: 2/2/2021 Total Cartons Purchased: 10 Purchase Detail: SKU: 123333 Brandname: Georgia-Pacific Weight (lbs): 20.0 Paper Type: Printer Sheets per Ream: 500 Reams per Carton: 5 Price per Carton: $33.75 Paper Size: 8.5x11 Recycled: false Total Due: $337.50 Purchasing Company: Vance Refrigeration Date Purchased: 2/3/2021 Total Cartons Purchased: 20 Purchase Detail: SKU: 123335 Brandname: Hammermill Paper Size: 13x19 Weight (lbs): 50.0 Paper Type: Printer Recycled: false Sheets per Ream: 500 Reams per Carton: 10 Price per Carton: $230.45 Total Due: $4609.00

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Real Time Database And Information Systems Research Advances

Authors: Azer Bestavros ,Victor Fay-Wolfe

1st Edition

1461377803, 978-1461377801

More Books

Students also viewed these Databases questions