1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Westkost [7]
4 years ago
9

Although saying "Cylinder IS A Circle" doesn't make sense, it can be implemented in Java using inheritance in a legitimate way.

Implement Circle and Cylinder classes with fields, constructors and methods required to demonstrate all aspects of legitimate inheritance.
Computers and Technology
1 answer:
allochka39001 [22]4 years ago
8 0

Answer:

I've included in the codes the area to circle and volume to cylinder. The Volume method that was used, area() to compute, the volume of cylinder which shows that cylinder is an expansion of circle with an extra dimension (height)

Explanation:

Temp is tester class

public class Temp {

   public static void main(String[] args) {

       Circle c = new Circle(7);

       System.out.println("Area of circle with radius 7 is "+c.area());

       Cylinder c1 = new Cylinder(7,10);

       System.out.println("Cylinder volume with radius 7 and height 10: "+c1.volume());

   }

}

----------------------------------------------------------------------------------------------------

class Circle{

   int radius;

   Circle(int r){

       radius=r;

   }

   double area(){  //area of circle

       return 3.14*radius*radius;

   }

   public int getRadius() {

       return radius;

   }

   public void setRadius(int radius) {

       this.radius = radius;

   }

}

class Cylinder extends Circle{

   int height;

   Cylinder(int r, int h){

       super(r);

       height=h;

   }

   double volume(){  //volume of cylinder

       return area()*height;

   }

   public int getHeight() {  //accessor

       return height;

   }

   public void setHeight(int height) {  //mutator

       this.height = height;

   }

}

You might be interested in
A cell reference is also called a cell _______.
viva [34]
A cell reference is also called a cell address.
7 0
3 years ago
What is the extension of Qbasic ?​
abruzzese [7]

There are four types of operator in QBASIC. They are Arithmetic operators,relational operators,logical operators and sting operator .a. arithmetic operators. Arithmetic operators are used to preform mathematical calculations like addition, subtraction, division, multiplication and exponential

7 0
3 years ago
Read 2 more answers
George enters the types of gases and the amount of gases emitted in two columns of an Excel sheet. Based on this data he creates
Alex777 [14]

Answer:

data source

Explanation:

The main aim of a data source is for the gathering of all necessary information that is needed to access a data. Since he has used the information to create a pie chart, this means that some data were used for the creation of this pie chart. Hence the information used for the creation of the pie chart is the data source for the information illustrated on the pie chart.

3 0
4 years ago
Which list method allows elements in a sequence to be removed and added at either end of the structure?
Amanda [17]

Answer:

b) queue

Explanation:

Queue is also an abstract data type or a linear data structure, just like stack data structure, in which the first element is inserted from one end called the REAR(also called tail), and the removal of existing element takes place from the other end called as FRONT(also called head).

4 0
3 years ago
Read 2 more answers
P2p networks are most commonly used in home networks. <br> a. True <br> b. False
postnew [5]
<span>The statement that P2P networks are most commonly used in home networks is true. 
</span>P2P stands for peer-to-peer communication network. It is an example of local administration. <span> Two or more PCs share files and access to devices such as printers without requiring a separate server computer or server software with P2P type of network.</span>
6 0
4 years ago
Other questions:
  • Spreadsheet software creates a ____, composed of a grid of columns and rows
    6·1 answer
  • Describe the Software Development Life Cycle. Describe for each phase of the SDLC how it can be used to create software for an E
    14·1 answer
  • What are the key goal, performance, and risk indicators?
    15·1 answer
  • Among the many DTP software tools available today, which is regarded as the industry standard for DTP?
    13·2 answers
  • A(n) ________ is a variable that receives an argument that is passed into a function. global argument scope parameter
    15·1 answer
  • You would like to conduct a survey and ask your web page visitors to indicate the computer operating systems that they use. Each
    10·1 answer
  • Individuals who require better speed and performance for graphics-intensive applications (e.g., video editing, gaming, etc.) pre
    8·1 answer
  • The Cursor is blinking in a white area on the Screen. This area where text will appear in the ____.
    10·2 answers
  • Write a program to read 10 integers from an input file and output the average, minimum, and maximum of those numbers to an outpu
    14·1 answer
  • What happens when you apply a theme to a form?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!