-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplication.java
More file actions
59 lines (53 loc) · 1.36 KB
/
Copy pathApplication.java
File metadata and controls
59 lines (53 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package app;
import java.util.Scanner;
/**
* Description of class here.
*
* @author
*
*/
public class Application {
/**
* Constructor for Application class.
*/
public Application() {
// TODO Auto-generated constructor stub
}
/**
* Entry point for the application. This runs until the user exits.
*/
public void run() {
Scanner scanner = new Scanner(System.in);
System.out.println("Welcome to the blog!");
String input;
do {
System.out.print("What would you like to do? Enter HELP ");
System.out.print("for help or press enter/return to quit: ");
input = scanner.nextLine();
if (input.toLowerCase().strip().equals("help")) {
helpMenu();
}
else if (input.length() == 0) {
break;
}
else {
invalidInput();
}
}
while (input.length() > 0);
System.out.println("Thanks for using the blog!");
scanner.close();
}
/**
* Prints out a help menu.
*/
public void helpMenu() {
System.out.println("HELP: prints out a help menu");
}
/**
* Default message for invalid input.
*/
public void invalidInput() {
System.out.println("You entered invalid input.");
}
}