1answer.
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]
2 years 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]2 years 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
Descuss the five generations of Computer language
Fiesta28 [93]

Answer:

Explanation:

The programming language in terms of their performance reliability and robustness can be grouped into five different generations, First generation languages (1GL) Second generation languages (2GL) Third generation languages (3GL)

6 0
2 years ago
Which of the threats discussed in this chapter should receive Charlie’s attention early in his planning process?Ethical Decision
ratelena [41]

Answer:

Explanation:

1. Before the discussion at the start of this chapter, how do Fred, Gladys, and Charlie each perceive the scope and scale of the new information security effort? Did Fred’s perception change after that?

Answer:

Before the discussion, Fred, Gladys, and Charlie focused on other ends in regards to information security. Fred was more concerned with adding additional software to fix the malware issues when clearly there were easier steps that need to be taken

2. How should Fred measure success when he evaluates Gladys’ performance for this project? How should he evaluate Charlie’s performance?

Answer:

Gladys’s performance should be based on the new security measures and protocol that she has in place for the organization. This of course, is putting a lot of trust into Charlie’s performance as she was the one to introduce Charlie with his new plan on the organization’s new security. She practically had him nominated for CIO.

3. Which of the threats discussed in this chapter should receive Charlie’s attention early in his planning process?

Answer:

Before considering outside threats, internal threats should be looked into early in the planning process. Internal threats does not necessarily mean that the employees have malicious intent, but the case of human error and failure can also be a negative contribution to cyber security. Creating a security program and education end users by creating a security policy guidance is one of the the best ways to prevent simple cyber security issues from starting

Instead of Charlie being named CISO, suppose instead that Fred hired his son-in-law, an unemployed accountant, to fill the role. Assuming the person had no prior experience or preparation for a job in information security, did Fred make an ethical choice? Explain your answer.

Answer:

Absolutely not! By hiring an unexperienced family member over a trained professional, Fred is letting his emotions get the better of him. Fred should consult with Gladys on whether his son-in-law is good candidate for the position or not. Rather than sacrifice company security, Fred could possibly find his son-in-law a position in the companies’ financial or human resources departments.

8 0
3 years ago
.Why are protocols important for networking?
NNADVOKAT [17]

Answer: Networking protocols are important as they define a set of rules to be used for exchanging information between computer nodes.

Explanation:

in terms of networking it is required for the source and the destination to have a set of predefined rules which enables the router to send and receive information across the network in such as way that both the ends are able to receive the messages.

The information exchange takes place first by the client by introducing itself to the remote server. the remote server upon receiving the information uses some form of handshaking and acknowledges the client of the receipt of the message.

besides this there are many routing protocols which tells us about the way how packets are sent from the client to the source. There are two types of routing protocols:

1. static routing protocols

2. dynamic routing protocols.

6 0
3 years ago
The _ and _ services help us to keep in touch with our family and friends<br><br>​
alexira [117]

Answer:

Internet and communication technology

5 0
3 years ago
In researching his history report about the Civil War, why is Ariq most likely to use secondary data than primary data? Secondar
shusha [124]

Hello! Your answer is....

Secondary data is easier and less time consuming to fine.


I hope this helps, you are very pretty and have an awesome day!

8 0
3 years ago
Read 2 more answers
Other questions:
  • Darnell is preparing to read A Rocket to the Stars for class. What might he predict based on the title?
    6·2 answers
  • Which device or software application detects errors in system configurations?
    8·1 answer
  • You are working on an excel table and realize that you need to add a row to the middle of your table. what is one way to do this
    12·1 answer
  • What Will Social Media Look Like in the Future?
    6·1 answer
  • Which software application offers a variety of templates for creating reports, flyers, and newsletters that you can access withi
    12·1 answer
  • Gaming applications allow users to play solo games as well as play with friends and/or other players
    11·1 answer
  • List out two ways to execute the script.​
    12·2 answers
  • Xavier wants to print the slides of his PowerPoint presentation to practice and make notes but doesn't want to use too much ink
    5·2 answers
  • What are some ways you can give staying off your phone a "boost" and make it easier to do?
    9·1 answer
  • Lenny is working as an apprentice to a typesetter. He has been told to sort different font stamps based on their type. Match the
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!