-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathManagerMenu.java
More file actions
106 lines (98 loc) · 3.46 KB
/
ManagerMenu.java
File metadata and controls
106 lines (98 loc) · 3.46 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package src;
import java.util.*;
/**
* The ManagerMenu class. This class allows managers to print different reports, run the main accounting procedure, or log out
*
* @author Eleri Floyd
* @version 1.0
*/
public class ManagerMenu {
public static Scanner mScan = new Scanner(System.in);
/**
* Allows user to select which report type to print and prompts that report to be printed
*/
public static void selectPrintReports() {
System.out.println("\nWhat type of report would you like to print?\n\n1: Member\t2: Provider\t3: Manager\n");
System.out.println("Choose a selection by entering a number 1-3:");
int reportType = 0;
if (mScan.hasNextInt()) {
reportType = mScan.nextInt();
}
mScan.nextLine();
if (reportType == 1) {
System.out.println("\nEnter member number of member you would like to view.");
String memNum = mScan.nextLine();
int num = 0;
try {
num = Integer.parseInt(memNum);
} catch (NumberFormatException nfe) {
System.out.println("\nMember not found.");
ManagerMenu.main();
}
if (MemberFiles.searchMember(num) == null) {
System.out.println("\nMember not found.");
ManagerMenu.main();
}
Reports.signalMemberReport(num);
}
else if (reportType == 2) {
System.out.println("\nEnter provider number of provider you would like to view.");
String provNum = mScan.nextLine();
int num = 0;
try {
num = Integer.parseInt(provNum);
} catch (NumberFormatException nfe) {
System.out.println("\nProvider not found.");
ManagerMenu.main();
}
if (ProviderFiles.searchProvider(num) == null) {
System.out.println("\nProvider not found.");
ManagerMenu.main();
}
Reports.signalProviderReport(num);
}
else if (reportType == 3) {
Reports.signalManagerReport();
}
else {
System.out.println("\nReport type not found. Please try again.");
ManagerMenu.selectPrintReports();
}
ManagerMenu.main();
}
/**
* Log user out at returns them to the main login menu
*/
public static void logOut() {
Main.enterCredentials();
}
/**
* Main function for manager menu, allows user to select what action they would like to perform
*/
public static void main() {
System.out.println("\nManager Menu: What would you like to do?\n");
System.out.println("1. Print Reports");
System.out.println("2. Run main accounting procedure");
System.out.println("3. Log Out\n");
System.out.println("Choose a selection by entering a number 1-3:");
int command = 0;
if (mScan.hasNextInt()) {
command = mScan.nextInt();
}
mScan.nextLine();
if (command == 1) {
ManagerMenu.selectPrintReports();
}
else if (command == 2) {
Main.runMainAccountingProcedure();
}
else if(command == 3){
ManagerMenu.logOut();
}
else {
System.out.println("\nCommand not found, please try again.\n");
ManagerMenu.main();
}
mScan.close();
}
}