0% found this document useful (0 votes)
4 views1 page

Coding Questions

The document outlines two programming tasks for managing a movie animation studio and organizing a digital cricket match. The first task involves creating classes for movie projects and staff, including behaviors for production and cost tracking, while the second task requires implementing a cricket game where two players score runs over 12 balls with input validation. Both tasks emphasize object-oriented programming principles and include requirements for class structures and methods.

Uploaded by

Hassaan Raza
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Coding Questions

The document outlines two programming tasks for managing a movie animation studio and organizing a digital cricket match. The first task involves creating classes for movie projects and staff, including behaviors for production and cost tracking, while the second task requires implementing a cricket game where two players score runs over 12 balls with input validation. Both tasks emphasize object-oriented programming principles and include requirements for class structures and methods.

Uploaded by

Hassaan Raza
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Q1:

“Netflix2” animation studio produces animated movies and aims to properly manage their “movie projects”
and “staff”. The studio works on many different movies projects and staff assigned to them. Write a program
to perform the given tasks: [25 min, 5+5+2 Marks]
A. To maintain information of a movie project. The movie information includes movie id, title, the total
budget, and current cost of the movie. Moreover, each movie has two staff members, a project lead and chief
animator. Apart from this, the movie project also has the following behavior: void Production (), This behavior
allows project lead and chief animator to perform their assigned job and print that the task is in production.
The class should have a global member that keeps track of total budget of all the movies created.
B. Each staff information includes staffID, salary, employee type. Employee type can have only two
possible values of project lead or chief animator. The class should have a global member that keeps track of
total salaries of all the staff employed. Apart from this, an employee demonstrates the behavior double
TrackProject (double currentCost) if the type of that employee is project lead. And double Animate (double
currentCost) if the type of that employee is chief animator.
i. Each time the chief animator animates, it adds PKR 10,000 to the current cost of the movie.
ii. When a project lead tracks a project, he checks if the current cost of the movie is exceeding PKR
200,000. If it is exceeding budget, then he immediately shows a “warning: that cost is exceeding budget”.
C. Draw a UML / Class diagram that represents the above given system to highlight OOP features.

Q2:
Develop a Program that organize digital cricket match where two players, Player 1 and Player 2, are competing
over 12 balls. The game, named "Cricket Showdown," involves each player taking turns to score runs on every
ball. The twist is, they have to enter their scores, ranging from 0 to 6, and if a player mistakenly inputs a score
outside this range, the score won't count, but the ball will still be marked. You should not violate any principle
of Object-oriented programming.

1. Create a class “player” consisting of following members with appropriate datatypes:


ballScores[12]: denotes an array wherein the scores corresponding to each ball are stored.
PlayerName: representing the player name.
TotalScore: containing count total score for each player.
2. Create a class “Game” consisting of following members with appropriate datatypes:
playGame(Player& player): each player gets their turn to face the 12 balls. The function prompts the player to
enter the score for each ball.
ValidateScore(): if the score entered is not between 0 and 6 (inclusive), it won't be considered, but the ball will
still be recorded.
findWinner(Player& player1, Player& player2): the winner is determined based on the total scores.
displayMatchScoreboard(Player& player1, Player& player2): This function displays the detailed summary of
the match. In summary, each player's name and their score against each ball should be in ascending manner
with average score and total score for each player, giving a comprehensive overview of their performance.

You might also like