Inventory and POS System. Stage 1/5

The inventory manager

Report a typo

Description

To start with, you need to build a simple GUI that allows the wine Merchant to process the incoming orders from suppliers.

The Merchant has been very erratic. It is quite hard for the Merchant to remember how much they paid for the incoming orders. At this stage, you should have a simple program that allows the merchant to input an order, note the supplier's name, and add it to the inventory. There are three varieties of wine: White Sauvignon, Red Merlot, and Rosé Zinfandel. Wine comes in cases, each is 12 bottles, so keep it in mind when calculating the total number of bottles in the inventory.

For example — Merlot, the supplier is Wineotech, the amount is three cases. After this, your program should display a table with the order and the total number of bottles (36 bottles of Merlot).

Objectives

At this stage your program should:

  1. Contain a Swing window with three options (one for each variety of wine).
  2. Once the wine is set, output a second panel which should prompt a separate text box to input the number of cases (minimum 1, maximum 10).
  3. After this, prompt with a text box to enter the name of the supplier.
  4. Display a success message with a JLabel. Call it SuccessLabel.

If you want to pass the tests, name your Swing elements in the following way. You can use the setName() function for this:

  • For the wine varieties, use JRadioButtons and make sure you name them as MerlotButton, RoseButton, and SauvignonButton.
  • Name three JPanels as TopPanel, MiddlePanel, and BottomPanel.
  • Name three labels as InstructionLabel, MessageLabel, and SuccessLabel.
  • Name two JComboBox as AmountComboBox and SupplierComboBox for the dropdown options while populating an order.
  • Name one JTextField as PurchasedPriceTextField where users can input the price for an order.
  • Name one JButton as SubmitButton which can be pressed to input the order.

Design the GUI components as described:

  • The JFrame should be titled "Wine Merchant".
  • The TopPanel should contain InstructionLabel and buttons to select wine varieties; MerlotButton, RoseButton, SauvignonButton, which should be placed within a ButtonGroup so that only one button can be pressed at a time.
  • The InstructionLabel should prompt the user to select a type of wine with the text "Select the type of wine:".
  • The MiddlePanel should contain AmountComboBox, SupplierComboBox and PurchasedPriceTextField.
  • The MiddlePanel should not be visible at first. When the user selects a particular wine type the MiddlePanel should become visible along with all the components within it.
  • The AmountComboBox should have options to select the number of cases of wine (minimum 1, maximum 10).
  • The SupplierComboBox should be set to be editable to allow input of various supplier names. However, the supplier names should be validated to contain only alphabets. This JComboBox should be capable of storing valid input data for future use.
  • The PurchasedPriceTextField should take only numeric values as input. However, they may contain . to signify decimal points.
  • The BottomPanel should contain SuccessLabel, SubmitButton and MessageLabel.
  • The SubmitButton when pressed should evaluate the input data. When the data is correct the MiddlePanel should be set to invisible, the button itself should be disabled, SuccessLabel with the text "Success!" should be shown and MessageLabel with the text "Added n cases of typeofwine from suppliername (n*12 bottles).
  • In case of an incorrect evaluation of input data, MessageLabel should show an error message with the string "Error" in it.
  • Also, keep in mind to clear the input field in AmountComboBox and PurchasedPriceTextField when the SubmitButton is pressed.

Examples

Example 1: wine variety selection

Inventory and POS System app: wine variety selection

Example 2: the amount selection

Inventory and POS System: selecting type of wine, displaying a supplier, and calculating the amount

Example 3: success!

Inventory and POS System: successful wine order

Write a program
IDE integration
Checking the IDE status
___

Create a free account to access the full topic