answersLogoWhite

0


Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: What is the class width for the class 79-99?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Create a class rectangle The class has attributes length and width each of which is defaults to 1 It has member functions that calculates the perimeter and the area of the rectangle it has set?

public class Rect { private int width, height; public Rect() { width = height = 1; } public Rect(int w, int h) { width = w; height = h; } public int getWidth() { return width; } public int getHeight() { return height; } public void setWidth(int w) { width = w; } public void setHeight(int h) { height = h; } public int getPerimeter() { return 2 * (width + height); } public int getArea() { return width * height; } }


Example of area of rect inheritance program in java?

Let us first define a generic Shape class. This will be an abstract class, since the term "shape" is, itself, very abstract. Let us also assume that this shape is defined in only two dimensions, for the sake of simplicity. abstract class Shape { /* One of the properties of any 2D shape is the area it takes up. Since calculating the area depends on the shape, we'll make this method abstract - all subclasses should implement it differently. */ abstract int getArea(); } Now that we have our base class defined, we can create a rectangle subclass. class Rectangle extends Shape { /* While a rectangle has other properties, we are really only interested in the ones required to calculate the area - width and height. */ int width; int height; /* What's the area of a rectangular shape? area = width x height */ int getArea() { return width*height; } }


Write a program to demonstrate constructor overloading?

Constructor overloading is similar to method overloading. You can overload constructors by changing the parameter list in the class definition. Here is an example public class Box{ private int height; private int width; private int breadth; // First constructor with no parameters Box(){ height = 0; width = 0; breadth = 0; } // This is the second overloaded constructor Box(int h,int w,int b){ height = h; width = w; breadth = h; } public void display(){ System.out.println("Height: "+height+" Width: "+width+" Breadth: "+breadth); } public static void main(String args[]){ Box obj = new Box(1,2,3); obj.display(); } }


What is instantiating in java?

To instantiate is to create a new "instance" of an "object" in object-oriented programming. For example, say you create an Object by defining a class called Square: (note: this is C++ but the principles are the same) class Square{ private: int length, width; public: getArea(){return length*width); }; The above class is an Object. When you create this object, that is called an "instance" of the object: int main() { Square x = new Square; // x is an "instance" of the Square "object" Square y = new Square; // y is a separate "instance" of the Square "object" return 0; }


What is the standard width of a staircase?

it can be any width