answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
pav-90 [236]
1 year ago
8

The establishment called ABC Enterprise requires a Java program to keep a database of the inventory of the products that it sell

s. Each product is identified by its manufacturer, its name, the quantity, and unit price. Note: a manufacturer is characterized by its company’s name and address In addition to storing the information, the program should be able to make updates to the quantity and/or the price as time goes on. That is, when a sale is made, the quantity of that product must be reduced; similarly, when a product is re-ordered, the quantity of that product must be increased. Also, when there is a change in the price of a product, the price must be changed. The change must be interpreted as a replacement of the value. New products may be added to the inventory at any time; also, a product may be removed from the inventory at any time. Maintain a separate list the products that have been deleted from the database of active products.
Your program must be able to produce three kinds of reports, namely:

(a) Locate a single product and display its name, price and quantity alone.

(b) The inventory report should be structured as follows:

Product PurchaseDate Quantity Price Manufacturer State

Telephone 01/20/2013 10 254.99 Motorola FL

Computer 01/06/2013 15 756.99 CBS NY

: : : : : :

: : : : : :

(c) A list of the deleted products should be structured as follows:.

Product Date Manufacturer

Paper reams 01/20/2013 Morgan Jewelry

: : :

In your design, convince yourself that you need a minimum of four classes, not including the test class – Product, Manufacturer, Address, and Database. You may use the class called GetData.java, Listing 1.6 (in the textbook) , for inputting the data. Use a scrollable panes to display your output.
Computers and Technology
1 answer:
Alexandra [31]1 year ago
4 0

Answer:

// GetData.java

import javax.swing.JOptionPane;

public class GetData

{

  public static double getDouble(String s)

  {

      return Double.parseDouble(getWord(s));

  }

  public static int getInt(String s)

  {

      return Integer.parseInt(getWord(s));

  }

  public static String getWord(String s)

  {

      return JOptionPane.showInputDialog(s);

  }

  public static String getString(String s)

  {

      return JOptionPane.showInputDialog(s);

  }

}

// Address.java

public class Address

{

  private String street, city, state, zip;

  public Address(String str, String city, String st, String zip)

  {

      street = str;

      this.city = city;

      state = st;

      this.zip = zip;

  }

  public String getStreet()

  {

      return street;

  }

 

  public String getCity()

  {

      return city;

  }

  public String getState()

  {

      return state;

  }

  public String getZip()

  {

      return zip;

  }

}

// Manufacturer.java

public class Manufacturer

{

  private String companyName;

  private Address companyAddress;

 

  public Manufacturer()

  {

      this.companyName = "";

      this.companyAddress = null;

  }

 

  public Manufacturer(String compName, Address address)

  {

      this.companyName = compName;

      this.companyAddress = address;

  }

 

  public String getCompanyName()

  {

      return companyName;

  }

 

  public void setCompanyName(String companyName)

  {

      this.companyName = companyName;

  }

 

  public Address getCompanyAddress()

  {

      return companyAddress;

  }

 

  public void setCompanyAddress(Address address)

  {

      this.companyAddress = address;

  }

}

// Product.java

import java.text.SimpleDateFormat;

import java.util.Date;

public class Product

{

 

  SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");

 

 

  Manufacturer manufacture;

 

 

  String productName;

 

 

  int quantity;

 

 

  double unitPrice;

 

 

  Date productCreated;

 

 

  public Product()

  {

      this.productName = "";

      this.quantity = 0;

      this.unitPrice = 0.0;

      this.productCreated = null;

      this.manufacture = null;

  }

 

  public Product(String prodName, int quantity, double unitPrice,

                        Date productCreated, Manufacturer manufact)

  {

      this.productName = prodName;

      this.quantity = quantity;

      this.unitPrice = unitPrice;

      this.productCreated = productCreated;

      this.manufacture = manufact;

  }

 

 

  public Date getProductCreated()

  {

      return productCreated;

  }

 

 

  public void setProductCreated(Date productCreated)

  {

      this.productCreated = productCreated;

  }

 

  // to get the Manufacturer object

  public Manufacturer getManufacture()

  {

      return manufacture;

  }

 

  // to set the Manufacturer object

  public void setManufacture(Manufacturer manufacture)

  {

      this.manufacture = manufacture;

  }

 

  // to get the name of the product

  public String getProductName()

  {

      return productName;

  }

 

  // to set the name of the product

  public void setProductName(String prodName)

  {

      this.productName = prodName;

  }

 

  // to get the quantity of the product

  public int getQuantity()

  {

      return quantity;

  }

 

  // to set the quantity of the product

  public void setQuantity(int quantity)

  {

      this.quantity = quantity;

  }

 

  // to get the unit price of the product

  public double getUnitPrice()

  {

      return unitPrice;

  }

 

  // to set the unit price of product

  public void setUnitPrice(double unitPrice)

  {

      this.unitPrice = unitPrice;

  }

 

  // to update the quantity of the product

  public void upDateQuantity(int quantity_upDate)

  {

      quantity += quantity_upDate;

  }

 

  // to update the price of the product

  public void upDatePrice(double price_upDate)

  {

      this.unitPrice = price_upDate;

  }

 

 

  public String getProductInfomation()

  {

      String result = "";

      result += String.format("%-30s", productName);

      String dateForm = sdf.format(productCreated);

      result += String.format("\t %s", dateForm);

      result += String.format("%10d", quantity);

      result += String.format("\t%15.2f", unitPrice);

      result += String.format("\t%15s",

                          manufacture.getCompanyName());

      result += String.format("\t%20s",

                 manufacture.getCompanyAddress().getState());

      return result;

  }  

}

Explanation:

  • Create a manufacturer class to store and get information about company name and company address.
  • Create a product class to hold the manufacturer object, product name and other relevant information.
You might be interested in
It has been said that the quality of our relationships depends in large part on the quality of our
timurjin [86]

Answer:

people

Explanation:

6 0
1 year ago
Monica needs a printer to use at home. She wants fine-quality prints at an affordable cost. Which printer will help her achieve
Keith_Richards [23]

Answer:

alonol printer

Explanation:

5 0
1 year ago
Bill needs to make a presentation in which he has to represent data in the form of a pyramid. Which feature or menu option of a
andreyandreev [35.5K]

Answer:If you need to use arrows in a chart, which feature or menu option of a word processing program would you use?

A.  

Picture

B.  

Shapes

C.  

Clip Art

D.  

SmartArt

E.  

Charts

Explanation:

7 0
2 years ago
You are an ISP. For the Address Block 195.200.0.0/16 a. If you have 320 Customers that need 128 addresses/customer - will there
12345 [234]

Answer:

a. The network will not satisfy the customers because the required addresses is 128 but what can be offered is 126.

b. 195.200.0.0/22

Explanation:

195.200.0.0/16

The number of bits to give 512 is 9

2^9=512

2^8=256 which is not up to our expected 320 customers that requires a network ip

Note we have to use a bit number that is equal or higher than our required number of networks.

The number of host per each subnet of the network (195.200.0.0/25) is (2^7)-2= 128-2=126

The network will not satisfy the customers because the required addresses is 128 but what can be offered is 126.

b. 64 customers requires  6 bits to be taken from the host bit to the network bit

i.e 2^6 = 64

195.200.0.0/22

The number of host per each subnet of the network (195.200.0.0/22) is (2^10)-2=1024 - 2 = 1022 hosts per subnet

This network meet the requirement " 64 customers want 128 addresses/customer "

5 0
1 year ago
Olivia started working last year. By April 15th, she will need to prepare and send the Federal government _____.
omeli [17]
Income tax documents
5 0
1 year ago
Read 2 more answers
Other questions:
  • Rene has secured her wireless network. However, she is worried about securing her router against newfound vulnerabilities. Which
    7·1 answer
  • A(n) ______close to a cover letter leads to more interviews because you are contacting the employer. a. passive b. lengthy c. ac
    11·2 answers
  • What is the formula equivalent to the function =SUM(B1:B5)?
    11·2 answers
  • Use a VLOOKUP function in cell I5 to identify and calculate the federal withholding tax. Use the tax rates from the range D21:E2
    15·1 answer
  • A painting company has determined that for every 115 square feet or wall space, one gallon of paint and eight hours of labor wil
    11·1 answer
  • Locker doors There are n lockers in a hallway, numbered sequentially from 1 to n. Initially, all the locker doors are closed. Yo
    15·1 answer
  • Which method allows a computer to react accordingly when it requests data from a server and the server takes too long to respond
    5·1 answer
  • Which of the following is not true about VOIP?
    9·1 answer
  • Explain why each of the following names does or does not seem like a good variable name to represent a state sales tax rate.
    14·1 answer
  • A signal travels from point A to point B. At point A, the signal power is 100 W. At point B, the power is 90 W. What is the atte
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!