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.
Q: A Bounding Box is simply a rectangle used to enclose a two-dimensional shape. Bounding boxes are…
A: Dear Student the 3 lines for bound box algorithm for collision detection is given below the lines…
Q: I. let's we have a class named Distance having two private data members such as feet(integer),…
A: //c++ program #include<iostream> using namespace std; //Distance class class Distance {…
Q: A corporation has six divisions, each responsible for sales of different geographic locations. The…
A: The Complete code is given below with the output.
Q: Write a program to score five – card poker hands into one of the following categories: nothing, one…
A: EXPLANATION Below is the program for the given question. Hope you understand it well. If you have…
Q: Create a class called employee that contains a name( an array of char) and an employee number (type…
A: the program is an given below :
Q: expalin this whole program with comments Create a class called employee that contains a name( an…
A: * As no programming language is mentioned in the question, writing this program in c++…
Q: Create a class called Array for performing a float one dimensional array. efine all the necessary…
A: Explaining in java language
Q: QUESTION 4 Write the code of data type class Rainfall_Information yourLastName including: *data…
A:
Q: Write a program that uses a structure to store the information about the Items in a retail store. It…
A: //Solution: //class Itempublic class Item { //declaring the class variables String name; final…
Q: Write a program which has a class called binary which has a character array to store a binary…
A: #include <iostream>#include <bitset>#include <string>using namespace std;class…
Q: (a)(i) Create an Employee structure that will have the following members: name (string type),…
A: Note : since the Programming language is not mentioned we are providing solutions in c++ programming…
Q: Class and Data members: Create a class called Student that stores a student’s grades (integers)…
A: According to the information given:- we have to create a program for student report card. we have to…
Q: Huge Integers Design a class that can handle arbitrarily large integers (using strings) that…
A: The following program illustrates how to design a custom class of new data type LargeInt using…
Q: C++ programming Create a class Student with following data members- name, roll no and marks as…
A: GIVEN: Create a C++ program with class Student that has the data members- name, roll no and marks as…
Q: Problem Write a C++ program that will display multiple-choice trivia questions, accept the user's…
A: Actually, the code has given below:
Q: use c++ toWrite a class SalesPerson with data members as sales vector of size 12. Write member…
A: The program in C++ is given below #include <iostream>#include<vector>using namespace…
Q: Write a class called Pet that contains an animal’s name, type, and weight. Include a default…
A: Given: Write a class called Pet that contains an animal’s name, type, and weight. Include a default…
Q: (C++ programming language) Create a class Student with following data members- name, roll no and…
A: #include<iostream>#include<string>using namespace std; class Student{ private: string…
Q: ss called Matrix having the following data members int rows; int cols;
A: Create a class called Matrix having the following data membersint rows;int cols;int mat[][].
Q: This assignment utilizes a class in an application that might be useful in the “real world.” It…
A: Text file data: June 2019 90 85 97 91 87 86 88 82 83 85
Q: Write a class named CourseGrades. The class should have a member named grades that is an array of…
A: Working code implemented in C++ and appropriate comments provided for better understanding: Here I…
Q: In this task, you are going to be implementing a sorted array of angle measurements modelled as…
A: The class contains two double variables. It consists of a default constructor, getter and setter…
Q: Drink Machine Simulator Write a program that simulates a soft drink machine. The program should use…
A: Answer :
Q: You are required to design an Movie class which has following attributes String name;…
A: The code is
Q: You are required to design an Movie class which has following attributes String title;…
A: Approach: Class Movie is created with attributes as given in question. In the main method, an array…
Q: C++ Design a class called bowler that stores data about a participant in a bowling tournament. For…
A: Given: C++ Design a class called bowler that stores data about a participant in a bowling…
Q: Bank Program This c++ assignment uses the same account class created in Lab #4 with a more generally…
A: Step 1: Define main() method. Create an instance of ifstream. Step 2: Open file "bank.txt". Read the…
Q: (Polynomial Class) Develop class Polynomial. The internal representation of a Polynomialis an array…
A: Coded using C++.
Q: Assume that BlogComment is a structured type with these fields, comment (a string, the actual…
A: For this program we would use the concept of Structures in C++ Programming Language. First we will…
Q: ormation about each player. The UML diagram is given below. Player -name: string -symbol :char…
A: given - Write a program with C# to Simulate a game of tic tac toe. A game of tic tac toe has two…
Q: Write a class named CourseGrades. The class should have a member named grades that is an array of…
A: import java.text.DecimalFormat; /** * class that holds all grade objects for course */public class…
Q: 1. Define a structure called Team that has two member variables: last_name of type C-string of up to…
A: For the part 1 :- **************** code starts here ***************** #include<stdio.h>…
Q: Write a class Array that contains an array of integers as data member. The class contains the…
A: C++ syntax Arrays can also be the data members of the class, just like integer, float and other data…
Q: Q2 The answer for question Q2(a) – Q2(f) are interrelated. Write a structure type called car that…
A: Please find the asked questions
Q: Assume that you have the following definition: struct partsType { string partName; int partNum;…
A: The code implementation is given in the below steps. The Algorithm: The structure partsType is…
Q: Assume a class named Employee is defined. To create an array of size 10 of type Employee, the…
A: Syntax for defining array of objects : ClassName[ ] obj = new ClassName[ array_length ];
Q: Write a class Box having three private data members (width, depth, height) The class has three…
A: public class Box{ //declaring data members private double width; private double depth; private…
Q: Results of a survey of the households in your town have been made available. Each record contains…
A: Purpose of the program: This program creates an array of structure of household type including…
Q: Declare an array of type citizen of size 41.
A: We define a structure with keyword struct. The syntax is struct structure_name { // variable; };
Q: Design two classes named Employee and Timecard to represent employee and timecard data as follows:…
A: Employee.java public class Employee { private int empno; private String last, first; private double…
Q: You are required to design an Movie class which has following attributes String name;…
A: In the java program, add the necessary and required libraries for the program. For example, the…
Q: Create a class of type student .Members will include: name, gpa, rank (year) Make sure all data is…
A: The name of the class is Student.All data is a private member of the class.All function is a public…
Q: Design a program that uses two-dimensional arrays, classes and objects Assignment: Write a program…
A: #include<iostream>#include <string>using std::cout;using std::cin;using std::endl;using…
Q: The operator that is required to access members of classes and structs is called: a. Colon operator…
A: C++ programming refers to the Object oriented programming languages. It is structural, general…
Q: Function 4: Class Grading function _four ( array ) Create a JavaScript function that meets the…
A: Algorithm Start the program. pass the array of marks to the function. Calculate sum and find…
Q: You are required to write a program that creates a mini database of HairColor objects..... For this,…
A: The program is import java.util.Scanner; import java.util.ArrayList; enum type { highlight,…
Q: (Tic-Tac-Toe) Write a program that allows two players to play the tictac-toe game. Your program must…
A: Program: #include <iostream> #include <iomanip> using namespace std; class ticTacToe{…
Step by step
Solved in 5 steps with 2 images
- In previous chapters, you have created programs for the Greenville Idol competition. Now create a Contestant class with the following characteristics: The Contestant class contains public static arrays that hold talent codes and descriptions. Recall that the talent categories are Singing Dancing, Musical instrument, and Other. The class contains an auto-implemented property that holds a contestants name. The class contains fields for a talent code and description. The set accessor for the code assigns a code only if it is valid. Otherwise, it assigns I for Invalid. The talent description is a read-only property that is assigned a value when the code is set. Modify the GreenvilleRevenue program so that it uses the Contestant class and performs the following tasks: The program prompts the user for the number of contestants in this years competition; the number must be between 0 and 30. The program continues to prompt the user until a valid value is entered. The expected revenue is calculated and displayed. The revenue is $25 per contestant. The program prompts the user for names and talent codes for each contestant entered. Along with the prompt for a talent code, display a list of the valid categories. After data entry is complete, the program displays the valid talent categories and then continuously prompts the user for talent codes and displays the names of all contestants in the category. Appropriate messages are displayed if the entered code is not a character or a valid code.Dice Rolling Class In this problem, you will need to create a program that simulates rolling dice. To start this project, you will first need to define the properties and behaviors of a single die that can be reused multiple times in your future code. This will be done by creating a Dice class. Create a Dice class that contains the following members: Two private integer variables to store the minimum and maximum roll possible. Two constructors that initialize the data members that store the min/max possible values of rolls. a constructor with default min/max values. a constructor that takes 2 input arguments corresponding to the min and max roll values Create a roll() function that returns a random number that is uniformly distributed between the minimum and maximum possible roll values. Create a small test program that asks the user to give a minValue and maxValue for a die, construct a single object of the Dice class with the constructor that initializes the min and max…The Spider Game Introduction: In this assignment you will be implementing a game that simulates a spider hunting for food using python. The game is played on a varying size grid board. The player controls a spider. The spider, being a fast creature, moves in the pattern that emulates a knight from the game of chess. There is also an ant that slowly moves across the board, taking steps of one square in one of the eight directions. The spider's goal is to eat the ant by entering the square it currently occupies, at which point another ant begins moving across the board from a random starting location. Game Definition: The above Figure illustrates the game. The yellow box shows the location of the spider. The green box is the current location of the ant. The blue boxes are the possible moves the spider could make. The red arrow shows the direction that the ant is moving - which, in this case, is the horizontal X-direction. When the ant is eaten, a new ant is randomly placed on one of the…
- Class Student __init__(self, id: int, fist_name: str, last_name: str, town:str): """ This creates a student object with the specified ID first and last name and home town. This constructor should also create data structure for holding the students grades for all of there assignments. Additionally it should create a variable that holds the student's energy level which will be a number between 0 and 1. :param id: The student's identifiaction number :param fist_name: The student's first name :param last_name: The student's last name :param town: The student's home town """ get_id(self)->int: """ Returns the ID of the student as specified in the constructor. :return: The student's ID """ get_first_name(self) -> str: """ Returns the first name of the student. :return: The student's first name """ set_first_name(self, name:str): """ Changes the student first name to the specified value of the name parameter. :param name: The value that the first name of the student will equal. """…shapes = [{'type': 'circle', 'x': 300, 'y': 300, 'radius': 100, 'color': 'cyan'},{'type': 'circle', 'x': 300, 'y': 300, 'radius': 10, 'color': 'white'},{'type': 'rectangle', 'x1': 500, 'y1': 500, 'x2': 550, 'y2': 580, 'color': 'green'},{'type': 'line', 'x': 0, 'y': 0, 'a': 100, 'b': 300, 'color': "black", 'width': 7},{'type': 'point', 'x': 200, 'y': 50, 'color': 'black'},{'type': 'point', 'x': 205, 'y': 50, 'color': 'black'},{'type': 'point', 'x': 210, 'y': 50, 'color': 'black'},{'type': 'triangle', 'x': 500, 'y': 100, 'a': 600, 'b': 100, 'c': 550, 'd': 200, 'color': 'yellow'},{'type': 'oval', 'x': 100, 'y': 100, 'a': 400, 'b': 400, 'color': 'red'},{'type': 'text', 'x': 500, 'y': 50, 'message': 'hello world!', 'color': 'blue'}] I'd like to take this list and write it to a new txt file. Ignoring the ':' , {}, and words within quotation marks. so the txt file created would look like this: circle, 300,300, 100, cyancircle, 300,300, 10, whiterectangle, 500,500, 550,580, greenline, 0,0,…Write a program that will contain an array of person class objects. The program should include two classes: 1) One class will be the person class. 2) The second class will be the team class, which contain the main method and the array or array list. The person class should include the following data fields; Name Phone number Birth Date Jersey Number Be sure to include get and set methods for each data field.The team class should contain the data fields for the team, such as: Team name Coach name Conference name The program should include the following functionality. Add person objects to the array; Find a specific person object in the array; (find a person using any data field you choose such as name or jersey number) Output the contents of the array, including all data fields of each person object. (display roster)
- Design an application that declares an array of 10 StockTransactionobjects. Prompt the user for data for each object, and then display all the values. Design an application that declares an array of 10 StockTransactionobjects. Prompt the user for data for each object, and then pass the array to a method that determines and displays the two stocks with the highest and lowest price per share.Attributes item_name (string) item_price (int) item_quantity (int) Default constructor Initializes item's name="none", item's price = 0, item's quantity=0 Method print_item_cost() Ex of print_item_cost() output: Bottled Water 10 @ $1 = $10 in the main section of your code, prompt the user for two items and create two objects of the ItemToPurchase class. Exc Item 1 Enter the item name: Chocolate Chips Enter the item price: 3 Enter the item quantity: 1 Item 2 Enter the item name: Bottled Water Enter the item price: 1 Enter the item quantity: 10 Add the costs of the two items together and output the total cost Ex TOTAL COST Chocolate Chips 1 @ $3-$3 Bottled Water 10 @ $1= $10 Total: $13JavaFX Programming Using Scenebuilder with eclipse or another ide code this in JAVA code this program 02 - Rational GUI: Using the Rational class code from Lab 4, create a GUI which allows you to add, subtract, multiply, and divide Rational numbers by entering the numerator and denominator in separate fields. The results should also be displayed in two separate fields. public class Rational { // data private int num; private int den; // constructors /** * Constructs a Rational from a numerator and denominator * * @param n the numerator * @param d the denominator */ public Rational(int n, int d){ if (d==0) { System.out.println("Cannot divide by 0"); d=1; } num = n; den = d; simplify(); } /** * Constructs a Rational from an integer * * @param i the integer. numerator=i, denominator = 1. */ public Rational(int i) { this(i, 1); } // selectors /** * gets numerator * * @return numerator */ public int getNumerator(){ return num; } /** * gets denominator * * @return denominator */…
- Please submit the pseudocode of your program for your project below. Need a class which will contain: Student Name Student Id Student Grades (an array of 3 grades) A constructor that clears the student data (use -1 for unset grades) Get functions for items a, b, and c, average, and letter grade Set functions for items a, n, and c Note that the get and set functions for Student grades need an argument for the grade index. Need another class which will contain: An Array of Students (1 above) A count of number of students in use You need to create a menu interface that allows you to: Add new students Enter test grades Display all the students with their names, ids, test grades, average, and letter grade Exit the program Add comments and use proper indentation. Nice Features: I would like that system to accept a student with no grades, then later add one or more grades, and when all grades are entered, calculate the final average or grade. I would like the system to display the…Gradient FillIn this labwork are asked to write a GUI application again using AWT. This is a fairly easy labworkthat is more about getting used to synchronized online learning. You are expected to:• Draw two rectangles.• Both of them should be filled using GradientPaint() function of AWT. (Check out itsfunction definition that is listed below.)• The first gradient should be parallel to the diagonal of the first rectangle. The colorgradient should not be repeated (acyclic).• The second gradient should be horizontal. The color gradient should be repeated forthis one (cyclic).• You are free to choose the colors but other than that your output should be similar tothe example screenshot given below.Introduction In this project, you will complete a C++ class by writing a copy constructor, destructor, and assignment operator. Furthermore, you will write a tester class and a test program and use Valgrind to check that your program is free of memory leaks. Finally, you will submit your project files on GL. If you have submitted programs on GL using shared directories (instead of the submit command), then the submission steps should be familiar. In this project we develop an application which holds the information about a digital art piece. There are two classes in this project. • The Random class generates data. The implementation of this class is provided. It generates random int numbers for colors. To create an object of this class we need to specify min and max values for the constructor. The colors fall between 30 and 37 inclusively. The Art class generates random colors and stores the color values. You implement the Art class. An object of the Art class is a digital masterpiece.…