Most Visionary Leaders in Cloud Revolution, Shaping Tech’s Next Era - 2024 (2...
Y6 mid term (1)
1. Instructions/Notes:
Use of the internet, notes, codes, lab manuals, and flash drives is strictly prohibited.
Plagiarism will result in F grade in lab.
Code must be indented properly, failure to comply will incur a penalty.
________________________________________________________________________________
Question 1: [15 marks]
Write a program that takes as input a number from 1-100, and prints its value in English.
Sample example
Input: 8
Output: eight
Input: 92
Output: ninety two
Note: This question is a time trap! ;) Don’t spend more than 30 minutes on this question.
Question 2: [10 marks]
Write a program that will calculate the price of the ticket based on the age of the customer. The system should
give 50 % discount if the age is greater than equal to 50 and 25% if the age is greater than equal to 30. Base
price for the ticket is Rs. 1500.
Input Checking: Invalid Input would be a number greater than 200 and less than 1. If the user enters invalid
input, display an appropriate message.
Question 3: [15 marks]
Write a program that repeatedly takes integer input from the user one at a time until the user
enters -1, and displays the second largest element. (Note the double quotes in the output).
Sample Example: