1. Write a method with the following specifications: name: DisplayMenu arguments: none return value: none tasks: display the following menu choice on the screen Calculation Menu 1) Calculate Sum 2) Calculate Sum of Squares 3) Calculate Sum of Cubes 0) To Exit Enter the number that corresponds to your choice: You may beautify the output to your own likings. You don’t have to implement the functionalities of the various menu choices at this stage Call this method from your main.
时间: 2023-07-03 10:10:27 浏览: 223
Sure, here's the method that meets the specifications you provided:
```
public static void DisplayMenu() {
System.out.println("Calculation Menu");
System.out.println("1) Calculate Sum");
System.out.println("2) Calculate Sum of Squares");
System.out.println("3) Calculate Sum of Cubes");
System.out.println("0) To Exit");
System.out.print("Enter the number that corresponds to your choice: ");
}
```
You can call this method from your main method like this:
```
public static void main(String[] args) {
DisplayMenu();
}
```
This will display the menu on the screen when you run the program.
阅读全文