-
Notifications
You must be signed in to change notification settings - Fork 0
/
BILLIntf.java
154 lines (138 loc) · 6.02 KB
/
BILLIntf.java
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/**
* BILLIntf
* Interface for the BILL top-level API.
* Last Modified: 10/13/2017
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name of the University of Minnesota nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package main.java.edu.sc.csce740;
import java.util.List;
import main.java.edu.sc.csce740.model.Bill;
import main.java.edu.sc.csce740.model.StudentRecord;
/**
* This defines the interface to the BILL back-end
* processing system.
*
* NOTE: When you implement this interface, it is good practice to create
* your own exceptions for the project. We expect this to be done for this
* project.
*
*/
/**
* Your implementation of this interface must be named BILL
*/
public interface BILLIntf {
/**
* Loads the list of system usernames and permissions.
* @param usersFile the filename of the users file.
* @throws Exception for I/O errors. SEE NOTE IN CLASS HEADER.
*/
public void loadUsers(String usersFile) throws Exception;
/**
* Loads the list of system transcripts.
* @param recordsFile the filename of the transcripts file.
* @throws Exception for I/O errors. SEE NOTE IN CLASS HEADER.
*/
public void loadRecords(String recordsFile) throws Exception;
/**
* Sets the user id of the user currently using the system.
* @param userId the id of the user to log in.
* @throws Exception if the user id is invalid. SEE NOTE IN CLASS HEADER.
*/
public void logIn(String userId) throws Exception;
/**
* Closes the current session, logs the user out, and clears any session data.
* @throws Exception if the user id is invalid. SEE NOTE IN CLASS HEADER.
*/
public void logOut() throws Exception;
/**
* Gets the user id of the user currently using the system.
* @return the user id of the user currently using the system.
*/
public String getUser();
/**
* Gets a list of the userIds of the students that an admin can view.
* @return a list containing the userId of for each student in the
* college belonging to the current user
* @throws Exception is the current user is not an admin.
*/
public List<String> getStudentIDs() throws Exception;
/**
* Gets the raw student record data for a given userId.
* @param userId the identifier of the student.
* @return the student record data.
* @throws Exception if the form data could not be retrieved. SEE NOTE IN
* CLASS HEADER.
*/
public StudentRecord getRecord(String userId)
throws Exception;
/**
* Saves a new set of student data to the records data.
* @param userId the student ID to overwrite.
* @param transcript the new student record
* @param permanent a status flag indicating whether (if false) to make a
* temporary edit to the in-memory structure or (if true) a permanent edit.
* @throws Exception if the transcript data could not be saved or failed
* a validity check. SEE NOTE IN CLASS HEADER.
*/
public void editRecord(String userId, StudentRecord record, Boolean permanent)
throws Exception;
/**
* Generates current bill.
* @param userId the student to generate the bill for.
* @returns the student's bill in a data class matching the I/O file.
* @throws Exception if the bill could not be generated.
* SEE NOTE IN CLASS HEADER.
*/
public Bill generateBill(String userId)
throws Exception;
/**
* Generates a list of transactions for a chosen period.
* @param userId the student to generate the list for.
* @param startMonth the month of the start date.
* @param startDay the day of the start date.
* @param startYear the year of the start date.
* @param endMonth the month of the end date.
* @param endDay the day of the end date.
* @param endYear the year of the end date.
* @returns the student's bill in a data class matching the I/O file.
* @throws Exception if the bill could not be generated.
* SEE NOTE IN CLASS HEADER.
*/
public Bill viewCharges(String userId, int startMonth, int startDay, int startYear,
int endMonth, int endDay, int endYear)
throws Exception;
/**
* Makes a payment for the student
* @param userId the student to make a payment for.
* @param amount amount to apply to the balance.
* @param note a string indicating the reason for the payment
* @throws Exception if the payment fails a validity check
* or fails to save to file.
* SEE NOTE IN CLASS HEADER.
*/
public void applyPayment(String userId, double amount, String note)
throws Exception;
}