Académique Documents
Professionnel Documents
Culture Documents
***************************************************
* Date of Examination: (dd/mm/yyyy) *
* Student Name: (your fullname) *
* Student Number: (your roll number) *
* Batch: (your batch) *
* Please select the number for appropriate tasks *
* 1. Quit program *
* 2. Question 2 *
* 3. Question 3 *
* ………… *
* 8. Question 8 *
***************************************************
Question 1
Write a program which will read an integer value for a base,
The base will be bigger than 1 and less than or equal to 10.
Question 2 : Thuyen + Lan
Read in a list of positive numbers until a 0 is encountered.
Write out to the screen:
- the list of numbers to be read
- that list in a descending order
- all the odd numbers in the list
- all the even numbers in the list
- the smallest number in the list
- the biggest number in the list
Question 3 : Thanh
Read in a string of characters.
Write out to the screen:
• the string to be read with the number of words of the string.
For e.g the input string "I'm an Aptechite" has 3 words,
• and the rest letter as integer percentages out of the letter total.
char ch;
while(
( ch = getche() ) != '0'
) {
/* ch is the next character */
}
Question 5 : Phuc
A baby sitter is charged:
• $1.50 per hour until 9:00 pm (while the kids are still up),
• $1.00 per hour between 9:00 pm and midnight,
• and $1.25 per hour after midnight (since late night baby sitting
interferes with morning classes).
Write a program that
• reads the sitter's starting time in hours and minutes
and the ending time in hours and minutes
• and then computes the sitter's fee and output to the screen.
Assume all times are between 6:00 pm and 6:00 am, and hours should be
entered as being between 0 and 12 (inclusive).
Hours outside the range of 0 to 12 should be considered invalid.
The hour 6 should be considered as 6:00 pm, when it is entered as a starting
time.
The hour 6 should be considered as 6:00 am, when it is entered as an ending
time.
The following table may clarify allowed time values for this problem.
Data Input Meaning
Starting Starting Ending Ending Starting Ending
Hour Minutes Hour Minutes Time time
8 0 3 30 8:00pm 3:30am
6 0 0 45 6:00pm 12:45am
12:00am
12 0 6 0 6:00am
(midnight)
Question 6 : Vu
• Program output (to the screen) is the income tax to be paid by the
employee.
Income tax to be calculated according to the following rules:
o Salary S comes up to 5000, no tax to be paid,
o For the salary portion from 5001 to 10000, 10% is paid for
income tax,
o For the salary portion from 10001 to 20000, 15% is paid for
income tax,
o For the salary portion above 20000, 20% is paid.
---o0o---