In this project, you will build a command-line Java application that generates a randomized receipt based on user input and randomly generated values.
Each time the program runs, the receipt should be slightly different.
This project is designed to help you practice core Java fundamentals while thinking critically about program structure, logic, and object responsibility.
By completing this project, you will demonstrate your ability to:
- Use variables and methods correctly
- Collect user input using
Scanner - Generate random values using the
Randomclass - Perform calculations using the
Mathclass - Manipulate and validate text using the
Stringclass - Use conditionals (
if / else) to control program flow - Organize logic across multiple classes
You must follow these rules:
-
Your project must include at least 2 Java classes
- One class must contain the
mainmethod - At least one additional class must be created by you
- One class must contain the
-
Keep all classes simple and focused
-
Use only Java concepts you have learned so far
- Variables
- Methods
ScannerRandomMathString- Conditionals (
if / else) - Basic object creation (
new ClassName())
- Go to the GitHub repository for this assignment
- Click the Code button
- Copy the HTTPS link
Open your terminal and run:
git clone <PASTE_REPO_URL_HERE>Then move into the project folder:
cd java-receipt-generatorYou must work on your own branch, not main.
Create a new branch using your name:
git checkout -b yourname-receiptExample:
git checkout -b alex-receiptTo confirm you’re on the correct branch:
git branchThe branch with the * is your active branch.
Your submission must include:
-
Your completed code on your branch
-
At least 3 meaningful commits
-
A completed README with:
- How It Works
- Sample Output
- Java Concepts Used
Do not merge into main unless instructed.
Your commits should:
- Represent real progress
- Have clear messages
- Be spaced throughout your work (not one giant commit)
Examples of good commit messages:
Set up project structureAdd receipt calculationsImplement discount logicFormat receipt output
This workflow mirrors how developers work on real teams:
- You don’t code directly on
main - You work in branches
- You commit progress clearly
This is portfolio behavior, not just an assignment.
Your program must ask the user for:
- Their name
- Their budget (double)
- A coupon code (String)
Be careful when mixing numeric and text input.
Your program must generate random values for:
- A visit ID (example range: 1000–9999)
- Three item prices (you decide realistic ranges)
- A tax rate, fee, or discount trigger
Each program run should produce different results.
Your program must:
- Calculate a subtotal
- Calculate tax
- Apply discounts or fees
- Calculate a final total
- Round all monetary values to two decimal places
You must also use at least one additional Math method besides rounding.
Examples:
Math.absMath.maxMath.minMath.ceilMath.floorMath.pow
You must use at least three different String methods.
Your program should:
- Validate coupon codes case-insensitively
- Build a receipt code using part of the user’s name
- Format text output (uppercase, trimming spaces, etc.)
Examples of allowed methods:
equalsIgnoreCasesubstringcharAtlengthtoUpperCasetrim
You must create at least five methods (not counting main).
Rules:
- At least two methods must return a value
- At least one method must accept a String
- At least one method must accept a Random
- Each method should have one clear responsibility
Ask yourself:
“If I had to explain this method to someone else, could I describe its job in one sentence?”
Your program must print a clear, readable receipt that includes:
- Store name (your choice)
- Visit ID and receipt code
- Item prices
- Subtotal, tax, discounts, and total
- Budget remaining or how much the user is short
Formatting matters — your output should be easy to read.
Choose at least TWO of the following OR invent your own:
- A “lucky visit” bonus based on the visit ID
- A random “mystery fee” or “mystery discount”
- A VIP coupon that only works randomly
- A receipt tagline generator (random message)
- A receipt “rating” (1–5 stars) that affects pricing
- Budget-based warning messages
You will be graded on thoughtfulness and logic, not complexity.
- Multiple
.javafiles - Program runs without crashing
- Meets all project requirements
You will be evaluated on:
- Proper use of Scanner
- Meaningful use of Random
- Correct Math calculations and rounding
- Effective use of String methods
- Clean method design
- Logical class organization
- Output readability
- Creativity and effort