Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Java assignment 2

malquait
malquait 


to solve the questions that I'm going to put in the attachment Attachments Tags
Clarifications

Answers

Java assignment 2 - Solution

dickersonka
dickersonka 



Attached is the solution to... Attachments
src.zip (3 K) Download
Preview
static void main(String[] args){ //create circle with radius 5 Circle circle1 = new Circle(5); System.out.println("The area of a circle with radius of " + circle1.getRadius() + " is " + circle1.calcArea()); //create circle with radius 7 Circle circle2 = new Circle(7); System.out.println("The area

Preview
static void main(String[] args){ //create circle with radius 5 Circle circle1 = new Circle(5); System.out.println("The area of a circle with radius of " + circle1.getRadius() + " is " + circle1.calcArea()); //create circle with radius 7 Circle circle2 = new Circle(7); System.out.println("The area

Preview
extends Shape{ private double side; /** * Create cube * @param side length of side */ public Cube(double

Preview
extends Shape{ private double side; /** * Create cube * @param side length of side */ public Cube(double

Preview
public Dog(DogSize dogSize){ this.dogSize = dogSize; } /** * Get breed of dog * @return Breed of dog */ public String getBreed() { return breed; } /** * Set breed of dog * @param breed Breed

Preview
public Dog(DogSize dogSize){ this.dogSize = dogSize; } /** * Get breed of dog * @return Breed of dog */ public String getBreed() { return breed; } /** * Set breed of dog * @param breed Breed

Preview
/** * Set genre * @param genre Genre */ public void setGenre(String genre) { this.genre = genre; } /** * Get review rating * @return Review rating */ public int getReviewRating() { return reviewRating; }

Preview
/** * Set genre * @param genre Genre */ public void setGenre(String genre) { this.genre = genre; } /** * Get review rating * @return Review rating */ public int getReviewRating() { return reviewRating; }

Preview
calcArea(); public abstract

Preview
calcArea(); public abstract

Preview
System.out.println("Area: " + cube.calcArea()); System.out.println("Volume: " + cube.calcVolume()); System.out.println(); //determine larger area String largerArea = "The cube"; if(sphere.calcArea() > cube.calcArea()){ largerArea = "The sphere"; } largerArea += " has a larger area";

Preview
System.out.println("Area: " + cube.calcArea()); System.out.println("Volume: " + cube.calcVolume()); System.out.println(); //determine larger area String largerArea = "The cube"; if(sphere.calcArea() > cube.calcArea()){ largerArea = "The sphere"; } largerArea += " has a larger area";

Preview
radius of sphere */ public Sphere(double radius){ this.radius = radius; } @Override /** * Calculate area */

Preview
radius of sphere */ public Sphere(double radius){ this.radius = radius; } @Override /** * Calculate area */

Preview
double temp = toCentigrade(65); System.out.println("St Louis 65F = " + temp + "C"); temp = toCentigrade(55); System.out.println("London 55F = " + temp + "C");

Preview
double temp = toCentigrade(65); System.out.println("St Louis 65F = " + temp + "C"); temp = toCentigrade(55); System.out.println("London 55F = " + temp + "C");

Screenshots
Purchase Answer