From f7e02cb08350bf51b993552540c4b2dc63eb45c6 Mon Sep 17 00:00:00 2001 From: "github-classroom[bot]" <66690702+github-classroom[bot]@users.noreply.github.com> Date: Thu, 5 Feb 2026 21:34:05 +0000 Subject: [PATCH 1/7] add deadline --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9c12bdd..2362803 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +[![Review Assignment Due Date](https://classroom.github.com/assets/deadline-readme-button-22041afd0340ce965d47ae6ef1cefeee28c7c493a6346c4f15d667ab976d596c.svg)](https://classroom.github.com/a/6tlCTWq0) # 🧾 Mystery Receipt Generator (Java CLI Project) ## Overview From bd723880e10a3de26b760db00402a7e545d15a3a Mon Sep 17 00:00:00 2001 From: mkbrown261 Date: Fri, 6 Feb 2026 17:29:54 -0500 Subject: [PATCH 2/7] Mason-Brown-reciept --- .DS_Store | Bin 6148 -> 6148 bytes .idea/encodings.xml | 2 + .idea/misc.xml | 3 +- .idea/modules.xml | 8 --- pom.xml | 4 +- src/main/java/org/codedifferently/Main.java | 26 +++++---- .../codedifferently/recieptcalculator.java | 54 ++++++++++++++++++ 7 files changed, 75 insertions(+), 22 deletions(-) delete mode 100644 .idea/modules.xml create mode 100644 src/main/java/org/codedifferently/recieptcalculator.java diff --git a/.DS_Store b/.DS_Store index a70ee6b3e54c1471cfc4e0c3a1779f6f955424d5..d6f6f331dd3df2b7c348f47612ec48c4d996448f 100644 GIT binary patch delta 48 zcmZoMXfc@JFUrcmz`)4BAi%&-!H~<49Ze(7`s1A}~X2@qKWhn8?K}Z5c9f4Ty TKNv7DZ02FQ%DS1I<1aq|=U^3N 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..5b2ced4 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -5,10 +5,11 @@ - + \ 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/pom.xml b/pom.xml index 24314b9..6a72441 100644 --- a/pom.xml +++ b/pom.xml @@ -9,8 +9,8 @@ 1.0-SNAPSHOT - 25 - 25 + 21 + 21 UTF-8 diff --git a/src/main/java/org/codedifferently/Main.java b/src/main/java/org/codedifferently/Main.java index 8a571aa..e35c1da 100644 --- a/src/main/java/org/codedifferently/Main.java +++ b/src/main/java/org/codedifferently/Main.java @@ -1,17 +1,21 @@ package org.codedifferently; -//TIP To Run code, press or -// click the icon in the gutter. +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!")); + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + System.out.println("Welcome to Durleys Pharmacy!"); + System.out.println("What is your name"); + String name = scanner.nextLine(); + System.out.println("What is your budget:"); + double budget = scanner.nextDouble(); + System.out.println("Enter your 5 digit rewards number"); + double rewardnumber = scanner.nextInt(); + recieptcalculator recieptcalculator = new recieptcalculator(); + System.out.println(recieptcalculator.generatethereceipt()); + - 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); - } } + } diff --git a/src/main/java/org/codedifferently/recieptcalculator.java b/src/main/java/org/codedifferently/recieptcalculator.java new file mode 100644 index 0000000..84958b8 --- /dev/null +++ b/src/main/java/org/codedifferently/recieptcalculator.java @@ -0,0 +1,54 @@ +package org.codedifferently; + +import java.util.Random; + +public class recieptcalculator { + + private int itemid; + private double itemprice; + private double taxrate; + private double tax; + private double item2price; + private double item3price; + public boolean rewardmember; + + public recieptcalculator() { + Random random = new Random(); + itemid = random.nextInt(1000) + 100; + taxrate = random.nextInt((7)) + 3 /100.0; + itemprice = random.nextInt(400) + 19; + item2price = random.nextInt(30) +1; + item3price = random.nextInt(60) +4; + + } + + public double calculatetax() { + return Round((itemprice +item2price + item3price) * taxrate) / 100; + } + public double calculatetotal(){ + + return itemprice + item2price + item3price + calculatetax() + tax; + } + public String generatethereceipt() { + String reciept = ""; + + reciept += "Item ID: " + itemid + "\n"; + reciept += "Price: $" + (itemprice) + "\n"; + reciept += "Price: $" + (item2price) + "\n"; + reciept += "Price: $" + (item3price) + "\n"; + reciept += "Tax rate:" + (taxrate ) + "\n"; + reciept += "Tax:" + calculatetax() + "\n"; + + reciept += "Total: $" + calculatetotal() + "\n"; + reciept += "Total (Rounded):" + Round(calculatetotal()) + "\n"; + return reciept; + + } + private double Round(double valuerounded) { + return Math.round(valuerounded * 100) / 100; + } + + +} + + From dca03f658be636d59f542aaaf8cfad83f6aa8c10 Mon Sep 17 00:00:00 2001 From: mkbrown261 Date: Fri, 6 Feb 2026 17:59:24 -0500 Subject: [PATCH 3/7] added if/else to total and total rounded --- .../codedifferently/recieptcalculator.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/codedifferently/recieptcalculator.java b/src/main/java/org/codedifferently/recieptcalculator.java index 84958b8..488d311 100644 --- a/src/main/java/org/codedifferently/recieptcalculator.java +++ b/src/main/java/org/codedifferently/recieptcalculator.java @@ -10,8 +10,8 @@ public class recieptcalculator { private double tax; private double item2price; private double item3price; - public boolean rewardmember; - + public boolean rewardmember = true; + public double memberpricing; public recieptcalculator() { Random random = new Random(); itemid = random.nextInt(1000) + 100; @@ -38,9 +38,23 @@ public String generatethereceipt() { reciept += "Price: $" + (item3price) + "\n"; reciept += "Tax rate:" + (taxrate ) + "\n"; reciept += "Tax:" + calculatetax() + "\n"; + if (rewardmember==true){ + memberpricing = calculatetotal() / 2; + reciept += "Total: $" + memberpricing + "\n"; + }else { + reciept += "Total: $" + calculatetotal() + "\n"; + } + if (rewardmember == true) { + memberpricing = calculatetotal() / 2; + reciept += "Total (Rounded):" + Round( memberpricing) + "\n"; + }else{ + reciept += "Total (Rounded):" + Round(calculatetotal()) + "\n"; + + + } + + - reciept += "Total: $" + calculatetotal() + "\n"; - reciept += "Total (Rounded):" + Round(calculatetotal()) + "\n"; return reciept; } From 92ba1cbea0ead52c098cd1f285ca17cceac18e3a Mon Sep 17 00:00:00 2001 From: mkbrown261 Date: Fri, 6 Feb 2026 19:21:46 -0500 Subject: [PATCH 4/7] small fixes in calculator class --- src/main/java/org/codedifferently/Main.java | 2 +- .../java/org/codedifferently/recieptcalculator.java | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/codedifferently/Main.java b/src/main/java/org/codedifferently/Main.java index e35c1da..78da22a 100644 --- a/src/main/java/org/codedifferently/Main.java +++ b/src/main/java/org/codedifferently/Main.java @@ -5,7 +5,7 @@ public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); - System.out.println("Welcome to Durleys Pharmacy!"); + System.out.println("Welcome to Masons Tech Emporium!"); System.out.println("What is your name"); String name = scanner.nextLine(); System.out.println("What is your budget:"); diff --git a/src/main/java/org/codedifferently/recieptcalculator.java b/src/main/java/org/codedifferently/recieptcalculator.java index 488d311..1fd6a02 100644 --- a/src/main/java/org/codedifferently/recieptcalculator.java +++ b/src/main/java/org/codedifferently/recieptcalculator.java @@ -10,7 +10,7 @@ public class recieptcalculator { private double tax; private double item2price; private double item3price; - public boolean rewardmember = true; + public boolean rewardmember = false; public double memberpricing; public recieptcalculator() { Random random = new Random(); @@ -37,24 +37,23 @@ public String generatethereceipt() { reciept += "Price: $" + (item2price) + "\n"; reciept += "Price: $" + (item3price) + "\n"; reciept += "Tax rate:" + (taxrate ) + "\n"; - reciept += "Tax:" + calculatetax() + "\n"; + reciept += "Tax:" + calculatetax() + "\n"; if (rewardmember==true){ memberpricing = calculatetotal() / 2; reciept += "Total: $" + memberpricing + "\n"; + }else { reciept += "Total: $" + calculatetotal() + "\n"; } if (rewardmember == true) { memberpricing = calculatetotal() / 2; - reciept += "Total (Rounded):" + Round( memberpricing) + "\n"; + reciept += "Total: $" + " " + "(Rounded):" + Round( memberpricing) + "\n"; + }else{ - reciept += "Total (Rounded):" + Round(calculatetotal()) + "\n"; + reciept += "Total: $(Rounded):" + Round(calculatetotal()) + "\n"; } - - - return reciept; } From 93b54aeab9737744478eaf6677033b57c70cfef4 Mon Sep 17 00:00:00 2001 From: mkbrown261 Date: Sat, 7 Feb 2026 15:39:27 -0500 Subject: [PATCH 5/7] fixed rewardsmember bug --- src/main/java/org/codedifferently/Main.java | 13 +++++- .../codedifferently/recieptcalculator.java | 40 +++++++++++-------- 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/codedifferently/Main.java b/src/main/java/org/codedifferently/Main.java index 78da22a..5481f0d 100644 --- a/src/main/java/org/codedifferently/Main.java +++ b/src/main/java/org/codedifferently/Main.java @@ -4,6 +4,7 @@ public class Main { public static void main(String[] args) { + recieptcalculator recieptcalculator = new recieptcalculator(); Scanner scanner = new Scanner(System.in); System.out.println("Welcome to Masons Tech Emporium!"); System.out.println("What is your name"); @@ -12,8 +13,16 @@ public static void main(String[] args) { double budget = scanner.nextDouble(); System.out.println("Enter your 5 digit rewards number"); double rewardnumber = scanner.nextInt(); - recieptcalculator recieptcalculator = new recieptcalculator(); - System.out.println(recieptcalculator.generatethereceipt()); + if (rewardnumber == recieptcalculator.rewardsmemnum){ + recieptcalculator.rewardmember = true; + System.out.println(recieptcalculator.generatethereceipt()); + } else { + System.out.println(recieptcalculator.generatethereceipt()); + } + + + + } diff --git a/src/main/java/org/codedifferently/recieptcalculator.java b/src/main/java/org/codedifferently/recieptcalculator.java index 1fd6a02..d06621e 100644 --- a/src/main/java/org/codedifferently/recieptcalculator.java +++ b/src/main/java/org/codedifferently/recieptcalculator.java @@ -10,46 +10,53 @@ public class recieptcalculator { private double tax; private double item2price; private double item3price; - public boolean rewardmember = false; + public boolean rewardmember; public double memberpricing; + public int rewardsmemnum = 00000; public recieptcalculator() { Random random = new Random(); itemid = random.nextInt(1000) + 100; - taxrate = random.nextInt((7)) + 3 /100.0; + taxrate = random.nextInt((7)) + 3 / 100.0; itemprice = random.nextInt(400) + 19; - item2price = random.nextInt(30) +1; - item3price = random.nextInt(60) +4; + item2price = random.nextInt(30) + 1; + item3price = random.nextInt(60) + 4; } public double calculatetax() { - return Round((itemprice +item2price + item3price) * taxrate) / 100; + return Round((itemprice + item2price + item3price) * taxrate) / 100; } - public double calculatetotal(){ + + public double calculatetotal() { return itemprice + item2price + item3price + calculatetax() + tax; } + public String generatethereceipt() { String reciept = ""; reciept += "Item ID: " + itemid + "\n"; reciept += "Price: $" + (itemprice) + "\n"; - reciept += "Price: $" + (item2price) + "\n"; - reciept += "Price: $" + (item3price) + "\n"; - reciept += "Tax rate:" + (taxrate ) + "\n"; - reciept += "Tax:" + calculatetax() + "\n"; - if (rewardmember==true){ + reciept += "Price: $" + (item2price) + "\n"; + reciept += "Price: $" + (item3price) + "\n"; + reciept += "Tax rate:" + (taxrate) + "\n"; + reciept += "Tax:" + calculatetax() + "\n"; + recieptcalculator rc = new recieptcalculator(); + Main main = new Main(); + + + if (rewardmember == true) { memberpricing = calculatetotal() / 2; reciept += "Total: $" + memberpricing + "\n"; - }else { + } else { reciept += "Total: $" + calculatetotal() + "\n"; } if (rewardmember == true) { memberpricing = calculatetotal() / 2; - reciept += "Total: $" + " " + "(Rounded):" + Round( memberpricing) + "\n"; + reciept += "Total: $" + " " + "(Rounded):" + Round(memberpricing) + "\n"; - }else{ + } else { reciept += "Total: $(Rounded):" + Round(calculatetotal()) + "\n"; @@ -57,11 +64,12 @@ public String generatethereceipt() { return reciept; } + private double Round(double valuerounded) { - return Math.round(valuerounded * 100) / 100; + return Math.round(valuerounded * 100) / 100; } - } + From 74e35bba343f3babaed1456567fccd85f6ea9171 Mon Sep 17 00:00:00 2001 From: mkbrown261 Date: Sun, 8 Feb 2026 16:25:48 -0500 Subject: [PATCH 6/7] mbrown reciept with readme --- src/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/README.md diff --git a/src/README.md b/src/README.md new file mode 100644 index 0000000..4b0e64a --- /dev/null +++ b/src/README.md @@ -0,0 +1,12 @@ +# Welcome to the overview of my random reciept generator! +here we will be discussing how it works, how to use it and providing example output +This calculator takes in a value for name, budget and if you are a rewards member when prompted. +It then generates a random reciept including tax, tax rate, price of three different items and the price rounded. + + +## How does it work? +Glad you asked. After the system prompts the user for input the reciept calculator class does the heavy lifting. +The random class randomizes all the output. Not before we check to see if the user is a rewards member. if they are they +recieve 50 percent off! let me know what you think! + + From 2ec6031187992a504c676c581e8266974b6597c8 Mon Sep 17 00:00:00 2001 From: mkbrown261 Date: Mon, 9 Feb 2026 09:39:31 -0500 Subject: [PATCH 7/7] fixed spelling of read reciept --- src/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/README.md b/src/README.md index 4b0e64a..872be68 100644 --- a/src/README.md +++ b/src/README.md @@ -1,4 +1,4 @@ -# Welcome to the overview of my random reciept generator! +# Welcome to the overview of my random receipt generator! here we will be discussing how it works, how to use it and providing example output This calculator takes in a value for name, budget and if you are a rewards member when prompted. It then generates a random reciept including tax, tax rate, price of three different items and the price rounded.