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
Given the following word addresses: 3, 180, 43, 2,191, 88, 190, 14, 181, 44, 186, 253
professor190 [17]

Answer:

A. index bits = 2, tag bits = 2, block offset bits = 1, it is a miss.

B. index bits = 2, tag bits = 1, block offset bits = 0, it is a hit

C. the miss rate is 0

Explanation:

a. number of blocks = 12

number of blocks per set = 3

number of set = number of blocks / number of blocks per set = 12/3 = 4

word size = 24

block size = 2

the block offset = log_{2} block size

   = log_{2} 2 = 1

the index bits = log_{2} number of set = log_{2} 4 = 2

the tag bits = (log_{2} word size) - offset - index = (log_{2} 24) -2 - 1 = 5 -2 - 1 = 2

b. word size = 8

block size = 1

the block offset = log_{2} block size

   = log_{2} 1 = 0

the index bits = log_{2} number of set = log_{2} 4 = 2

the tag bits = (log_{2} word size) - offset - index = (log_{2} 8) -2 - 1 = 3 - 0- 2= 1

7 0
3 years ago
Difference between multidimensional arrays and an example​
weqwewe [10]

Answer:

The generic data structure of a n-dimensional array is a tensor.

An example with 3 dimension can be a cube that contains the following dimensions: users, items, time. That cube can represent the interactions of  users with verifiied pages of public interests (influencers or company/media pages) in time slots (e.g. weekly timeslots).

Explanation:

You can represent in a sparse 3-dimensional array (tensor) the combinations of which user interacted with wich item in a given timeslow.

5 0
3 years ago
Rafter type and Truss type?
docker41 [41]

Answer:

Trusses and rafters are both assembled ahead of being installed onto the roof. Trusses are assembled in a factory using pre-engineered structures and joints. ... Rafters contain two main outer beams which support the roof structure. On the other hand, trusses come with multiple beams which add more support.

As the trusses come with a web of triangles inside the main frame, they provide more support than the rafters.

Trusses and rafters are both assembled ahead of being installed onto the roof. Trusses are assembled in a factory using pre-engineered structures and joints. On the other hand, rafters are assembled at the construction site. As trusses are assembled in a factory, a lot of time can be saved.

When comparing the cost of rafters and trusses, the latter ones cost more. But when considering the labor cost of constructing the roof using other means, it is better to purchase the trusses even though the costs are a bit higher. This is because there is no need to assemble the structure again at the construction site as they have been already assembled at the factories. But as rafters have to be assembled at the construction site, they involve more labor costs.

Summary:

1. Though both rafters and trusses are triangles in shape, the trusses have more triangle webs inside the principle frame.

2. Trusses are assembled in a factory using pre-engineered structures and joints. On the other hand, rafters are assembled at the construction site.

3. When comparing the cost of rafters and trusses, the latter ones cost more. But when considering the labor cost of constructing the roof using other means, it is better to purchase the trusses even though the costs are a bit higher.

4. As rafters have to be assembled at the construction site, they involve more labor costs.

5. Rafters contain two main outer beams which support the roof structure. On the other hand, trusses come with multiple beams which add more support.

6. Trusses also add an aesthetic beauty to the roofs.

8 0
2 years ago
4-Translate the following C program to MIPS assembly program (Please explain each instruction in your code by a comment and subm
earnstyle [38]

Answer:

.data

str1: .asciiz "Hello"

str2: .asciiz "mars"

msg: .asciiz "String after the concatenate: "

.text

main:

#load the address str1 to $a0

la $a0,str1

#initialize $t0 with 0

li $t0,0

#loop to find the length of str1

#$t0 stores the length of str1

loop1:

#load byte of $a0 to $t1

lb $t1,0($a0)

#branch for equal.If $t1 equal to 0,jump to label stop1

beq $t1,0,stop1

addi $t0,$t0,1 #increase the count

addi $a0,$a0,1 #increase the address

#jump to label loop1

j loop1

stop1:

#load the address of str2 to $a1

la $a1,str2

#loop2 concatenate the each element in str2 to str1

loop2:

lb $t2,0($a1) #load character in str2 to $t2

sb $t2,0($a0) #store value in $t2 to str1

beq $t2,0,stop2

addi $a1,$a1,1 #increase the address of str2

addi $a0,$a0,1 #increase the address of str1

j loop2

stop2:

#syscall for print string is $v0 = 4

#syscall to termiante the program is $v0 = 10

#print the message

li $v0, 4

la $a0, msg

syscall

#print the concatenated string

li $v0,4

la $a0,str1

syscall

#termiante the program

li $v0, 10

syscall

Explanation:

3 0
3 years ago
Which type of software is offered in trial form or for a limited period of time?
kkurt [141]

The type of software which is offered in trial form or for a limited period of time is called shareware.

Software which are offered for free in trial form or for a limited time period are called shareware. They operate on the principle that once the user understands what the software can offer they will pay to use it later.

Most shareware software has built in countdowns which start as soon as you start the trial and at the end of which access is automatically revoked. They require the user to form a simple account. These versions generally provide a very basic selection of functions and are used to rake in more paying users.

Types of shareware include:

  1. Adware: It stands for advertising-supported software where the advertisements generate revenues.
  2. Demoware: This is a trial version of the original software including all features.
  3. Crippleware: This software is free but provides limited features till it is purchased.
  4. Trialware

This provides the user with full feature access for a time limit and then requires purchase.

You can learn more about shareware software at

brainly.com/question/4593389

#SPJ4

3 0
2 years ago
Other questions:
  • Which of the following are unsponsored Internet domain extensions? .museum .gov .edu none of the above
    8·2 answers
  • A network in which communication passes from one person to another in a sequential pattern rather than being shared among member
    6·2 answers
  • What will be printed when the method printstuff is called?
    7·1 answer
  • Iisa is creating a resume in which section should she mention her career goals
    6·1 answer
  • Data that are collected on large populations of individuals and stored in databases are referred to as _____.
    15·1 answer
  • B. Does “refactoring” mean that you modify the entire design iteratively? If not, what does it mean?
    7·1 answer
  • Which is a primary document?<br> a. letter<br> b. dictionary<br> c. textbook<br> d. website
    11·1 answer
  • What is the difference between a 13 column abacus and 5 column abacus?
    10·1 answer
  • What feature do you need on a computer if you want to take it on vacation to another continent?A. Dual-voltage selector switch B
    10·1 answer
  • Explain two protocols to enhance cellular networks capacity?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!