-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathReceipt.java
More file actions
45 lines (29 loc) · 979 Bytes
/
Receipt.java
File metadata and controls
45 lines (29 loc) · 979 Bytes
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
package org.codedifferently;
public class Receipt {
// validate coupon code
public boolean validateCoupon(String userCode) {
String validCode = "VIP";
return userCode.trim().equalsIgnoreCase(validCode);
}
// will be using part of customers first name
public String buildReceiptCode(String name, int visitId) {
String cleanedName = name.trim().toUpperCase();
// first 3 letters of name + visit ID
return cleanedName.substring(0, 3) + visitId;
}
public String formatOutput(String text) {
return text.trim().toUpperCase();
}
public static void printReceipt(
String storeName,
int visitId,
String receiptCode,
double[] prices,
double subtotal,
double tax,
double discountAmount,
double total,
double budget
) {
}
}