0% found this document useful (0 votes)
20 views

Course Title Course Code Lab Work No Learning Objectives

This document provides instructions for two programming exercises. The first asks students to write a program that accepts a username from the keyboard and checks if it matches the owner's name, displaying an error if not. The second asks students to write a program that accepts two integers from the user and performs a mathematical operation selected by the user from a menu of options. The document also includes an exercise to write a program that handles a savings account withdrawal, displaying the new balance or an error. It provides additional bonus exercise to modify the withdrawal program to allow checking balances, deposits and withdrawals with the current balance displayed after each. Students are instructed to present their solutions using tools like PAC, structure charts, IPO charts, algorithms, flowcharts and C
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Course Title Course Code Lab Work No Learning Objectives

This document provides instructions for two programming exercises. The first asks students to write a program that accepts a username from the keyboard and checks if it matches the owner's name, displaying an error if not. The second asks students to write a program that accepts two integers from the user and performs a mathematical operation selected by the user from a menu of options. The document also includes an exercise to write a program that handles a savings account withdrawal, displaying the new balance or an error. It provides additional bonus exercise to modify the withdrawal program to allow checking balances, deposits and withdrawals with the current balance displayed after each. Students are instructed to present their solutions using tools like PAC, structure charts, IPO charts, algorithms, flowcharts and C
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

COURSE TITLE

Program Logic Formulation

COURSE CODE

ICT1101

LAB WORK NO

LEARNING OBJECTIVES
Introduce to students Decision Logic Structure.
LEARNING OUTCOME
Students should able to prepare the tools: PAC, Structure Chart, IPO Chart, algorithm and
flowchart for single IF-THEN and IF-THEN-ELSE instruction.
You should present your solution in PAC, Structure Chart, IPO Chart, algorithm, flowchart, data
dictionary and C++ coding for the following exercises.
DESCRIPTION OF THE LAB SESSION
Tutorial 1
This program accepts string from the keyboard and decide if the username correctly matched the
owners name. If its not matched, display an error message.
Save it as Week7Tutorial_1.cpp
Tutorial 2
Write a program that asks the user to enter two integers, and then perform mathematical
operation based on users decision. The decision must be a single character input. It should
handle 5 operation: add, subtraction, multiplication, division and power of 2. For every operation,
it should display the result, and if theres invalid input; an error message Invalid user input
should appear.
(i)
You must use if-then-else statement.
(ii)
Make sure the program also works if the user enter small OR capital letter.
Save it as Week7Tutorial_2.cpp
Sample output

Exercise 1
Write a program to handle a savings-account withdrawal. The program should request the current
balance and the amount of the withdrawal as input and then display the new balance. If the
withdrawal is greater than the original balance, the program should display Withdrawal denied;
otherwise calculate and display the new balance.
Present your solution in (with MS Word save as Balance.docx and CPP file as Week7Ex1.cpp):
a) PAC
b) Structure Chart
c) IPO chart
d) Algorithm
e) Flowchart
f) Data dictionary.
Sample Output

Exercise 2 (Bonus Question)


******************************************************************************
This question is an additional question specially made for those who want to polish their
programming skills. If you wish to do this, you just need to complete the C++ code; you dont

have to prepare the diagram. I would suggest for all to try and do this. Ill post the answer in
content Week 8.
Save it as Week7Ex2.cpp
******************************************************************************
(i)
From the question above, modify the program; so it should accept input for check
balance, deposit more money and withdraw money from their bank. For every decision
from user, it should display the current balance available.
Sample output

Deadline: Submit your work on Thursday 8th September 2015 before 17:00:00 GMT +8

You might also like