Our Services

Get 15% Discount on your First Order

[rank_math_breadcrumb]

HW 3

PLEASE REVIEW THE INFORMATION BELOW 

Submit the source code .java files on Ecampus under the “Submit Homework” menu option.


1.
 In a single file named shapes.java, write class definitions for a square based 
Pyramid and a 
Cone.  These classes should have a constructor to pass values for the class variables.

Pyramid class variables:
  Width, 
Height
Pyramid class methods:  
getVolume(), 
 getSurfaceArea()
Cone class variables:  
Radius, Height
Cone class methods:  
getVolume(), 
 getSurfaceArea()

Your main program should ask the user to enter values for each of the variables and output the volume and surface area of the pyramid and cone.  The code below will help you get started with the main program.

Enemy Class

Variables

Description

int Xpos, Ypos

X,Y location of the enemy.  The top left of the screen will be 1,1.

char Avatar

The character that will be displayed on the screen representing the type of enemy.

String Type

Enemy type such as “Orc” or “Troll”.

int HP

Hitpoints of the enemy.  The enemy is deceased when HP is 0.

int Attack

Attack rating of the enemy: The higher the number, the more damage is does.

int Armor

Armor rating of the enemy: The higher the armor, the less damage it takes.

Methods

Description

Enemy(String theType)

Constructor that takes 1 parameters – theType

Initialize your class variable to the parameter:
Type = theType;

Set Xpos and Ypos to random numbers from 0 to 9.

In the constructor, you will set these things based on the Type:  Avatar, HP, Attack, Armor.  For example:
if (Type.equals(“Orc”))

   Avatar = ‘O’;  HP = 50;  Attack = 5;  Armor = 20;
}

import java.util.*;
public class shapes
{
   public static void main(String[] args)
   {
      // ask user to enter values for pyramid Width and Height here

      // declare instance of the Pyramid class and send width and height as parameters
      Pyramid Luxor = new Pyramid(Width, Height);

      // output volume and surface area of pyramid
      System.out.println(“Volume = ” + Luxor.getVolume() + ” cubic meters”) ;
      System.out.println(“Surface area = ” + Luxor.getSurfaceArea() + ” square meters”);

      // do the same thing with the Cone class
   }
}

// Pyramid class goes here

// Cone class goes here

2.  Write a class definition for an 
Enemy for your game.java

Write a main program to demonstrate your Enemy class:

1.  Create an object of each of enemy (at least 3 different types).
2.  Create a 10×10 array of characters named World (same as in homework 2).
3.  Put the Avatar character of each of the 3 types of enemies into the World.
4.  Display World (same as in homework 2)

Example output below showing a dragon, orc, and troll in random locations.

. . . D . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . O . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . T . . .
. . . . . . . . . .
. . . . . . . . . .
  IF THE ABOVE INFORMATION IS CONFUSING PLEASE SEE THE BELOW PICTURE

image1.png

image2.png

image3.png

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

Computer Science Wk 2 assignment

Please see attachment for instructions provide a one-page response to the following topic below utilizing supporting documentation obtained from your textbooks and the Internet.  Be sure to include an APA Reference Page Topic: Assess the various Access Control methods.

Discussion and Replies

Please see attachment for instructions.       In 250 words total, answer the questions below with 4 evidence base scholarly articles. APA format. Based on the readings for chapter 3 Information Security Fundamentals and chapter 3&4 Information Security: Design, Implementation, Measurement, and Compliance, Discuss the following. 1. What are

How can businesses benefit from incorporating AI Integration Services into their digital transformation strategies?

[url= Integration Services[/url] are transforming businesses by streamlining operations, enhancing customer experiences, and enabling data-driven decisions. By automating repetitive tasks, AI frees up resources for more strategic activities, improving productivity. AI tools like chatbots and recommendation engines offer personalized solutions, fostering customer loyalty. AI also helps businesses analyze large datasets

OSINT Project 2

 Download the attached detailed assignment description for this project. You should also review the rubric shown below for additional information about the requirements for the project and how your work will be graded. Please make sure that you use both the assignment description file AND the rubric when completing your work. 

OSINT Project

Instructions Download the attached detailed assignment description for this project. You should also review the rubric shown below for additional information about the requirements for the project and how your work will be graded. Please make sure that you use both the assignment description file AND the rubric when completing your

D 6 of 459

Follow the attach instructions to complete this work Questions: 1. How is technology increasingly used in healthcare beyond electronic health records (HER)?  Give some examples. 2. Would you personally participate in robot assisted/telesurgery as a patient or a medical professional?  Why or why not? Resources 20 Examples Of IoT Wearables

D 5 of 459

Follow the attach instructions to complete the work. Questions: 1. What are service robots and how are they used and categorized?  Give examples of each. 2. How would you leverage service robots to improve the availability, confidentiality, and integrity of a large (20MW+) data center? Resources Robots as a Platform

ITS 10 Help

Ethical Hacking help Login to your NDG Online account. Complete the following labs. Each lab is worth 40 points. NDG Online account Link- Log In | NDG Online Portal ([email protected] Password: Starballplayer23$ 1. NDG Ethical Hacking Lab 10: Web Pentesting 2. NDG Ethical Hacking Lab 11: Client Side Exploitations After

InfSec

 Blockchain technology will revolutionize cybersecurity

ITS 12 Help

Ethical HAcking Login to your NDG Online account. Complete the following labs. Each lab is worth 40 points. NDG Online account Link- Log In | NDG Online Portal ([email protected] Password: Starballplayer23$ 1. NDG Ethical Hacking Lab 08: Password Cracking with JTR and Hashcat 2. NDG Ethical Hacking Lab 17: Creating

ITS 13 Help

Ethical Hacking  Login to your NDG Online account. Complete the following labs. Each lab is worth 40 points. NDG Online account Link- Log In | NDG Online Portal ([email protected] Password: Starballplayer23$ 1. NDG Ethical Hacking Lab 06: Network Analysis 2. NDG Ethical Hacking Lab 07: Evading IDS Submit Your Lab

Replies

please see attachment for instructions   In 400 word total, replying to the 2 post below. Each reply must be 200 word.      N.B Post #1 Hello classmates,   I am active duty in the military and currently on Eastern Standard Time. I have 4 kids, I’ve been in

channing 4.25 r studio work

follow the insrtuction Group Project Mostafa Rezaei Big Data (Introduction to Data Science) General information The group project gives you the opportunity to practice many of the skills we learned in the class. It includes 5 steps: Step 1: Find and describe a data set Find a publicly available data

Computer Science English Homework

● Assignment to do For this assignment, research different tools that cloud storage service providers use to manage the vast arrays of drives in their environments. Also, research the current performance and trends of the types of hard drives in use: magnetic vs. SSD. Summarize your research in a 2-3

SQL Help13

Statements and query For the final project, you will be working with a Guitar Shop.  You will need the MySQL server and MySQL workbench installed, just as it has been throughout the class. You will also need the following file: Project Requirements: 1. Execute the attached create_my_guitar_shop.sql to create the

Computer Science WK1 Assignment

Please see attachment for instructions and PDF book     W1 Assignment Instructions:   In 2 pages, answer the questions below with 5 evidence base scholarly articles in APA format.  Recommend and expand upon Information Security & Risk Management. 1. What are some internal and external security threats when dealing