logo

Introduction to Computer Science - Algorithms for Problem Solving

11 Pages974 Words222 Views
   

Added on  2023-04-24

About This Document

This document discusses various algorithms for problem solving in computer science. It includes pseudo code algorithms and desk checks for solution algorithms. The algorithms covered include those for calculating commission, computing grade letters, and calculating income tax. The document also includes a bibliography of relevant research on the topic.

Introduction to Computer Science - Algorithms for Problem Solving

   Added on 2023-04-24

ShareRelated Documents
Running head: INTRODUCTION TO COMPUTER SCIENCE
Introduction to Computer Science
Name of the Student
Name of the University
Author’s Note
Introduction to Computer Science - Algorithms for Problem Solving_1
1
INTRODUCTION TO COMPUTER SCIENCE
Solution Algorithm 1:
Defining Problem:
Input Processing Output
Recording transaction
Retail_cost
Transaction_code
Employee_No.
Reading transaction
Calculating commission
Printing details of
transaction
Retail cost
Commission
Employee No.
Pseudo code algorithm:
If the case of solution is not A, B or C then a message is printed and commission set
as 0.
Process transaction record
Read retail_cost, transaction_code and employee_no.
CASE Transaction_Code
A: Commission = retail_cost x 0.06
B: Commission = retail_cost x 0.08
C: Commission = retail_cost x 0.1
Other: Displaying ‘Invalid transaction’, Transaction_code commission = 0
END CASE
Print ‘Retail Price’, retail_cost, ‘Commission’, commission, ‘Employee No.’, Employee_No.
END
Introduction to Computer Science - Algorithms for Problem Solving_2
2
INTRODUCTION TO COMPUTER SCIENCE
Desk check of the algorithm:
1. INPUT:
1st Set of Data 2nd Set of Data
Retail_cost 50$ ABC
Transaction_code A C
Employee_No. 12345 34567
2. Result Expected
1st Set of Data 2nd Set of Data
Commission 3$ ERROR
3. Check Table
Statement No. Retail_Price Transaction_Cod
e
Emloyee_No. Commission
1st Pass
1. 50$ A 12345
2. 3$
3. Print
2nd Pass
1. ABC C 34567
2. ERROR
3. Print
Introduction to Computer Science - Algorithms for Problem Solving_3
3
INTRODUCTION TO COMPUTER SCIENCE
Solution Algorithm 2:
Defining Problem:
Input Processing Output
serial_no. Analyse student record serial_no.
exam_point Computing grade_letter exam_point
Print detailed result grade_letter
Pseudo code algorithm:
Using nested IF framework and CASE statement
Process_student_grade_letter
Read_student_serial_no., student_exam_marks
CASE of grade_letter
HD: exam_marks>84
D: exam_marks>74
C: exam_marks>64
P: exam_marks>59
F: exam_marks<50
ENDCASE
Print student_serial_no., exam_marks, grade_letter
Introduction to Computer Science - Algorithms for Problem Solving_4

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Introduction to Computer Science - Desklib
|10
|1002
|348

Algorithms for Bank Transactions and Calculating Average
|9
|898
|63

Programming
|5
|531
|69

Faculty of Engineering & Technology.
|6
|1286
|200

Faculty of Engineering & Technology.
|6
|1286
|75