This project is a simple Command Line Application written in Java that randomly assigns chores from a list provided by the user and calculates a reward based on the number of tasks completed. The program demonstrates basic Java programming concepts such as user input, arrays, loops, conditionals, and random number generation.
Many people struggle to decide which chores to do first or how to fairly assign chores among tasks. This program helps solve that problem by randomly generating chores from a list provided by the user. It also calculates a reward based on the number of tasks completed.
The program was designed with the following features:
- Allow users to enter multiple chores separated by commas
- Randomly select chores from the list
- Allow users to define a payment amount per task
- Add a bonus reward if more than one task is assigned
- Display the assigned tasks and the total reward
The main class used in this program is:
- TaskGenerator
- Contains the
mainmethod - Handles user input
- Generates random tasks
- Calculates rewards
- Contains the
Future improvements could separate responsibilities into additional classes such as:
TaskManagerRewardCalculator
This project was developed collaboratively. Responsibilities were divided as follows:
- One partner focused on program logic and calculations
- One partner worked on user input handling and random task generation
- Both partners contributed to testing, debugging, and documentation
This planning stage acted as the blueprint for building the program.
The program successfully implements the following functionality:
- Prompts the user to enter chores separated by commas
- Converts the input string into an array of tasks
- Asks the user to enter:
- Base allowance per task
- Bonus amount for completing multiple tasks
- Randomly selects chores from the list
- Displays the assigned tasks
- Calculates the total reward
- Displays a final reward summary
Originally we planned to allow unlimited dynamic tasks and store them using collections such as an ArrayList. During development, we simplified the implementation by storing the tasks in a String array created from the split input.
We also focused on building everything inside a single class to keep the program easier to understand.
Some challenges during development included:
- Handling user input correctly
- Splitting the chore list into individual tasks
- Understanding how random number generation works
- Managing numeric calculations for rewards and bonuses
- Formatting output correctly using
printf
These issues were solved by:
- Using the
Scannerclass to safely read user input - Using the
split(",")method to convert a string into an array - Using the
Randomclass to select tasks randomly - Using conditional logic (
ifstatements) to apply bonuses - Using formatted printing (
printf) to show currency values clearly
Through debugging and testing, the program was refined until it worked correctly.
Several parts of the program work effectively:
- The random task generation makes the program interactive and dynamic
- The program accepts custom chores from the user
- Reward calculations are clearly displayed
- The command-line interface is simple and easy to use
If we had more time, we would improve the program by:
- Using an
ArrayListinstead of a simple array - Preventing duplicate tasks from being assigned
- Allowing the program to run multiple rounds without restarting
- Creating separate classes for task management and reward calculations
- Adding better input validation
The main Java concepts used in this project include:
- Classes and the
mainmethod Scannerfor user input- Arrays for storing tasks
- The
Randomclass for random task selection forloops to iterate through tasks- Conditional statements (
if) - Variables and primitive data types (
int,double,String) - Formatted output using
System.out.printf
This project helped reinforce several important programming concepts:
- Breaking a problem into smaller logical steps
- Using Java classes from the standard library
- Writing readable and well-commented code
- Debugging logical errors in loops and calculations
- Understanding how user input flows through a program
The project also demonstrated how planning, building, and reflecting in sprints can help organize the development process.
The code contains comments explaining technical decisions, including:
- Why the
Scannerclass is used to collect user input - Why the
Randomclass is used to randomly select tasks - How arrays are used to store tasks entered by the user
- Why loops are used to display tasks
- Why conditional statements determine when bonuses apply
Welcome the TaskGenerator Command Line App!