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
Tju [1.3M]
3 years ago
9

Create a base class named rectangle that contains lenght and width data members.

Computers and Technology
1 answer:
kumpel [21]3 years ago
4 0

Answer:

class Rectangle:  

   

   def __init__(self, length, width):

       self.length = length

       self.width = width

       

   

   def area(self):

       area = self.length*self.width

       return area

   

   

class Box (Rectangle):

   

   def __init__(self, length, width, height):

       super().__init__(length, width)

       self.height = height

       

   def volume(self):

       volume = self.length * self.width * self.height

       return volume

   

   def area(self):

       area = 2*(self.length*self.width) + 2*(self.length*self.height) + 2*(self.width*self.height)

       return area

rec_1 = Rectangle(2,4)

box_1 = Box(2,2,6)

print(box_1.length)

print(box_1.area())

   

print(rec_1.length)

print(rec_1.area())

Explanation:

The programming language used is python.

class Rectangle

The class Rectangle is created with attributes length and width.

The class attributes are initialized using the __init__ constructor.

In the rectangle class, a method/function is declared to return the area of the rectangle.

class Box

This class is a child of rectangle and it inherits all its attributes and methods,

It has an additional attribute of depth and its constructor is used to initialize it.

The class contains a volume function, that returns the volume and an override function 'area()' that displaces the area from the parent class.

Finally, some instances of both classes are created.

You might be interested in
Characteristics of successful entrepreneurs include
crimeas [40]
The answer would be A because grit means to fight hard to get what you want. Submission would be to give in to pressure and give up. Self-importance would be to only focus on yourself and no one else. A short attention span would not work out for you because you get distracted easily.
8 0
3 years ago
A _ is the acknowledgment of a potential noncomformity, or an opinion regarding an issue that is not covered by a standard
sleet_krkn [62]
Assumption - hope this helped took the test and got 100
5 0
3 years ago
1. Implement a method factorial(int n), that takes a number (int) and returns its factorial. Factorial of an integer is the prod
marysya [2.9K]

Answer:

import java.io.*;

import java.util.*;

public class Main

{

public static int factorial(int n){

if (n == 0)

return 1;    

else

return(n * factorial(n-1)); //recursively calling factorial function

}

public static void fibbonaci(int n)

{

if(n>0)

{

c=a+b; //next term in series

a=b;

b=c;

System.out.print(" "+c);    

fibbonaci(n-1); //recursively calling fibbonaci function

}

}

static int a=0,b=1,c;

  public static void main(String[] args) {

  int list_num,fact;

      List<Integer> num=Arrays.asList(1,3,5,7,9); //arraylist with 1,3,5,7,9

      for(Integer i:num) //for-each loop

      {    

      a=0;

      b=1;

      list_num=i.intValue();

      System.out.println("Fibbonaci series for "+list_num);

      System.out.print(a+" "+b);

      fibbonaci(list_num-2); //calling fibbonaci for values in list

      fact=factorial(list_num); //calling factorial for values in list

      System.out.println();

      System.out.println("Factorial for "+list_num+" is "+fact);

      System.out.println();

     

      }

  }

}

6 0
4 years ago
4. Assuming that social networking at the resorts will require wireless communication and connection to the Internet, what are s
Studentka2010 [4]

Answer:

Social networking capabilities could be made available by the presence of SBRUs central servers and local resort's server. For resorts that are using SBRU servers, there will be high bandwidth access to the internet. This can create a service level of 100% availability. However, for the resorts with high usage clients, a local server could be provided. Similar support will be needed and it will encourage local communication. The possible issues will be problems of connectivity, reliability as well as bandwidth.

Explanation:

Social networking capabilities could be made available by the presence of SBRUs central servers and local resort's server. For resorts that are using SBRU servers, there will be high bandwidth access to the internet. This can create a service level of 100% availability. However, for the resorts with high usage clients, a local server could be provided. Similar support will be needed and it will encourage local communication. The possible issues will be problems of connectivity, reliability as well as bandwidth.

8 0
3 years ago
In database systems, the dbms enforces rules about which user can perform which action when. The rules are known as ________.
saw5 [17]

I guess the correct answer is concurrency control

Cοncurrеncy cοntrοl is a databasе managеmеnt systеms (DBMS) cοncеpt that is usеd tο addrеss cοnflicts with thе simultanеοus accеssing οr altеring οf data that can οccur with a multi-usеr systеm.

In database systems, the DBMS enforces rules about which user can perform which action when. The rules are known as concurrency control.

6 0
3 years ago
Other questions:
  • A _____________ is a method of controlled entry into a facility and provides access to secure areas such as a research lab or da
    10·1 answer
  • To execute a prepared SQL statement, you can use the ________________ and execute() methods of the PDOStatement object to set pa
    10·1 answer
  • How to wire two separate switches &amp; lights using the same power source?
    14·1 answer
  • Assuming that we only support BEQ and ADD instructions, discuss how changes in the given latency of this resource affect the cyc
    7·1 answer
  • Henry has created a software product that manages a database of company clients. He wants to install the software on a client's
    13·1 answer
  • You can perform an in-place upgrade to Windows 7 from both Windows XP and Windows Vista
    11·2 answers
  • Lol fortnite really going UwU and anime
    12·2 answers
  • What kinds of new input devices do you think might be invented in 10, 20, or 50 years? How might those devices change the world?
    9·1 answer
  • The objective of this task is to use Scapy to estimate the distance, in terms of number of routers, between your VM and a select
    7·2 answers
  • In a _____, there is no skipping or repeating instructions. A. iteration B. sequence C. selection D. conditional
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!