Question Details

(Solved) /** * ProductCategory Class */ public class ProductCategory { String categoryName; int productsInStock; double averagePrice; /** * Constructor */


You have been tasked with creating an application that accepts product data and displays this information. The application also computes average sales and shipping charges. Using appropriate control structures, enhance your product class to include the 2 new methods designed in an earlier task.

The computeAverageSales() method should use sentinel-controlled repetition to allow a user to enter product sales data until the user has indicated that he or she is done. The average of the entered sales data will be computed and returned by the method to be displayed by the application. For example, if the user entered 500.50, 250.50, and 300.30, then the average sales would be computed for these 3 values and returned by the method. The prompting of the sales data is done within the method. If the value of the average sales exceeds $200.00, a message should be displayed to alert the user that the product has produced a significant amount of revenue. The computeAverageSales() method should return type "double."

The computeShippingCharges() method should use sentinel-controlled repetition, to allow a user to enter shipping data until the user has indicated that he or she is done. The total shipping charges will be computed and returned as a double value.

Modify your application to call the computeAverageSales() and computeShippingCharges() methods.

As a result of these modifications, the following requirements should be met:

  1. Your application should use the class you created in the earlier tasks. Your class represents one product that your company sells. Your class should have at least 3 attributes (instance variables). Getters and setters for each instance variable should be provided. Attributes should be appropriately typed and scoped to incorporate data hiding. Appropriate constructors should be implemented by each class and called by the application.
  2. The application should provide a user-friendly interface that allows the user to input data for at least 2 instances of your product class.
  3. Data validation should be incorporated at the time of data entry. At least one error-checking condition must be incorporated to allow the user to reenter a data value that is not valid.
  4. Constructors should be called to create instances of your classes once the user has entered valid data. The valid data should be used appropriately by the constructors.
  5. After product information has been entered and displayed, your application should allow the user to compute average sales and shipping charges. The application should call the computeAverageSales() and computeShippingCharges() methods.
    1. There is no limit to the number of orders placed for each product. Using sentinel-controlled repetition, the computeAverageSales() method should allow a user to enter product sales data until the user has indicated that he or she is done. The average of the entered sales data will be computed and returned by the method to be displayed by the application. For example, if the user entered 500.50, 250.50, and 300.30, then the average sales would be computed for these 3 values and returned by the method. The prompting of the sales data is done within the method. If the value of the average sales exceeds $200.00, a message should be displayed to alert the user that the product has produced a significant amount of revenue.
    2. The computeShippingCharges() method should use sentinel-controlled repetition to allow a user to enter shipping data until the user has indicated that he or she is done. The total shipping charges will be computed and returned as a double value. The application will display the computed shipping charges.

Your code should be well commented. Use the following steps to guide your work:

  • Compile all of your pseudocode from the earlier IPs into a design document. Your design document should have a section that includes the functional requirements and any class diagrams used to describe the system. Include any design requirements imposed by your technical leadership.
  • Use NetBeans IDE (Clickhereif you have not installed) to edit, compile and run your Java code.

/**
* ProductCategory Class
*/
public class ProductCategory {
String categoryName;
int productsInStock;
double averagePrice;
/**
* Constructor
*/
public ProductCategory(String cat, int products, double price) {
categoryName = cat;
productsInStock = products;
averagePrice = price;
}
/**
* returns the name of category
* */
public String getCategoryName() {
return categoryName;
}
/**
* returns the products in stock
* */
public int getProductsInStock() {
return productsInStock;
}
/**
* returns the average price
* */
public double getAveragePrice() {
return averagePrice;
}
/**
* sets the name of category
* */
public void setCategoryName(String cat) {
categoryName = cat;
}
/**
* sets products in stock
* */
public void setProductsInStock(int products){
productsInStock = products;
}
/**
* sets average price
* */
public void setAveragePrice(double price){
averagePrice = price;
}
}

 


Solution details:
STATUS
Answered
QUALITY
Approved
ANSWER RATING

This question was answered on: Sep 05, 2019

PRICE: $18

Solution~000200048408.zip (25.37 KB)

Buy this answer for only: $18

This attachment is locked

We have a ready expert answer for this paper which you can use for in-depth understanding, research editing or paraphrasing. You can buy it or order for a fresh, original and plagiarism-free solution (Deadline assured. Flexible pricing. TurnItIn Report provided)

Pay using PayPal (No PayPal account Required) or your credit card . All your purchases are securely protected by .
SiteLock

About this Question

STATUS

Answered

QUALITY

Approved

DATE ANSWERED

Sep 05, 2019

EXPERT

Tutor

ANSWER RATING

GET INSTANT HELP/h4>

We have top-notch tutors who can do your essay/homework for you at a reasonable cost and then you can simply use that essay as a template to build your own arguments.

You can also use these solutions:

  • As a reference for in-depth understanding of the subject.
  • As a source of ideas / reasoning for your own research (if properly referenced)
  • For editing and paraphrasing (check your institution's definition of plagiarism and recommended paraphrase).
This we believe is a better way of understanding a problem and makes use of the efficiency of time of the student.

NEW ASSIGNMENT HELP?

Order New Solution. Quick Turnaround

Click on the button below in order to Order for a New, Original and High-Quality Essay Solutions. New orders are original solutions and precise to your writing instruction requirements. Place a New Order using the button below.

WE GUARANTEE, THAT YOUR PAPER WILL BE WRITTEN FROM SCRATCH AND WITHIN YOUR SET DEADLINE.

Order Now