79.1k views
1 vote
1. Create a class for pizzoa , add required attributes where one attribute is Manager_name. Write methods for add item, delete item, and display menu. Hint: you can use array list for menu items.

2. Create application class where you have to create an object of pizzoa class.
3. Assign manager name as your name from application class using object reference.
4. Write a code to display above mentioned menu in application class.
5. Take user input for desired choice of button and using conditional statements (if-else/switch case) call appropriate methods of pizzoa class.
6. On pressing 4 application program should stop running. Hint: use exit()

User Ljk
by
8.2k points

1 Answer

5 votes

Final answer:

To create a Pizzoa class, define the required attributes and methods. In the application class, create an object of the Pizzoa class and assign the manager name. Use conditional statements to call the appropriate methods based on user input.

Step-by-step explanation:

To create a class for a pizzoa, you can define the attributes required for the class such as the manager's name. One way to store the menu items is to use an ArrayList. Below is an example implementation:



import java.util.ArrayList;

public class Pizzoa {
private String managerName;
private ArrayList<String> menuItems;

public Pizzoa(String managerName) {
this.managerName = managerName;
menuItems = new ArrayList<>();
}

public void addItem(String item) {
menuItems.add(item);
}

public void deleteItem(String item) {
menuItems.remove(item);
}

public void displayMenu() {
System.out.println("Menu: ");
for (String item : menuItems) {
System.out.println(item);
}
}
}



In the application class, you can create an instance of the Pizzoa class and assign the manager name using the object reference. Then, you can display the menu and take user input for desired choice of button. Based on the input, you can use conditional statements to call the appropriate methods of the Pizzoa class.

User Ritaban
by
7.4k points