Question: In this lab, you will demonstrate your ability to use C# to solve a fairly typical game development task using only the basic functionality of
In this lab, you will demonstrate your ability to use C# to solve a fairly typical game development task using only the basic functionality of the language.
NOTE: You have the freedom to tackle this challenge using a variety of different approaches. For example, you could use a console application, or you could create a graphical user interface (GUI) in Visual Studio to make this a button-driven application. As a programmer, it is important that you learn how best to solve these problems based on the needs of your clients.
Create a function called DisplayData, which accepts several arguments in Visual Studio:
One string indicating a players name.
Three integers indicating a players health, attack rating, and defensive rating.
One float indicating how many minutes the player has spent playing the game.
When fed this information, the function will display the information in the following manner:
First Name: Steve Last Name: Jones Health: 100 Attack: 5 Defense: 10 Time Playing: 4 hours, 32 minutes
Notice that the players name has been split across two lines (First Name and Last Name) despite being a single string. Additionally, note that the Time Playing has been converted from a single float to two integers, representing hours and minutes.
In order to test your function, you will create five arrays, one for each argument passed to the function. These five arrays represent five different players. You can assign whatever values youd like to players 2-4, but player 1 should use the following data:
Name = Steve Jones Health = 125 Attack = 5 Defense = 10 Time Playing = 272
The program should loop through all players and call the function outlined above using the appropriate index numbers when passing information as parameters.
Additionally, demonstrate your ability to use conditional logic by making sure that any health values greater than 100 are displayed simply as 100.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
