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
For Internet Protocol (IP) v6 traffic to travel on an IP v4 network, which two technologies are used
qaws [65]

Answer:

These technologies are: Dual Stack Routers, Tunneling, and NAT Protocol Translation.

Explanation:

Dual Stack Routers -  This is the process in which a router’s interface is attached with IPv4 and IPv6 addresses

Tunneling -Tunneling is used as a medium to help the different IP versions  communicate with the transit network.

NAT Protocol Translation -  This helps the IPv4 and IPv6 networks communicate with each other since they do not understand the IP addresses of each other since, they are different IP versions.

3 0
2 years ago
You can include up to _____ logical conditions in the and function.
Margaret [11]
You can include up to 255 logical conditions in the AND function. This is to test multiple<span> conditions at the same time.
</span><span>The syntax of the AND function is the following: =AND (logical1, [logical2], ...)</span><span>
The AND function can be true (one) and false (null), only one of these two values.
</span><span>The AND function will return #VALUE if no logical values are found or created during evaluation.</span>
5 0
3 years ago
BITS wants to store information about the supervisors, including their supervisor number and the relationship to consultants. Su
Olin [163]

Answer:

Convert the table into normalize form

Explanation:

Un normalized relation of the given schedule is as

Consultant ( ConsultNum, Last Name, First Name, Street, City, ZipCode

HoursRate (SupervisorNum, Supervisor Num)

(Tasks, Description, Catagory, Price, SupervisorNum))

According to these functional dependencies :

SupervisorNum is dependencies of the SupervisiorNum

ConsltNum is dependencies of the Last Name, First Name, Street, City, ZipCode, Hours, Rate

Tasks are dependencies of Description, Category, Price

The consultant table is not in a normalized form as it contains repeating groups. Make composite keys such as Supervisor Num, Tasks and ConsltNum and convert the table in NF by removing repeating groups

Such as table in NF

Consultant

(Consult Num, Last Name, First Name, Street, City, Zip Code, Hours, Rate

Supervisor Num, Supervisor Name, Tasks, Description, Category, Price)              

5 0
2 years ago
Write a method maxMagnitude() with two integer input parameters that returns the largest magnitude value. Use the method in a pr
klio [65]

Answer:

See the code snippet below

Explanation:

import java.util.Scanner;

public class LabProgram{

     public static void main(String[] args){

          Scanner scan = new Scanner(System.in);

          System.out.println("Please enter first number: ");

          int firstNumber = scan.nextInt();

          System.out.println("Please enter second number: ");

          int secondNumber = scan.nextInt();

          maxMagnitude(firstNumber, secondNumber);

}

     public static int maxMagnitude(int firstValue, secondValue){

         System.out.println(Math.max(firstValue, secondValue));

}

}

6 0
3 years ago
Which header will be the largest?<br><br> Hello<br><br> Hello<br><br> Hello<br><br> Hello
geniusboy [140]

Answer:  

Bye

bye

bye

bye

Explanation:

4 0
2 years ago
Read 2 more answers
Other questions:
  • Weber believed that there is an inevitable destructive quality to which one of the four types of action?
    8·1 answer
  • Help me plase will give brainliest
    12·2 answers
  • Design the logic for a program that allows a user to enter 20 numbers, then displays each number and its difference from the num
    13·1 answer
  • What is the other name of the horizontal column graph
    9·1 answer
  • What was the first computer programming language?
    7·2 answers
  • Choose and explain, step by step, one method of backing up student files either manually or using a cloud service.
    10·1 answer
  • Cuales son las paginas web​
    12·1 answer
  • SOMEONE PLEASE HELP ME WITH THIS PLEASE HELP ME PLEASE!!!!!!
    6·1 answer
  • Information about www
    14·1 answer
  • you are investigating the use of website and url content filtering to prevent users from visiting certain websites. which benefi
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!