diff --git a/.DS_Store b/.DS_Store
index a70ee6b..d6f6f33 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/.idea/aws.xml b/.idea/aws.xml
new file mode 100644
index 0000000..b63b642
--- /dev/null
+++ b/.idea/aws.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/copilot.data.migration.agent.xml b/.idea/copilot.data.migration.agent.xml
new file mode 100644
index 0000000..4ea72a9
--- /dev/null
+++ b/.idea/copilot.data.migration.agent.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/copilot.data.migration.ask.xml b/.idea/copilot.data.migration.ask.xml
new file mode 100644
index 0000000..7ef04e2
--- /dev/null
+++ b/.idea/copilot.data.migration.ask.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/copilot.data.migration.ask2agent.xml b/.idea/copilot.data.migration.ask2agent.xml
new file mode 100644
index 0000000..1f2ea11
--- /dev/null
+++ b/.idea/copilot.data.migration.ask2agent.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/copilot.data.migration.edit.xml b/.idea/copilot.data.migration.edit.xml
new file mode 100644
index 0000000..8648f94
--- /dev/null
+++ b/.idea/copilot.data.migration.edit.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
index e7cd972..b2320b5 100644
--- a/.idea/encodings.xml
+++ b/.idea/encodings.xml
@@ -1,6 +1,8 @@
+
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index b28c0fb..db528c8 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,14 +1,14 @@
-
+
-
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 36361c6..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/README.md b/README.md
index 9c12bdd..2362803 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,4 @@
+[](https://classroom.github.com/a/6tlCTWq0)
# 🧾 Mystery Receipt Generator (Java CLI Project)
## Overview
diff --git a/src/main/java/org/codedifferently/Main.java b/src/main/java/org/codedifferently/Main.java
index 8a571aa..e9b4056 100644
--- a/src/main/java/org/codedifferently/Main.java
+++ b/src/main/java/org/codedifferently/Main.java
@@ -1,17 +1,65 @@
package org.codedifferently;
-//TIP To Run code, press or
-// click the icon in the gutter.
+import java.util.Random;
+import java.util.Scanner;
+
+
public class Main {
- static void main() {
- //TIP Press with your caret at the highlighted text
- // to see how IntelliJ IDEA suggests fixing it.
- IO.println(String.format("Hello and welcome!"));
-
- for (int i = 1; i <= 5; i++) {
- //TIP Press to start debugging your code. We have set one breakpoint
- // for you, but you can always add more by pressing .
- IO.println("i = " + i);
+ public static void main(String[] args) {
+ // Scanner to add inputs
+ Scanner scanner = new Scanner(System.in);
+ Random random = new Random();
+
+
+ System.out.println("Enter your name please: ");
+ String name = scanner.nextLine();
+
+
+ System.out.println("Enter how much you are spending");
+ double budget = scanner.nextDouble();
+ scanner.nextLine();
+
+
+ System.out.println("Enter coupon code if you have one");
+ String coupon = scanner.nextLine();
+ scanner.close();
+//I called the methods from the other classes to generate the random values and do the calculations
+ int visited = randomMath.visitor(random);
+ double item1 = randomMath.itemPrice(random);
+ double item2 = randomMath.itemPrice(random);
+ double item3 = randomMath.itemPrice(random);
+
+ double subTotal = randomMath.subTotal(item1, item2, item3);
+
+ double taxRate = Math.max(0.05, random.nextDouble() * 0.1);
+ double tax = randomMath.tax(subTotal, taxRate);
+
+ double total = subTotal + tax;
+ total = nameId.couponCode(coupon, total);
+ total = Math.round(total * 100.0) / 100.0;
+
+ String code = nameId.code(name, visited);
+ String tag = nameId.tag(random);
+// I added the print statements to display the reciept and the results of the calculations.
+ System.out.println("Welcome to the winning store : " + name);
+ System.out.println("Your visit ID is: " + visited);
+ System.out.println("Your code for your reciept is: " + code);
+ System.out.println("||||||||||||||||||||||");
+ System.out.println("Item 1: $" + item1);
+ System.out.println("Item 2: $" + item2);
+ System.out.println("Item 3: $" + item3);
+ System.out.println("''''''''''''''''''''''''");
+ System.out.println("Subtotal: $" + subTotal);
+ System.out.println("Tax: $" + tax);
+ System.out.println("Total: $" + (subTotal + tax));
+// I added the if statement to compare the total with the budget and display the appropriate message.
+ if (budget >= total) {
+ System.out.println("Money remaining: $"
+ + (Math.round((budget - total) * 100.0) / 100.0));
+ } else {
+ System.out.println("You are over budget by: $"
+ + (Math.round((total - budget) * 100.0) / 100.0));
}
+ System.out.println("\n" + tag);
}
-}
+}
\ No newline at end of file
diff --git a/src/main/java/org/codedifferently/ReadMe.md b/src/main/java/org/codedifferently/ReadMe.md
new file mode 100644
index 0000000..5dfc3a4
--- /dev/null
+++ b/src/main/java/org/codedifferently/ReadMe.md
@@ -0,0 +1,45 @@
+I made a read random Math file to hold all my math in methods in so that I can all them to main.
+
+
+Then I made a read random String file to hold all my String methods in so that I can call them to main.
+
+
+Then I made a read random main file to call all the methods from the other two files and print the receipt.
+
+I did some math to calculate the subtotal, tax, discounts, and total. I also did some math to calculate the budget remaining or how much the user is short.
+
+I add commits to all my files to explain what each method does and what each part of the code is doing.
+
+
+Enter your name please:
+
+glenn
+
+Enter how much you are spending
+
+50
+
+Enter coupon code if you have one
+
+vip0
+
+Welcome to the winning store : glenn
+
+Your visit ID is: 82656
+
+Your code for your reciept is: GN82656
+
+||||||||||||||||||||||
+
+Item 1: $24.46
+
+Item 2: $12.24
+
+Item 3: $18.47
+
+''''''''''''''''''''''''
+
+Subtotal: $55.17
+Tax: $3.32
+Total: $58.49
+You are over budget by: $2.64
\ No newline at end of file
diff --git a/src/main/java/org/codedifferently/nameId.java b/src/main/java/org/codedifferently/nameId.java
new file mode 100644
index 0000000..05adf33
--- /dev/null
+++ b/src/main/java/org/codedifferently/nameId.java
@@ -0,0 +1,36 @@
+package org.codedifferently;
+
+
+import java.util.Random;
+
+public class nameId {
+ // I added the method to apply the coupon code and calculate the total after the discount is applied.
+ public static double couponCode(String coupon,double total){
+ if (coupon.trim().equalsIgnoreCase("Vip0")){
+ total -= Math.min(10,total*0.1);
+ }
+ return Math.round(Math.abs(total)*100.0)/100.0;
+ }
+//I added the method to generate the code for the reciept using the name and the visit ID.
+ public static String code(String name, int id) {
+ String personName = name.trim().toUpperCase();
+ return personName.charAt(0) + personName.substring(personName.length() - 1) + id;
+
+ }
+// I added the method to generate a random tag for the reciept using the Random class.
+ public static String tag(Random random){
+ int pick = random.nextInt(4);
+ if (pick==0){
+ return "Did you win?";
+ } else if (pick==1){
+ return "Better luck next time!";
+ }
+ else if (pick==2){
+ return "You are a winner!";
+ }
+ else {
+ return "Try again!";
+ }
+}
+
+}
diff --git a/src/main/java/org/codedifferently/randomMath.java b/src/main/java/org/codedifferently/randomMath.java
new file mode 100644
index 0000000..19dc309
--- /dev/null
+++ b/src/main/java/org/codedifferently/randomMath.java
@@ -0,0 +1,25 @@
+package org.codedifferently;
+
+import java.util.Random;
+
+public class randomMath {
+// I added the method to generate a random visit ID using the Random class.
+ public static int visitor(Random random){
+ return random.nextInt(90000)+10000;
+ }
+ // I added the method to generate a random price for each item using the Random class and rounding it to 2 decimal places.
+ public static double itemPrice(Random random){
+ double price = random.nextDouble() * 20 +5;
+ return Math.round(price*100.0)/100.0;
+ }
+ // I added the method to calculate the subtotal by adding the prices of the three items and rounding it to 2 decimal places.
+ public static double subTotal(double a,double b,double c){
+ double subTotal = a+b+c;
+ return Math.round(subTotal*100.0)/100.0;
+ }
+
+ // I added the method to calculate the tax by multiplying the subtotal by the tax rate and rounding it to 2 decimal places.
+ public static double tax(double subTotal, double rate){
+ return Math.round(subTotal*rate*100.0)/100.0;
+ }
+}