STIA1113-Lab Exercise1-PROBLEM-SOLVING
STIA1113-Lab Exercise1-PROBLEM-SOLVING
SCHOOL OF COMPUTING
STIA1113 PROGRAMMING I
LAB EXERCISE 1
PROBLEM SOLVING
LEARNING At the end of this practical session, you should be able to:
OUTCOMES 1. Solve simple problems using Raptor
DURATION 2 hours
REQUIREMENT Raptor
INSTRUCTION Answer the questions that follow. Submit all your answers through
UUM Online Learning by 3.30 pm on 31 October 2022.
Input:
Quiz 1,Quiz 2,Quiz 3,Test 1,Test 2,Project
Process:
Quizzes percent= 6/100*(quiz1+quiz2+quiz3)
Tests percent= 14/100*(test1+test2)
Project percent= 40/100*(project)
Total = Quizzes percent+ Tests percent+ Project percent
Output:
Display Carry Mark of a student
b) Write algorithm to solve the problem (you need to use both pseudocode and flowchart)
Pseudocode
Start
Input= "Enter Mark for Quiz 1 Below 10"
Get q1
Input= "Enter Mark for Quiz 2 Below 10"
Get q2
Input= "Enter Mark for Quiz 3 Below 10"
Get q3
Input= "Enter Mark for Test 1 Below 25"
Get t1
Input= "Enter Mark for Test 2 Below 25"
Get t2
Input= "Enter Mark for Projects Below 50"
Get p3
Proses=qpercent=6/30*(q1+t2)
Proses=tpercent=14/50*(t1+t2)
Proses=ppercent=40/50*(p1)
Proses=total= qpercent+ tpercent+ ppercent
Output= "Display Carry Mark of a student"+total
End
Problem:
A continuous assessment is adopted in a programming class. The assessments include quizzes,
tests and a project. The students have to take 3 quizzes, 2 tests and a project. The mark for
each quiz is 10 while the mark for each test is 25. A student can score a total of 50 marks for a
project. The quizzes carry 6%; the tests, 14% and project, 40% of the carry mark. Calculate and
display the carry mark of a student based on the following formula:
b) Write algorithm to solve the problem (you need to use both pseudocode and flowchart)
Pseudocode
Start
Input= "Your Motor Speed"
Get ms
If ms>110
Output= "will be issued a RM300
traffic ticket, "
Else
Output= "will be issued a RM300
traffic ticket, "
End
Problem:
The traffic division of a police department will issue a traffic ticket for a motorist accused of speeding. If
a motorist is exceeding the speed limit of 110, then he/she will be issued a RM300 traffic ticket,
otherwise he/she will not be issued the traffic ticket. Determine and display the amount of traffic ticket
based on the motorist speed.
Task 3 – Problem solving 3
Instructions:
a. Problem Analysis (identify input, process, output)
Input:
Age
Process:
If (age>12)
Output:
Ticket Price
b. Write algorithm to solve the problem (you need to use both pseudocode and flowchart)
Pseudocode
Start
Input= "Your Age"
Get age
If age>12
Output= "Ticket Price:rm20 "
Else
Output= "Ticket Price rm10"
End
Problem:
A movie theater charges movie goers based on their age. If the age is above 12, then ticket
price is RM20, otherwise ticket price is RM10. Determine and display the ticket based on user’s
age.
Task 4 – Problem solving 4
Instructions:
a. Problem Analysis (identify input, process, output)
Input:
Year Working,sales
Process:
Output:
Ticket Price
b. Write algorithm to solve the problem (you need to use both pseudocode and flowchart)
Problem:
Every salesperson has a base salary. The salesperson also receives a bonus at the end of each
month, based on the following criteria: If the salesperson has been with the store for five years
or less, the bonus is RM10 for each year that he or she has worked there. If the salesperson has
been with the store for more than five years, the bonus is RM20 for each year that he or she
has worked there. The salesperson can earn an additional bonus as follows: If the total sales
made by the salesperson for the month are at least RM5,000 but less than RM10,000, s
RM10,000, he or she receives a 6% commission on the sale. Calculate the total salary for a
salesperson.