ASSIGNMENT-3
CC112-Object Oriented Programming
Spring-2025
Due Date: March 19, 2025
Submit through email.
Total Questions = 15
• Solve the assignment yourself.
• Don't try to have help from any source.
• Discuss with your fellows to have guidance, but don’t try to get copy of the solution.
• On March 20, 2025, Quiz 1 and 2 will be there based on the learning from Assignments #1, #2, and #3.
• Be dedicated, be sincere to your study and career.
• Wish you all the best.
•
What programming constructs will be used?
IF statement, Loop (Think yourself)
Q# Problem Statement
Number Guessing Game
Write a program where the computer randomly selects a number between 1 and 100. The player has to guess the number. After each
1
guess, the program should tell the player whether their guess is too high, too low, or correct. The game continues until the player guesses
the correct number.
Rock, Paper, Scissors Game
Write a program that lets a player play Rock, Paper, Scissors against the computer. The computer randomly chooses "Rock", "Paper",
or "Scissors". The player enters their choice. The program determines and displays the winner based on the rules:
2 • Rock beats Scissors
• Scissors beats Paper
• Paper beats Rock
The game should repeat until the player decides to stop.
Even-Odd Race
Two players take turns selecting numbers between 1 and 10. The first player tries to reach an even sum first, while the second player
3 tries to reach an odd sum first. The game continues until a player reaches their target sum (even or odd) at or above 50. The program
announces the winner.
Ladder Climbing Game
Two players start at position 0. They take turns rolling a die (random number between 1 and 6). Each roll moves them forward by the
4
number they roll. The first player to reach position 30 wins. The program should display the current positions after each roll.
Lucky Seven Game
The player starts with a certain amount of money (e.g., $100). In each round, they bet some money and roll two dice.
• If the sum of the dice is 7, they win double their bet.
5
• Otherwise, they lose their bet.
The game continues until the player runs out of money or decides to quit.
Sum to Target
The player keeps entering numbers, and the program adds them together. The goal is to exactly reach a target sum (e.g., 100). If the sum
6 exceeds the target, the player loses. The game continues until the player reaches the exact sum or exceeds it.
Dice Rolling Game
The player and computer roll a die (random number 1-6). Whoever gets the higher number wins that round. The game runs for 10
7
rounds, and the player with more wins at the end is declared the champion.
Reverse Counting Race
8 Two players start from 100 and take turns choosing a number between 1 and 10 to subtract. The first player to reach exactly 0 wins.
Guess the Secret Code
The program generates a random 3-digit number (e.g., 472). The player keeps guessing until they match the number. The program
provides hints:
9 • "Higher" if the guess is too low
• "Lower" if the guess is too high
• "Correct!" when the number is guessed
Multiplication Challenge
The program generates random multiplication problems (e.g., 5 x 7). The player answers, and the program checks if it's correct. The
10
game continues for 10 rounds, displaying the final score at the end.
Coin Flip Streak
The player flips a virtual coin (random number: 0 = Heads, 1 = Tails). The game continues until the player gets 5 heads in a row. The
11
program counts the total flips needed to achieve this.
Number Reversal Game
The player enters a number, and the program reverses it (e.g., input 1234, output 4321). The player keeps playing until they enter 0 to
12
quit.
Prime Number Challenge
The program randomly picks a number between 1 and 50. The player must guess whether the number is prime or not. The game runs
13
for 10 rounds, and the player’s score is displayed at the end.
Roll and Reach
14
The player rolls a die and accumulates points. The goal is to reach exactly 50. If they exceed 50, they lose.
The Math Quiz Game
15 The game presents 5 random math problems (addition, subtraction, multiplication). The player must answer correctly to earn points. At
the end, the program displays the final score.