You are on page 1of 5

TK1114 Computer Programming

Lab 4 (L1)
Repetition & Conditional Structure:
Simple Problem Solving
18 October 2016

Name : _____________________________________
Matric Number : _____________________________

TK1114 Computer Programming

Lab 4

FLOORING TILES
Input Standard input
Output Standard output
Topic Arithmetic Expression

Problem Description
The faculty is initiating a drive to upgrade the facilities of the computer laboratory. Your group is
assign to be in charge of the flooring.
Your group task is to determine the dimension of all labs involved. You are also required to write a
program that calculates the number of tiles needed for each lab. The size of the proposed tile is 30cm
x 30cm. Note that there might be a row and a column of tiles that need to be cut so that it can be lay
perfectly.

Input
The first line of input is the number of labs n, where 1 n 20. For each of the following n lines
there are 2 integers, width (cm) (1 width 10,000) and length (cm) (1 length 10,000)
which represent the dimension of the floor for the respective lab.

Output
For each lab, print the number of tiles needed.

Sample Input Output


Sample Input
3
300 300
500 1000
1000 900

Sample Output
100
578
1020

TK1114 Computer Programming

Lab 4

BEN 10+

Input Standard input


Output Standard output
Topic Repetition structure

Problem Description
Write a program that reads a list of positive integers and count the numbers that are larger than 10.

Input
There is only a set of data. The data set consists of a list of positive integer, num (0 < num
100) that ends with -1.

Output
There is only one output for this problem, which is the count of integers that is larger than 10.

Sample Input Output


Sample Input
19
90
32
70
25
42
2
33
62
50
78
4
65
-1

Sample Output
11

TK1114 Computer Programming

Lab 4

MY DATE
Input Standard input
Output Standard output
Topic Conditional structure

Problem Description
You are given the task to compile a list of birthdate of your group member in the following
format:
dd MMM yyyy (e.g. 17 October 1990)
where the value of MMM is a member of list {"January", "February", "March", "April",
"May", "June", "July", "August", "September", "October", "November",
"December"}.
Input
The first line of input is the number of members in your group n, where 1 n 100. For each of the
following n lines there are 3 integers that represent a valid date which is the birthdate of each member
in the format of dd mm yyyy.

Output
For each member, output the birthdate in the following format: dd MMM yyyy
Sample Input Output
Sample Input
2
1 1 2002
31 12 2000

Sample Output
1 January 2002
31 December 2000

TK1114 Computer Programming

Lab 4

WHICH QUADRANT?
Input Standard input
Output Standard output
Topic Conditional structure

Problem Description
Given the coordinates (x, y) of some points in 2-dimensional plane, find out which quadrant
(Q1 - Q4) the points belong to. Some points belong to AXIS if they are located on X-axis or
Y-axis.

Input
The first line contains an integer n (1 n 1000) which determines the number of points.
The following n lines contain two integers which correspond to the coordinates (xi, yi) of each
point (-1000 xi yi 1000).
Output
For each test case, the output contains a line in the format Case #x: S, where x is the case
number (starting from 1) and S is a string that represent the quadrant or axis where the point
belongs.
Sample Input Output
Sample Input
5
0 0
0 1
1 1
3 -3
-2 -5

Sample Output
Case
Case
Case
Case
Case

#1:
#2:
#3:
#4:
#5:

AXIS
AXIS
Q1
Q4
Q3

You might also like