Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

151 changes: 28 additions & 123 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,147 +1,52 @@
# coffee-shop-rewards2

# Coreye’s Coffee Cafe (Triple C’s)
Triple C's

### “Coffee. Code. Consistency.”
## Objective

Welcome to Triple C’s.
Build a Java console application that manages a coffee shop’s menu and a customer loyalty program. You will practice **Object-Oriented Programming (OOP)** by creating custom classes, managing data with loops, and using logic to award free drinks.

We serve:
## Core Requirements

* Strong coffee
* Clean code
* Clear logic
### 1. The `CoffeeItem` Class

You’ve been hired to build the rewards system.
This class represents a drink on the menu.

Don’t let the Bronze-tier customers finesse free drinks.

---

## The Mission

Customers:

* Order items
* Earn points
* Unlock tiers
* Try to redeem rewards

You:

* Build the system
* Keep it organized
* Make sure the math is correct

No arrays.
No lists.
Just solid fundamentals.

---

## 📁 Required Files

```
Customer.java
Purchase.java
Main.java
```

---

# Level 1 — “Open the Shop”

Create a `Customer`.

Fields:

* name
* phoneNumber
* points

Include:

* Default constructor
* Parameterized constructor
* Getters and setters

Create multiple customers.
Let them earn points.
Print their totals.

Nobody starts Gold at Triple C’s.

---

# Level 2 — “Run the Register”

Create a `Purchase` class.

Each item must know:

* itemName
* price
* isDrink

Create at least **6 menu items**.

No arrays.
Just individual object variables.

---

## ☕ Ordering System
* **Attributes:** Name and price.
* **Encapsulation:** Use `private` fields with **Getters and Setters**.
* **Constructor:** Initialize the name and price when a new drink is created.

### 2. The `Customer` Class

The menu must:
This class tracks individual shoppers and their progress toward a reward.

* Display at least once
* Allow customers to choose items
* Determine how points are chosen
* **Attributes:** Name, email, and `drinksPurchased` (an integer).
* **Methods:** * Create a method to increment the drink count.
* Create a method to check if the customer is eligible for a **Reward** (e.g., if they have bought 5 drinks, the next one is free).

Update the customer’s points correctly.

---

# Level 3 — “Status Matters”

Customers unlock tiers:

* Bronze
* Silver
* Gold

Add redemption:

Free Drink = 100 points

If they don’t have enough → deny
If they do → subtract points
### 3. The Shop Logic (`Main.java`)

At the end, print:
This is where your program runs. You should:

Name | Tier | Points

Clean. Clear. Professional.
* **Instantiate Objects:** Create at least three different `CoffeeItem` objects.
* **Control Flow:** Use an `if-else` statement to determine if a customer pays full price or $0 based on their reward status.
* **Loops:** Use a `while` or `for` loop to simulate a "Daily Sales" cycle, allowing multiple customers to buy drinks until the shop closes.

---

# Level 4 — “Make It Feel Like a Real Checkout”

Triple C’s runs smooth.

While the customer is ordering:

* Track their **session total spent**
* Print each item as it’s ordered (like a receipt)

When they finish ordering, print:
## The Challenge

* Session total
* Points earned during this session
* Updated total customer points
1. **The "Golden Ticket":** Add logic so that if a customer spends over $20 in a single transaction, they get a "bonus" point toward their rewards.
2. **Input Validation:** Use a `Scanner` to take user input. Ensure the program doesn't crash if someone enters a negative number or an invalid menu selection.

Make it feel like a real checkout screen.
## Example Output

```text
Welcome to Triple Cs!
Customer: Alex | Drinks toward reward: 4
Alex purchased a Latte ($4.50).
CONGRATS! Reward reached. Next drink is on us!


34 changes: 34 additions & 0 deletions src/main/java/derwinbell/CoffeeItem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package derwinbell;

public class CoffeeItem {
private String itemName;

private double price;



public CoffeeItem(String itemName, double price ){
this.itemName = itemName;
this.price = price;


}

public String getItemName() {
return itemName;
}

public void setItemName(String itemName) {
this.itemName = itemName;
}

public double getPrice() {
return price;
}

public void setPrice(double price) {
this.price = price;
}


}
61 changes: 61 additions & 0 deletions src/main/java/derwinbell/Customer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package derwinbell;

public class Customer {

private String name;

private String phoneNumber;



private int drinksPurchase;

public Customer(){
this("Guest", "000-000-0000", 0);
}

public Customer(String name, String phoneNumber, int drinksPurchase){
this.name = name;
this.phoneNumber = phoneNumber;

this.drinksPurchase = drinksPurchase;


}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getPhoneNumber() {
return phoneNumber;
}

public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}



public int getDrinksPurchase() {
return drinksPurchase;
}

public void setDrinksPurchase(int drinksPurchase) {
this.drinksPurchase = drinksPurchase;
}

public int count(int drinks){
setDrinksPurchase(drinks);

return drinks;
}

public boolean hasReward() {
return this.drinksPurchase >= 5;
}
}
Loading