Вы находитесь на странице: 1из 2

College of Computing and Informatics (CCI)

Semester 1, 2019/2020
CSEB113 Principles of Programming
Assignment 1 – Group of 2
Deadline: Tuesday 23rd July 2019, 4.00pm (submit source code to Moodle).
*Important note: Copying is a serious offense and cannot be tolerated, hence zero marks will be given if found so.

1. Write a program to determine the temperature of a room for n days. For each temperature, the program
will display hot if the temperature is more than 30 Celsius, mild if it is between 23 and 29, and cold if it
is below 23. The program also will display the highest, the lowest and the average temperature of that
room for n days.
Sample output:
Enter number of days: 5
Enter Day 1: 23
It's mild.
Enter Day 2: 30
It's hot.
Enter Day 3: 12
It's cold.
Enter Day 4: 38
It's hot.
Enter Day 5: 28
It's mild.

The highest temperature is: 38.00


The lowest temperature is : 12.00
The average temperature is: 26.20

2. Write a program that repetitively reads integer number and print out the number of digits in the entered
number. Your program should only terminate when the user chooses to do so.
Sample output:

Enter number : 154682


The number entered has 6 digit.
Continue (y/n) ? y

Enter number : -4586


The number entered has 4 digit.
Continue(y/n) ? y

Enter number : 0
The number entered has 1 digit.
Continue(y/n) ? n

3. Write a program that determines the day number (1 to 366) in a year for a date that is provided as input
data. As an example, January 1, 1994 is day 1. December 31, 1993 is day 365. December 31, 1996 is day
366 since 1996 is a leap year. A year is a leap year if it is divisible by four, except that any year divisible
by 100 is a leap year only if it is divisible by 400. Your program should accept the month, day and year as
integers.
Rubric for Programming Question (for grading)
Criteria 4 3 2 1
Runtime Executes without Does not execute
errors. due to errors.
Correctness The program works The program The program The program
and meets all of the works and meets works and meets produces all
specifications. most of the only few of the incorrect results.
specifications. specifications.
Code The code is The code is fairly The code is The code is
Readability exceptionally well easy to read. readable only by poorly organized
organized and someone who and very difficult
very easy to follow. knows what it is to read.
supposed to be
doing.
Efficiency Very efficient Efficient Somewhat Not efficient
efficient
Delivery The program was The program was
submitted to the not submitted to
Moodle on time. the Moodle on
time.

Total

Вам также может понравиться