Next, we want to start making enemies for our upcoming video game, so we will define a class called GameEnemy. Every GameEnemy will have a name, an x location, a y location, and a number of hit points (which must be a non- negative integer). Theinit method for GameEnemy will take all of these parameters (in that order) and store them on the object. GameEnemy also needs a method called healthbar, which will allow us to show that enemy's health bar in the game. It returns the enemy's name followed by a number of asterisks to show how many hit points it has left. The exact format is shown below.
Q: For this exercise, we are going to look at how we can create a .equals method. Remember, to compare…
A: import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner…
Q: For this assignment, you are asked to create a ColorfulBouncingCircle class. ColorfulBouncingCircle…
A: private double radius; // X and Y are in Java graphics coordinate system // (0, 0 in upper left…
Q: In Q3, the ColoredCircle class has a getPerimeter() method that is different from the one in its…
A: Introduction: When a subclass (child class) in Java contains the same method as the parent class,…
Q: Given the GVCoin class, complete the method flipForHeads() in the TossingCoins class that counts and…
A: Here I have defined the function flipForHeads(). In this function, I have created a variable to…
Q: Write a class for a Chicken that also implements your interface. The Chicken’s type will be…
A: Here in the section of chicken sound where the condition is that 50 % of time chicken will sound…
Q: To further increase the statistical knowledge of your fight, count the number of times a certain…
A: function countNumberofOccurrences(nums) { //function declaration let a = Object.values(nums)…
Q: In this second exercise, we are going to look at the iIn this exercise, you are going to complete…
A: EXPLANATION: - Methods of Rectangle class: - public String toString(): - This method is overridden…
Q: The goal of this problem is to repackage most of the previous code as a class that extends JFrame.…
A: /* Java GUI program to print a message on console when a button is clicked*/ /* Program without…
Q: Add the following method to the Point class: public double distance(Point other) Returns the…
A: Solution: Programming language used: Java Program code for distance method - (Note: all…
Q: Write a new method for the atom class called ision that will return true or false, depending upon…
A: Write a new method for the atom class called ision that will return true or false, depending upon…
Q: The goal of this problem is to repackage most of the previous code as a class that extends JFrame.…
A: /* Java GUI program to print a message on console when a button is clicked*/ /* Program without…
Q: To further increase the statistical knowledge of your fight, count the number of times a certain…
A: In this problem, we are provided with a censored string and a string of the censored vowels. Need…
Q: Without adding any method or function to the classes shown below. Find out the coverage of the…
A: #include <iostream>#include <cstdlib>#include <iomanip>#include…
Q: . Carly's Catering provides meals for parties and special events. In Chapters 3 and 4, you created…
A: Actually, java is a object oriented programming language. It is a platform independent.
Q: For this problem you will write a method that computes the number of boxes in a pyramid of boxes…
A: Non Recursive Java Program Code Screenshot: Program Code to Copy class PyramidBoxCount { /**…
Q: For this project, you will create a class for an elementary school that will allow a teacher to…
A: Java Code : - " Do this code in jdoodle"
Q: Use the GemotricObject class and its subclassess Cirlce and Rectangle to do the following:…
A: #include <iostream>using namespace std; class rect; class circle{ friend bool…
Q: This method plays 24 rounds of rps and returns the total points earned. For each of the 24 rounds,…
A: Note: Below is the required program in Java language. Program Approach: Importing the necessary…
Q: Write a class called Investment with fields called principal and interest. The constructor should…
A: class Investment //Declaration of class Investment{ long principal,interest; //Declaring…
Q: Please write an email class using OOP concept to send an email with "Information Technology" for the…
A: -> Everything is explained in code via comments import java.util.*;import javax.mail.*;import…
Q: Without adding any method or function to the classes shown below. Find out the coverage of the…
A: #include <iostream>#include <cstdlib>#include <iomanip>#include…
Q: In class BouncingBall, you will find a definition of gravity (a simple integer). Increase or…
A: Here have to determine about Increase or decrease the gravity value of class BouncingBall.
Q: Make a new class in the Lab3 project called Primes. Add a method to this class called isprime, which…
A: A number is said to be a prime number if it has only 2 factors 1 and itself So, start counting the…
Q: In Python Make a new class called Electric_Car which posses all the methods and attributes of the…
A: A python is an object-oriented programming language and it is a dynamic data type language.…
Q: How many different ways can you think of to indicate that a method has received incorrect parameter…
A: As a any software ,you make a GUI and human user. basically only two conditions to get incorrect…
Q: In this task by using java language you should create the moving box example belwo, then you should…
A: Our task is to using java language, you should create the moving box example belwo, then you should…
Q: Make a class named 'MyStringTest! Put it in a package named 'stringtester' and have it contain a…
A: Please Upvote/like me. Please. I need it badly. Please. First of all there are no inbuilt classes…
Q: Create a class called ComplexNumber, which will represent the mathematical concept of a complex…
A: Below i have written:
Q: Can you guess what types some of the Book class’s fields might be, from the parameters in its…
A: What basically the types of the Book class's fields hold from the parameters in its constructor.
Q: What is the list of all the methods of the Card class, and for each one write what type( if any) the…
A: Dear Student, The method used in class card are - __str__() and __lt__()
Q: In this lab you will write three classes: Die, PairOfDice, and Player. The Die class mimics the…
A: import java.util.Random;public class Die { private int sides; private int face; public…
Q: Suppose there is a class called Thing and a method you attempt to call a method called myThing()…
A: there is a class called Thing and a method you attempt to call a method called myThing() like this:…
Q: This method plays 24 rounds of rps and returns the total points earned. For each of the 24 rounds,…
A: import java.util.*; public class RPS { public static int playRps(){ Random ran = new…
Q: Write an defense method for Warrior class that takes an integer parameter, i.e. hitPoint. The method…
A: Required: write an defense method for warrior class that takes an integer and return health based on…
Q: Given the GVCoin class, complete the method flipForHeads() in the TossingCoins class that counts and…
A: Answer; The project consists of flipping a coin and using various methods to detect how many heads…
Q: Write the code for the timeTick method in ClockDisplay that displays hours, minutes, and seconds, or…
A: here have to determine about displays hours, minutes, and seconds.
Q: Create a class TrafficLightViewer, then write the main() method to draw a traffic light as shown…
A: TrafficLightViewer.java import javax.swing.*; public class TrafficLightViewer { public static…
Q: To further increase the statistical knowledge of your fight, count the number of times a certain…
A: In this problem, to further increase your statistical knowledge of your fight, count how many times…
Q: To further increase the statistical knowledge of your fight, count the number of times a certain…
A: In this problem we need to design the Java script program. Input - an object that contains several…
Q: In this lab you will write three classes: Die, PairOfDice, and Player. The Die dass mimics the…
A: Q: Code the given problem in java
Q: Implement a class RoachPopulation that simulates the growth of a roach population. The constructor…
A: class RoachPopulation{ private int population; //The constructor takes the size of the…
Q: Can you implement an interface in your class? A solution is placed in the "solution" section to help…
A: Step 1 : Start Step 2 : Create and interface Addition with two variables num1 and num2. Step 3 :…
Q: Write an accessor method called getName that returns the value of a field called name, whose type is…
A: String getName();
Q: For this exercise, we are going to look at how we can create a .equals method. Remember, to compare…
A: given data For this exercise, we are going to look at how we can create a .equals method. Remember,…
Q: Q2. In the ClockDisplay example, create a NumberDisplay object with limit 80 in the Code Pad by…
A: I have Provided this answer with full description in step-2.
Q: You are given an interface AdvancedArithmetic which contains a method int divisor_sum(int n). You…
A: Java code: import java.util.*; //interfaceinterface AdvancedArithmetic { //abstract method int…
Q: Write a class 'Cylinder' that has two fields: height and radius. The class should have only one…
A: Since no programming language is mentioned, I am using python. Algorithm: Start Create a class…
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- Using classes, design an online address book to keep track of the names, addresses, phone numbers, and dates of birth of family members, close friends, and certain business associates. Your program should be able to handle a maximum of 500 entries. Define a class addressType that can store a street address, city, state, and ZIP code. Use the appropriate functions to print and store the address. Also, use constructors to automatically initialize the member variables. Define a class extPersonType using the class personType (as defined in Example 10-10, Chapter 10), the class dateType (as designed in this chapters Programming Exercise 2), and the class addressType. Add a member variable to this class to classify the person as a family member, friend, or business associate. Also, add a member variable to store the phone number. Add (or override) the functions to print and store the appropriate information. Use constructors to automatically initialize the member variables. Define the class addressBookType using the previously defined classes. An object of the type addressBookType should be able to process a maximum of 500 entries. The program should perform the following operations: Load the data into the address book from a disk. Sort the address book by last name. Search for a person by last name. Print the address, phone number, and date of birth (if it exists) of a given person. Print the names of the people whose birthdays are in a given month. Print the names of all the people between two last names. Depending on the users request, print the names of all family members, friends, or business associates.Write a program named SalespersonDemo that instantiates objects using classes named Real EstateSalesperson and GirlScout. Demonstrate that each object can use a SalesSpeech() method appropriately. Also, use a MakeSale() method two or three times with each object, and display the final contents of each objects data fields. First, create an abstract class named Salesperson. Fields include first and last names; the Salesperson constructor requires both these values. Include properties for the fields. Include a method that returns a string that holds the Salespersons full name—the first and last names separated by a space. Then perform the following Create two child classes of Salesperson: Real EstateSalesperson and Girl Scout. The Real EstateSalesperson class contains fields for total value sold in dollars and total commission earned (both of which are initialized to 0), and a commission rate field required by the class constructor. The Girl Scout class includes a field to hold the number of boxes of cookies sold, which is initialized to 0. Include properties for every field. Create an interface named ISell able that contains two methods: SalesSpeech() and MakeSale(). In each Real EstateSalesperson and Girl Scout class, implement SalesSpeech() to display an appropriate one- or two-sentence sales speech that the objects of the class could use. In the Real Estatesalesperson class, implement the MakeSale() method to accept an integer dollar value for a house, add the value to the Real EstateSalespersons total value sold, and compute the total commission earned. In the Girl Scout class, implement the MakeSale() method to accept an integer representing the number of boxes of cookies sold and add it to the total field.In the board game Scrabble, each tile contains a letter, which is used to spell words in rows and columns, and a score, which is used to determine the value of words. The point of this exercise is to practice the mechanical part of creating a new class definition: Write a definition for a class named Tile that represents Scrabble tiles. The instance variables should be a character named "letter" and an integer named "value". Write a constructor that takes parameters named letter and value, and initializes the instance variables. Create getters for both of the attributes. (No setters, so that a Tile is immutable.) Implement the .toString() and .equals methods for a Tile. Your completed Tile class should work with this Main program (Links to an external site.) so that it produces sample output like shown at the end of the program. You can Fork the program to make your own version in Replit, where you can add your Tile.java, or you can copy the program to your own Java development…
- In the board game Scrabble, each tile contains a letter, which is used to spell words in rows and columns, and a score, which is used to determine the value of words. The point of this exercise is to practice the mechanical part of creating a new class definition: Write a definition for a class named Tile that represents Scrabble tiles. The instance variables should be a character named "letter" and an integer named "value".Design FullTimeEmployee class and PartTimeEmployee class which inherit Employee class so that the following code provides the expected output.[addFullTimeEmployee() and addPartTimeEmployee() methods should work any number of parameters assuming that the parameter number will be an even number and greater than 1]class Employee: total_employee = 0 def __init__(self, name, work_hour): self.name = name self.work_hour = work_hour def __str__(self): s = “Department: ”+self.name+", Work hours: "+str(self.work_hour) return s# Write your codes here.# Do not change the following lines of code.p1 = FullTimeEmployee(“Finance”, 40 )print("=================================")p1.addFullTimeEmployee(“Bob”, 12, “Carol”, 18, “Mike”, 15)print("=================================")print(p1)print("=================================")p2 = PartTimeEmployee(“Others”, 25)print("=================================")p2.addPartTimeEmployee(“David”, 12, “Simon”,…Deeper Class Design - the Square Class In this section, your job will be to write a new class that will adhere to the methods and data outlined in the “members” section below (said another way, your classes will implement a specific set of functions (called an interface) that we’ll describe contractually, ahead of time). These classes will all be shapes, with actions (methods) that are appropriate to shape objects, such as “getArea()”, or “draw()”. First we build a Square class that contains the following data and methods listed below, and then later, we will copy it to quickly make a Circle class. Note: when considering each data item below, think about what type of data would best represent the concept we’re trying to model in our software. For example, all shapes will have a coordinate pair indicating their location in a Cartesian coordinate system. This x and y pair may be modeled as ints or floats, and you might choose between the two depending on what the client application will…
- Write a graphical application that contains a class named RV whose objects are the recreational vehicle designed and digitized as described in Knowledge Exercises 20 and 21 (you can design your version as well. Simple car shape is will be appreciated. The class’s private data members should be the vehicle’s body color and (x, y) location. a) Give the UML diagram for the class. It should include a three-parameter constructor, a toString method, a method to input the values of all of an object’s data members, and a show method to draw the RV at its current (x, y) location. b) Progressively implement and test the RV class by adding a method and verifying it before adding the next method. A good order to add the methods to the class is the three-parameter constructor, followed by the toString method, the show method, and finally the inputmethod. The client code should create an RV object using the three-parameter constructor to test all of the methods as they are progressively added to the…A. Create a BankAccount class. We want to be able to create a new bank account, make deposits and withdrawals, and check the balance. Each bank account created should receive a unique account id, numbered sequentially 1001, 1002, 1003, and so on. We should be able to change the name on the account. We should also be able to retrieve the account id and the name on the account. Provide a constructor that takes a name for the account as a parameter. Remember that a constructor has the same name as the class. The constructor should initialize all of the instance variables. What does the class need to remember? Those are the instance variables. There should be three. Provide the following methods: public double getID() gets the account id of this BankAccount public double getBalance() gets the balance of this BankAccount public String getName() gets the name of this BankAccount public void setName(String newName) sets a new name for this BankAccount public void deposit(double…In Java Programming, 2 class needs a no-arg constructor and a constructor that initializes all fields with data (The ProductionWorker class constructor should receive data for the Employee class fields as well). I need help to create a method within the Employee and ProductionWorker classes called displayInfo. (displayInfo accepts no arguments and returns void). To display the data for each constructor, the demonstration class will call the subclass displayInfo method and it will call the superclass displayInfo method. User input is not required for the demonstration class. Have a class named "Employee" with the following fields: - Employee Name - Employee Number in format XXX-L, X = digit w/ range 0-9 & L = letter w/ range A-M. - Hire Date Then one or more constructors and the appropriate accessor and mutator methods for the class. Also, another class named "ProductionWorker" that extends "Employee" class. The "ProductionWorker" class should have the following fields to hold…
- Part 1: Setting the turtle size when it is instantiated Currently, a turtle is created and given a default size of 50. To change the size of the turtle its increaseTurtleSizeBy10 and decreaseTurtleSizeBy10 methods can be called. Add functionality so that a turtle can be created with a specified size. In the DoodleTurtle class do the following: Overload the DoodleTurtle constructor by creating a one-parameter constructor that takes the size of the turtle as an integer. Add an empty method body. Complete the method specification for the new constructor. The default constructor method specification can be used as a model. The only difference will be that the getTurtleSize() will equal the name of the size parameter instead of INITIAL_SIZE. In the method body of the one-parameter constructor do the following in this order: Call the initializeWithDefaultValues helper method. Call the setSize method passing it the size parameter. Compile the program and fix any…using c++ oop !!! kindly need help asap. Implement the shape, rectangle, and square classes with components as shown and the following functionality: Each constructor and destructor prints a message to the screen that it is being called in each class implement the area() method that calculates the area of the figure (for the Shape class you can return 0) Example Constructor shape: Rectanleeeeeee Rectangle constructor 232.5 Rectanleeeeeee Eeeeeeee Rectangle destructor Shape destructor Constructor shape: Squareeeee Rectangle constructor Square constructor Squareeeee AAAaaaa 105.165 Square destructor Rectangle destructor Shape destructor // main.cpp : Defines the entry point for the application.// #include "main.h"using namespace std; int main(void) {{rectangle rec("Rectanleeeeeee", 10, 23.25);std::cout << rec.area() << std::endl;std::cout << rec.get_name() << std::endl;rec.set_name("Eeeeeeee");std::cout << rec.get_name() << std::endl;} {square…Define a class named Billionaire which will be used to represent an entry on Forbes list of the richest individuals in technology. The class should define attributes for the first name and last name, net worth (in billions), how they made their wealth (company name, product name or type), country of citizenship and the person’s current ranking on the list. The following methods are needed. Please review the included Lab2Client.cpp file for specific method names. A default class constructor. No actions are needed for this constructor. A class constructor that accepts a single string parameter containing the class attribute values separated by a comma. The constructor must parse the parameter string into individual data items in order to set the class attributes. Accessor methods for the class attributes. Mutator methods for the rank and net worth class attributes. All other attributes are immutable. A utility method to display the class attribute values using cout in a readable…