Programming Marathon 2024
Machine Problems
1. The results of a SSG election between two candidates in senior high school are:
Dela Cruz Delos Santos
ABM 55 65
GAS 25 35
STEM 70 30
TVL 35 46
Write a program that prompts the user for election results, and display output similar
to:
Candidate Votes Percentage
Dela Cruz 185 50.97%
Delos Santos 176 48.75%
2. Create a BingoCard application that displays a traditional bingo card with five columns of five
unique numbers. The column labels are B, I, N, G, and O. Column B contains numbers ranging
from 1 through 15, column I has numbers ranging from 16 through 30, column N has four
numbers ranging from 31 through 45 and a Free Space in the middle of the column, column G
has numbers ranging from 46 through 60, and column O has numbers ranging from 61 through
75. The application output should look similar to:
3. Create a Digits application that prompts the user for a two-digit number and then displays the
ones-place and tens-place digits.
Sample run:
Enter a two digit number:20
Tens Place Digit : 2
One’s Place digit : 0
If the user enters a non-two digit numbers, an invalid input should be displayed.
Hint: use module operator and division operator.
4. In this problem, a Birthday game will be created. The BirthdayGame guesses a player’s birthday
by having the player perform mathematics with the month and day of their birthday. The
number computed by the player is then entered and the program displays the month and day of
the player’s birthday. BirthdayGame is played with one player. The player is given directions
for computing a number that uses the player’s birth month and birth day in the calculations:
1. Determine your birth month (January=1, February=2, and so
on).
2. Multiply that number by 5.
3. Add 6 to that number.
4. Multiply the number by 4.
5. Add 9 to the number.
6. Multiply that number by 5.
7. Add your birth day to the number (10 if born on the 10th and so
on).
BirthdayGame prompts the player for the calculated number and then displays the player’s
birthday. To determine the player’s birthday, 165 is subtracted from the number entered by the
player. This number is then divided by 100. The decimal portion of the quotient represents the
birth month. The remainder of the division is the birth day. The BirthdayGame interface should
consist of steps that tell the user how to calculate the number that needs to be entered. The
player should then be prompted for their number. Finally, the application displays the
player’s birthday.
A sketch of a program run:
5. Create a TimeConversion application that prompts the user for a time in minutes and then
displays the time in hours and minutes. Be sure to consider times whether the number of
minutes left over is less than 10. For example, 184 minutes in hour:minute format is 3:04 (Hint:
use the modulus operator).
The application output should look similar to:
6. Create a Sleep application that calculates the number of hours of your life that you have spent
sleeping. Assume that you sleep 8 hours each night. To simplify the problem, assume that there
are 30 days in each month and 365 days in each year. The application output should look similar
to:
7. Create a Spending application to help examine the spending patterns of a user. The application
should prompt the user for the amount spent last month on food, clothing, entertainment, and
rent, and then displays a table showing the percentage of expenditures in each category. The
application output should look similar to: