Back to the 2020 paper

Module 3: Software Design & Metrics

20207m

A program is to be developed to simulate the operations of a scientific calculator. List the facilities to be provided by this calculator. Analyze this using a DFD 0-level and 1-level diagram.

Worked SolutionAI Assisted

Solution

Facilities for Scientific Calculator

Basic: Addition, Subtraction, Multiplication, Division, %,
Scientific: sin/cos/tan, log/ln, xyx^y, sqrt\\sqrt{}, n!n!, pi\\pi, ee, brackets, DEG/RAD mode, memory (M+/MR/MC), history, error handling (divide by zero).

DFD Level 0 (Context Diagram)

  • External Entity: User
  • Process: 0 - Scientific Calculator System
  • Data Flows: Input Expression / Key Press → System → Result / Error Display
         Input (keys/expression)
User  ─────────────────────►│ 0. Scientific Calculator │─────────────────────► User (Result/Error)
                            │         System           │

DFD Level 1 (Decomposition)

Processes:

  1. 1.0 Accept Input - validate keys/expression
  2. 2.0 Parse & Convert - infix to postfix / syntax tree, handle brackets
  3. 3.0 Compute - ALU + Scientific engine (trig/log/power)
  4. 4.0 Display & Memory - show result, update memory/history

Data Stores:

  • D1 Memory Store (M values)
  • D2 History Log
User → 1.0 Accept Input → 2.0 Parse → 3.0 Compute → 4.0 Display → User
                 ↕                 ↕           ↕
                D2               D1          D2

Description:

  • 1.0 checks valid tokens, prevents illegal sequence.
  • 2.0 handles operator precedence, RAD/DEG conversion.
  • 3.0 calls math library; on error (div/0, domain) routes to error flow.
  • 4.0 formats output, manages M+/MR and history scroll.

This satisfies function-oriented analysis for the calculator simulation program.

Similar questions

Official AppAndroid App

PYQDeck for Android

Solve BEU previous-year exam papers anywhere, anytime. Fast search, offline paper viewing, and step-by-step solutions designed specifically for your phone.