-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathMain.java
More file actions
88 lines (50 loc) · 2.03 KB
/
Main.java
File metadata and controls
88 lines (50 loc) · 2.03 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
package org.codedifferently;
import java.util.Random;
import java.util.Scanner;
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner( System.in);
System.out.println(" Welcome to Maxx's Boutique");
System.out.println("Enter your name: ");
String name = input.next();
System.out.println("Input budget: ");
double budget = input.nextDouble();;
input.nextLine();
System.out.println("Enter coupon code: ");
String code = input.next();
int idNumber = RandomGen.generateVisitId();
double stateTax = RandomGen.stateTax();
double discountAmt = RandomGen.discountTotal();
double firstItem = RandomGen.itemPrice();
double secondItem = RandomGen.itemPrice();
double thirdItem = RandomGen.itemPrice();
double subTotal = Calculations.subTotalBill(firstItem,secondItem,thirdItem);
double taxTotal = Calculations.calculateTax(subTotal,stateTax);
double total = Calculations.totalBeforeDiscount(subTotal, taxTotal);
discountAmt = Receipt.applyExtraCoupon(discountAmt,code);
double discountedTotal = Calculations.finalTotalBill(total,discountAmt);
double roundedTotal = Calculations.roundedUp(discountedTotal);
Receipt.printReceipt(
name,
code,
idNumber,
discountAmt,
firstItem,
secondItem,
thirdItem,
subTotal,
taxTotal,
roundedTotal
);
double remaining = budget - roundedTotal;
if(remaining >= 0) {
System.out.printf("You have $%.2f left in your budget.%n", remaining);
}
else {
System.out.printf("You are $%.2f over your budget!%n");
}
input.close();
}
}