Create a cash register application (window builder). The program will display a menu in the fast-food as follows:

Cheeseburger 55.00
Pepsi 25.00
Chips 35.00
Coke 20.00
Fries 45.00
Sundae 40.00
The user will choose an item to purchase. After the user selects an item to purchase, the user will input the quantity of the item and compute the amount due. A tax is deducted from the total amount purchased, which can be senior 10% or PWD 15%, and a service charge of 2% is added. Output should include the product bought, the total amount purchased, discounts, deductions, the amount given, and any changes if any.

Why did the cash register go to the comedy club?

Because it wanted to cash in on some laughs!

To create a cash register application in Window Builder, follow these steps:

1. Create a new Java project in your preferred IDE (e.g., Eclipse, IntelliJ).
2. Add the Window Builder plugin to your IDE. You can find installation instructions for different IDEs on the Window Builder website.
3. Create a new Java class for the main application code, e.g., CashRegisterApp.
4. Use the Window Builder plugin to create a new JFrame form.
5. Design the user interface to display the menu and input fields.
- Add a JComboBox or JList to display the menu options.
- Add a JTextField for the quantity input.
- Add a JButton to calculate the amount due.
- Add JLabels to display the output (product bought, total amount purchased, discounts, deductions, amount given, changes).
6. Implement the necessary logic in the CashRegisterApp class.
- Initialize the menu items and their prices.
- Calculate the amount due based on the selected item and quantity.
- Apply the appropriate tax and service charge.
- Handle user inputs and display the output accordingly.
7. Run the application to test it.

Here's some sample code to help you get started:

```java
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class CashRegisterApp extends JFrame {

private JComboBox<String> menuComboBox;
private JTextField quantityTextField;
private JButton calculateButton;
private JLabel productLabel;
private JLabel totalLabel;
private JLabel discountLabel;
private JLabel deductionLabel;
private JLabel amountGivenLabel;
private JLabel changeLabel;

private String[] menuItems = { "Cheeseburger", "Pepsi", "Chips", "Coke", "Fries", "Sundae" };
private double[] prices = { 55.00, 25.00, 35.00, 20.00, 45.00, 40.00 };

public CashRegisterApp() {
initializeUI();
calculateButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
calculateAmountDue();
}
});
}

private void initializeUI() {
setTitle("Cash Register");
setSize(400, 300);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

JPanel panel = new JPanel();
panel.setLayout(new GridLayout(6, 2));

menuComboBox = new JComboBox<>(menuItems);
quantityTextField = new JTextField();
calculateButton = new JButton("Calculate");
productLabel = new JLabel("Product Bought: ");
totalLabel = new JLabel("Total Amount Purchased: ");
discountLabel = new JLabel("Discount: ");
deductionLabel = new JLabel("Deductions: ");
amountGivenLabel = new JLabel("Amount Given: ");
changeLabel = new JLabel("Change: ");

panel.add(new JLabel("Select Item: "));
panel.add(menuComboBox);
panel.add(new JLabel("Quantity: "));
panel.add(quantityTextField);
panel.add(calculateButton);
panel.add(productLabel);
panel.add(totalLabel);
panel.add(discountLabel);
panel.add(deductionLabel);
panel.add(amountGivenLabel);
panel.add(changeLabel);

add(panel);
}

private void calculateAmountDue() {
int selectedIndex = menuComboBox.getSelectedIndex();
double price = prices[selectedIndex];
int quantity = Integer.parseInt(quantityTextField.getText());
double totalAmount = price * quantity;
double tax;
double serviceCharge;
double deductions;
double amountGiven;
double change;

// Apply discounts based on seniority or PWD
// Assume you have a boolean variable 'senior' and 'pwd' to determine if senior discount or PWD discount is applicable.
// You can add appropriate checkboxes or similar UI elements for the user to select the discount type.
boolean senior = true; // Example: Senior discount is selected
boolean pwd = false; // Example: PWD discount is not selected

if (senior) {
deductions = totalAmount * 0.10;
} else if (pwd) {
deductions = totalAmount * 0.15;
} else {
deductions = 0;
}

tax = totalAmount * 0.12; // Assuming tax is 12%
serviceCharge = totalAmount * 0.02; // Assuming service charge is 2%
amountGiven = totalAmount + tax + serviceCharge;
change = amountGiven - deductions;

productLabel.setText("Product Bought: " + menuItems[selectedIndex]);
totalLabel.setText("Total Amount Purchased: " + totalAmount);
discountLabel.setText("Discount: " + deductions);
deductionLabel.setText("Deductions: " + (tax + serviceCharge));
amountGivenLabel.setText("Amount Given: " + amountGiven);
changeLabel.setText("Change: " + change);
}

public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new CashRegisterApp().setVisible(true);
}
});
}
}
```

Please note that this is a basic example to get you started. You might want to enhance it further based on your specific requirements. Also, make sure to handle potential exceptions and edge cases appropriately.

To create a cash register application using Window Builder, you can follow these steps:

1. Set up your development environment: Install the required software, such as Eclipse IDE and the Window Builder plugin.

2. Create a new Java project: Open Eclipse, go to File -> New -> Java Project, and give it a name.

3. Import the Window Builder plugin: In Eclipse, go to Help -> Eclipse Marketplace, search for "WindowBuilder", and install it.

4. Create a new JFrame class: Right-click on your project -> New -> Other -> Windows Builder -> JFrame -> JFrame (Design). Give it a name, such as CashRegisterApp.

5. Design the user interface: In the WindowBuilder Design view, drag and drop JLabels, JTextFields, JButtons, and other necessary components to create the desired layout for your menu. Set the text and properties for each component accordingly.

6. Add event listeners: Double-click on the button for each menu item to create an event listener. In the listener code, you can retrieve the quantity input by the user, calculate the amount due based on the menu item's price, apply discounts and deductions, and display the results in appropriate labels or text fields.

Here's an example of how the event listener code could look like for the "Cheeseburger" button:

```java
cheeseburgerButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
double price = 55.00;
double quantity = Double.parseDouble(quantityTextField.getText());
double amountDue = price * quantity;
double serviceCharge = amountDue * 0.02;
double totalAmount = amountDue + serviceCharge;
double discount = 0;

// Apply senior discount
if (seniorDiscountCheckBox.isSelected()) {
discount = totalAmount * 0.1;
}

// Apply PWD discount
if (pwdDiscountCheckBox.isSelected()) {
discount = totalAmount * 0.15;
}

double deductions = discount;
double amountGiven = Double.parseDouble(amountGivenTextField.getText());
double change = amountGiven - (totalAmount - deductions);

// Update the labels or text fields with the calculated values
totalAmountLabel.setText("Total Amount: " + totalAmount);
discountsLabel.setText("Discounts: " + deductions);
deductionsLabel.setText("Deductions: " + deductions);
amountGivenLabel.setText("Amount Given: " + amountGiven);
changeLabel.setText("Change: " + change);
}
});
```

Note: Make sure to handle any potential exceptions related to parsing text fields into numbers, and add appropriate error handling and validation to enhance the user experience.

7. Continue adding event listeners for the other menu items, following a similar approach as described in step 6.

8. Build and run the application: Right-click on the CashRegisterApp.java file -> Run As -> Java Application. The cash register application should now open, allowing you to select menu items, enter quantities, and see the calculated results.

Remember to add appropriate labels, text fields, and buttons for other menu items and input fields as needed.

This is a basic example to get you started. You can further enhance the application by adding more features, error handling, and a database or file system to store sales data if required.