Professional Documents
Culture Documents
Total
Question 1 2 3
Grade
Weight 35% 35% 30% 100%
Learning Outcomes 6,7,8
Grade
[35 points] Problem 1 – Lazy Johny
Johny is a lazy accountant. His job is to keep record of the dates on which each transaction in his
company was done. Because he’s lazy, he used to write the dates as a numeric value without using
any separators (‘/’ or ‘-‘) and he used to even drop any leading zeros e.g. he used to write 1452020
instead of 14052020 to denote today’s date. Johny was attained by COVID-19 and the company he
works for has hired Jane as a temporary accountant to replace him until he recovers and asked her to
standardize all the date values Johny messed up with. They asked her to replace all the date values
with a properly formatted date value of the form dd/mm/yyyy.
Jane, however, is bad in numbers. Therefore, she turned to you in order to help her. Being a C++
guru, you decided to do this using functions (right?)
Accordingly, write a function that accepts a numeric date and prints it in the correct format. In case
your function can’t tell, print “No idea!”.
Sample run:
Please enter a numeric date value: 14052020
The correct format is: 14/05/2020
Write a program that fills an array of integers using the function created in (1) (you decide upon its
size). Create another array of Booleans having the same size as the one for integers and, using the
function created in (2) fill it such that the ith element in it reflects whether the ith element in the array of
integers is between 70 and 100 or not.
Example:
If your array of integers contains the following values: 78, 64, 88, 91, 44
Then the array of Booleans should be filled with: true, false, true, true, false
Page 2 of 2