Beginner project · Week 2
Smart Calculator + Guessing Game
Build two logic-driven programs with reusable functions and defensive input handling.
The problem
Conditions, functions, and loops only click once you use them to make real decisions repeatedly, not just read about them.
User stories
- As a user, I want to perform +, -, *, / on two numbers, so I can calculate results quickly.
- As a user, I want a clear error if I divide by zero, so the app never silently breaks.
- As a player, I want higher/lower feedback in the guessing game, so I can narrow down the answer.
Planning checklist
- Decide the calculator's function signature and supported operators
- Decide the guessing game's number range and max attempts
- List every invalid input case for both programs
Suggested data structure
const gameState = {
target: 0,
attempts: 0,
maxAttempts: 8,
guesses: [],
};UI requirements
- Calculator: two number inputs, an operator selector, and a result display
- Guessing game: a guess input, a feedback message, and an attempts counter
Build milestones
Check off each milestone as you complete it — saved to this device.
…
0%Testing checklist
- calculate(4, 0, "/") is handled without crashing
- The guessing game correctly reports higher/lower for at least three guesses
- The game correctly detects a win and a loss (out of attempts)
Completion criteria
…
0%Progressive support
RequirementsPlanningStarterHintsReference Solution
Bonus features
- Add calculator keyboard shortcuts
- Add difficulty levels to the guessing game
- Track and display a best-score streak