Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Stuck in my java assignment. Please explain the code you provide?

Read the below statement

We have four classes

1. Class get:

1. This class will contain a function called getmyInput() that will prompt the user for three Inputs- Length, Width, Height

2. Class getInput:

1. This class will be a child class fo the get class it will contain a function called InputValues() that will get its three values from the getMyInput() function

3. Class Compute:

1. This calss will contain three functions called

a. calculateArea()

b. CalculatePerimeter()

c. CalculateVoluem()

The three function will get their inputs from the InputValues() function and calculate them respectively

4. Class Display Output

1. This class will contain the function OutputValues() wich will be used to display the results of each calculation

Create a UML diagram and a Java Program for the Above Classes

3 Answers

Relevance
  • 7 years ago
    Favorite Answer

    @xcxcx, I don't think that it is helpful to just give out the answer in 100% code.

    "The Problem With Spoon-Feeding"

    http://www.javaprogrammingforums.com/content/45-pr...

  • ?
    Lv 7
    7 years ago

    This is all Chinese to me. :O

    But I saw a cut sign today that said; Coffee is to keep you busy before it is time to drink wine. Just thought I would bring ya some cheer. :)

  • 7 years ago

    public class Circle {

    private double radius;

    public Circle() {

    radius = 0;

    }

    public Circle(double radius) {

    this.radius = radius;

    }

    public double getRadius() {

    return radius;

    }

    public void setRadius(double radius) {

    this.radius = radius;

    }

    public double getArea() {

    return calculateArea();

    }

    private double calculateArea() {

    return radius * radius * Math.PI;

    }

    public String toString() {

    return "The radius of the circle is: " + radius + ", and the area is: "

    + calculateArea();

    }

    }

    public class Rectangle {

    private static double length;

    private static double width;

    public Rectangle() {

    length=0.0;

    width=0.0;

    }

    public Rectangle(double l, double w) {

    length = l;

    width = w;

    }

    public double FindArea() {

    return length*width;

    }

    public double FindPerim() {

    return length*2 + width*2;

    }

    }

Still have questions? Get your answers by asking now.