Assignment 2-A

Interactive Menu System

Build a complete calculator application with an interactive menu system that demonstrates mastery of control flow including conditionals, switch statements, and all loop types.

4-5 hours
Beginner
175 Points
Submit Assignment
What You'll Practice
  • if-else and nested conditionals
  • switch-case statements
  • for, while, do-while loops
  • Input validation with loops
  • Menu-driven program design
Contents
01

Assignment Overview

In this assignment, you will build a Multi-Function Calculator with an interactive menu system. This project requires you to apply ALL concepts from Module 2: operators, conditionals, and all types of loops to create a professional, user-friendly application.

Standard C++ Only: Use ONLY standard C++ libraries (iostream, iomanip, cmath, limits). No external libraries or platform-specific headers allowed.
Operators (2.1)

Arithmetic, relational, logical operators

Conditionals (2.2)

if-else, switch-case statements

Loops (2.3)

for, while, do-while, break/continue

02

The Scenario

MathWiz Software Solutions

You have been hired as a Junior C++ Developer at MathWiz Software Solutions. Your first project is to create a multi-function calculator for their educational software suite.

"We need a calculator that's more than basic arithmetic. It should have multiple modes - basic math, scientific calculations, number theory tools, and pattern generators. Make sure it handles invalid inputs gracefully!"

03

Requirements

1
Main Menu System

Create a do-while loop menu with switch-case for: Basic Arithmetic, Scientific Calculator, Number Theory, Pattern Generator, Exit.

2
Basic Arithmetic Mode

Implement +, -, *, /, modulus, and power calculation (using loop). Handle division by zero.

3
Scientific Calculator

Square root, logarithm (base 10 & natural), trigonometric functions (degree input), factorial using for loop.

4
Number Theory Tools

Prime check, find primes up to N, palindrome check, GCD (Euclidean algorithm), Fibonacci sequence.

5
Pattern Generator

Right triangle, inverted triangle, number pyramid, diamond pattern using nested loops.

6
Input Validation

Validate ALL inputs using while loops. Use cin.clear() and cin.ignore() for error handling.

04

Submission

Required Repository Name
cpp-menu-calculator
cpp-menu-calculator/
├── calculator.cpp        # Main C++ source file
├── sample_output.txt     # Sample output
└── README.md             # Documentation
05

Grading Rubric

CriteriaPoints
Main Menu System (do-while, switch)20
Basic Arithmetic25
Scientific Calculator25
Number Theory Tools35
Pattern Generator (4 patterns)30
Input Validation20
Code Quality20
Total175