MTD215 TMA01 (Tutor-Marked Assignment 01) SUSS: July 2024 – Application of C++ in Multimedia

Question 1

Implement a C++ program in an objected-oriented programming style and use comments to explain the syntax and structure of C++.

(a) Declare the Rectangle class as follows:

(i) Two private variables: Length, Width.

(ii) Constructor with input of Length and Width.

(iii) One function to get perimeter.

(iv) Another function to get aspect-ratio (ratio of Length to Width).

(v) Another function to get area.

(b) Write a main() function to demonstrate how the constructors in part (a) are being used.

(i) To get user inputs of Length and Width

(ii) Create objects based on user inputs.

(iii) Display the perimeter, aspect-ratio, and area of the circle.

(c) Using SDL or SFML to visualize the rectangle.

Write My Assignment
Hire a Professional Essay & Assignment Writer for completing your Academic Assessments

Native Singapore Writers Team

100% Plagiarism-Free Essay
Highest Satisfaction Rate
Free Revision
On-Time Delivery

Question 2

Your company is organizing an exhibition match of the game “League of Legends” as team- bonding activity for this month. You are asked to apply C++ to program and implement a player grouping system.

Requirements of the grouping system:
– 10 participants are to be divided into two teams of 5 members each.

– Each participant will be registered with name and performance rating between 1 and 10 points (inclusive).

– To make the exhibition match as exciting as possible, we need to divide the 10 participants into two teams as evenly as possible in terms of skill level. For example, given the gaming performance ratings of the 10 participants as follows: 5, 1, 8, 3, 4, 6, 7, 10, 9, 2, the optimal division would be (1, 3, 5, 8, 10) and (2, 4, 6, 7, 9), resulting in the smallest difference in
strength between the two teams, which is 1.

Remember to add comments to explain the syntax and structure of C++ language. Write down codes with comments to implement the following functions:

(a) Receive each participant name and performance rating of each participant.

(b) Your algorithm starts grouping after all 10 participants information received and ultimately displayed the grouping result as shown in the figure below.

(c) Calculate and display the absolute difference value between the two groups.

Question 3

Apply C++ language to program a puzzle game. The puzzle involves arranging a set of twenty- five numbers in an ascending order. The numbers are displayed in a 5×5 grid. These numbers are randomly generated and yet to be sorted. The player is required to sort these numbers by swapping two adjacent numbers each time and ultimately sort the set of numbers in an ascending order. A number can be swapped with another number on its right, left, top or bottom. Take note that a number cannot be swapped with a number that is diagonally adjacent to it.

Figure Q3(i) shows a sample initial screen of the game with the 25 randomly generated numbers arranged in a 5×5 grid.

Buy Custom Answer of This Assessment & Raise Your Grades
Get A Free Quote

For example, if the number 7537 is to be moved, then it can be swapped with either the number 2053 (top), 8999 (bottom), 8154 (left), or 4982 (right). Any illegal swapping will result in an error message being displayed as shown by Figure Q3(ii). Figure Q3(iii) shows the result of player swapping the numbers 7537 and 2053 in a partially sorted manner.

You are required to implement the puzzle game with the following specifications:
(a) The program should randomly generate 25 numbers. Different set of numbers should be displayed each time the program is started. The program displays the 25 numbers in a 5×5 grid. Each number should be enclosed in an ASCII box, as shown in Figure Q3(i). (

(b) The program should prompt the player to swap two adjacent numbers as shown in Figure Q3(ii). It should check for illegal moves if the two numbers are not adjacent to each other either horizontally or vertically. It should display an error message if the move is not allowed as shown in Figure Q3(ii).

(c) If the move is legal, the program should perform the swap and display it on the screen. If the numbers are still not sorted, the program should prompt for the next move, as shown in Figure Q3(iii).

(d) If the numbers are sorted, the program should display the result and a message informing the user that he has successfully completed the puzzle, as shown in Figure Q3(iv).

(e) Instead of putting all your codes in the main() function, you should decompose your program into meaningful functions. For example, you should have a function for each of the following tasks:

Displaying the puzzle.
Getting input from the user.
Check if user has selected two locations that are adjacent.
Check if the numbers are sorted.

Question 4

(a) Apply C++ and SDL to implement an animation of running stickman with a click button to start/stop in SDL window:
(i) Create a window with resolution of 800*600.
(ii) Use the sprite sheet provided below to display the animation of a running stickman.

Stuck with a lot of homework assignments and feeling stressed ?
Take professional academic assistance & Get 100% Plagiarism free papers
Get A Free Quote

The post MTD215 TMA01 (Tutor-Marked Assignment 01) SUSS: July 2024 – Application of C++ in Multimedia appeared first on Singapore Assignment Help.

Reference no: EM132069492

WhatsApp
Hello! Need help with your assignments? We are here

GRAB 25% OFF YOUR ORDERS TODAY

X