Question 2 You are about to create a simple 2D shooting game. i) Create appropriate structures with the following information: Bullet isAvailable: bool Gun type: The gun type (e.g. Rifles or Pistol) bulletSize: Total bullets in the gun (e.g. 6 bullets in Pistol) bullets: An array of Bullet type. Maximum 100 bullets applied in the game. ii) Assume you have defined a variable called myWeapon as follows: Gun myWeapon; myWeapon.model = "Machine Gun"; myWeapon.size 80; %3D Write a code fragment to reload all the gun bullets status to true. iii) Create a function called shot that takes in a reference parameter as Gun type. The function displays the message "Reload" if the first bullet is empty. Otherwise, for every single bullet, it displays "Bang" and set the last bullet to false.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 1CP: In previous chapters, you have created programs for the Greenville Idol competition. Now create a...
icon
Related questions
Question
Question 2
You are about to create a simple 2D shooting game.
i)
Create appropriate structures with the following information:
Bullet
isAvailable: bool
Gun
type: The
gun type (e.g. Rifles or Pistol)
bulletSize: Total bullets in the gun (e.g. 6 bullets in Pistol)
bullets: An array of Bullet type. Maximum 100 bullets applied in the
game.
ii)
Assume you have defined a variable called myWeapon as follows:
Gun myWeapon;
myWeapon.model
"Machine Gun";
myWeapon.size
80;
Write a code fragment to reload all the gun bullets status to true.
iii)
Create a function called shot that takes in a reference parameter as Gun type. The function
displays the message "Reload" if the first bullet is empty. Otherwise, for every single bullet,
it displays "Bang" and set the last bullet to false.
Transcribed Image Text:Question 2 You are about to create a simple 2D shooting game. i) Create appropriate structures with the following information: Bullet isAvailable: bool Gun type: The gun type (e.g. Rifles or Pistol) bulletSize: Total bullets in the gun (e.g. 6 bullets in Pistol) bullets: An array of Bullet type. Maximum 100 bullets applied in the game. ii) Assume you have defined a variable called myWeapon as follows: Gun myWeapon; myWeapon.model "Machine Gun"; myWeapon.size 80; Write a code fragment to reload all the gun bullets status to true. iii) Create a function called shot that takes in a reference parameter as Gun type. The function displays the message "Reload" if the first bullet is empty. Otherwise, for every single bullet, it displays "Bang" and set the last bullet to false.
Expert Solution
steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Knowledge Booster
Program on Numbers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage