PLEASE REVIEW THE INFORMATION BELOW  Submit the source code .java files on Ecampus under the “Submit Homework” menu option. 1. In a

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

 The Rest of the resources and instructions are provided in the screenshots below. You will need the Project overview to complete this

 The Rest of the resources and instructions are provided in the screenshots below. You will need the Project overview to complete this assignment. Project Overview This project includes the following tasks: Gather product information Analyze and differentiate product vulnerabilities Recommendation based on empirical data collection Objective: Product Selection Recommendation Organizations

 How Does Surescripts Integration Improve Prescription Management?  The Future of E-Prescriptions: Why Surescripts Integration is a Must-Have In

 How Does Surescripts Integration Improve Prescription Management?  The Future of E-Prescriptions: Why Surescripts Integration is a Must-Have In today’s fast-evolving healthcare landscape, seamless data exchange is essential for improving patient care and optimizing workflows. Surescripts integration solutions provide a secure and efficient way to connect pharmacies, healthcare providers, and electronic

[url= Integration Services[/url] are transforming businesses by streamlining operations, enhancing customer experiences, and enabling data-driven

[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