Past Challenge

Last updated on 28 August 2019

For the Novice

Quadratic Equations

🥺

Task:

Your form two friend, Ali, is currently learning how to solve quadratic equations. Ali knows that you are learning programming and has asked you to create a program that he can use to check if his answers are correct. Both you and Ali know that a quadratic equation is of the form: a^2 + bx + c = 0 and the value of "a" cannot be zero. Ali needs the program to input the three numbers (a, b and c) and produce the solution to the equation i.e. the value(s) of x that makes the equation zero.

In general, the two values of x that solve the equation can be computed as shown in:

Note: (1) When b^2 < 4ac, the equation does not have real solutions and your program should just say "No Real Solutions".

(2) If a = 0, your program should just say "The value of 'a' cannot be zero".

Download Resources for:
#Programming LanguageResources
1Python (all beginners)download
2C++ (optional Computer Science)download

For the Experienced

GPA vs Divisions

🧐

Task:

In 2014, NECTA released the form four (CSEE) results in GPA and class format (as shown in the figure below). This came after they had introduced ā€œB+ā€ and ā€œEā€ grades during the 2013 results.

Your task is to convert the results to the points and divisions format (as shown in the figure below) that we are all familiar with and count students in each division.

A text file "2014-CSEE-S0800.txt" contains the results in GPA format as shown in the figure below. No one got division zero but we have added one division-zero results to ensure you write a complete program.

Note: (1) Points and divisions are calculated from the 7 best grades as shown in the figures below.

(2) In order to get Division IV, a student must have at least 2 Ds or 1 C. This means, for example, that 6 Es and 1 D (i.e. 41 pts) will still be Division 0.

Recommended Tutorials:

C++: C++ STL Map
Java: Java HashMap
Python: Python Dictionary
C++ Advanced Tutorial
Download Resources for:
#Programming LanguageResources
1C++download
2Javadownload
3Pythondownload