Você está na página 1de 3

SCHOOL OF COMPUTING AND INFORMATION TECHNOLOGY

Lab 2 INDIVIDUAL
Modules Information:
Module
Session
Programme
Lecturer
Coursework Type
Hand-out Date
Due Date

CSC 202A C Language & UNIX Operating System


May 2014
AUP
Nor Rahayu binti Ngatirin
Email: norrrahayu.ngatirin@s.newinti.edu.my
Individual Assignment
2 June 2014
2 June 2014

Students Declaration:

I declare that:
I understand what is meant by plagiarism
This lab is all my own work and I have acknowledged any use of the published or
unpublished works of other people.
I hold a copy of this lab which I can produce if the original is lost or damaged
[Name/ID]

_______________________________________

[Signature] _______________________

[Date] _____________________

Learning Outcomes Assessed:


LO1
LO2

Use variables and constants to hold values


Select If Else statement or Switch Case block to make a choice

Lecturers Comments:

Description of Lab:

SCHOOL OF COMPUTING AND INFORMATION TECHNOLOGY


Question 1
Write a program that requests three scores as input and displays the average of TWO (2) highest
scores.
Question 2
Tropical storms are classified as hurricanes based on their wind speeds and storm surges.
Generally, a minimum hurricane is less than 74 miles per hour (mph). A hurricane can be
classified into five categories based on the Saffir/Simpson classification scale as in Table Q2.
Write a program using the following structures that will determine the hurricane category based
on the wind speed in mph.
Category
1
2
3
4
5

Wind Speeds (mph)


74 to 95
96 to 110
111 to 130
131 to 155
Above 155
Table Q2

Question 3
Table Q3 shows the location of books in the library stacks according to their call numbers. Write a
program that requests the call number of a book as input and displays the location of the book.
Call Numbers
100 to 199
200 to 500 and over 900
501 to 900 except 700 to 750
700 to 750
Table Q3

Location
Basement
Main floor
Upper floor
Archives

Question 4
Figure Q4 shows some geometric shapes and formulas for their areas. Using Switch Case
blocks, write a program that requests the user to select one of the shapes, requests the
appropriate lengths, and then gives the area of the figure.
r

Circle
3.142 * r ^ 2

l
Parallelogram
l*h

w
l
Kite
(l * w) / 2

Figure Q4

Question 5
Table Q5 contains information on several states. Write a program that request a state as input
and display the requested information (flower, motto, and nickname). If the state is not in the
table, the program should inform the user.

SCHOOL OF COMPUTING AND INFORMATION TECHNOLOGY


State
California
Indiana
Mississippi
New York

Flower
Golden poppy
Peony
Magnolia
Rose

Nickname
Golden State
Hoosier State
Magnolia State
Empire State
Table Q5

Motto
Eureka
Crossroads of America
By valor and arms
Ever upward

Você também pode gostar