Description
Well done! Your program now keeps excellent track of the Merchant's inventory! In the final stage, you need to add the final touch — users should be able to input sales orders. The inventory must reflect this.
Objectives
To finalize the project, do the following steps:
- The
TabbedPaneshould have a new tab titledCustomer Sale. This tab will allow users to input the sales. It should contain the following elements. Make sure that the names are correct. Otherwise, the tests will fail:JPanelnamedPosTopPanel— it should have oneJLabel(PosInstructionLabel) and twoJRadioButtons(SingleTypeOrderButtonandMixedTypeOrderButton);JPanelnamedSingleTypePanelthat includes oneJComboBox(SingleWineKindBox) and oneJButton(SingleConfirmButton);JPanelnamedMixedTypePanelthat includes twoJComboBoxelements (MixedWineComboBox1andMixedWineComboBox2) as well as oneJButton(MixedConfirmButton);JPanelnamedPosBottomPanelthat includes twoJTextFields(CustomerNameFieldandSaleAmountField), oneJRadioButtonLoyaltyDiscountButton), oneJButton(SubmitOrderButton), and, finally, twoJLabels:SaleMessageLabelandSaleSuccessMessageLabel.
- At this stage, the program prompts users to select whether it is a single type or a mixed sale. A sale includes 12 bottles. If a single type is selected, all 12 bottles will be of the same kind (use
SingleWineKindBoxto have a dropdown selection menu). If it is a mixed type sale, the sale will include six bottles of two different types; the types must be different in this case. The dropdown selection menu for all threeJComboBoxshould contain the options;Rose,Merlot,Sauvignon. SingleTypePanelandMixedTypePanelshould not be visible before selectingSingleTypeOrderButtonandMixedTypeOrderButtonrespectively.CustomerNameField,SaleAmountField,LoyaltyDiscountButton,SubmitOrderButtonshould be disabled before the type of wine is confirmed by selecting wines viaJComboBox.- Once a sale is selected, users should enter the name of the customer and the sales amount. The customer name includes only the first name and starts with a capital letter. The sales amount is numeric. Introduce an option to apply a 15% discount on the price with a
LoyaltyDiscountButton. After pressing on aSubmitOrderButton, your program should check if all of the conditions are met. Should there be an error, it must display a message onSaleSuccessMessageLabel. The message should contain the wordError. - Finally, verify that after selling a box, the inventory reflects the change in the inventory.
Examples
Example 1: the sales type selection
Example 2: customer name & amount input
Example 3: mixed type sales
Example 4: mixed type sales confirmation
Example 5: the order is complete!