Welcome Guest.

1Answers

Cube class:

Asked by: Timothy Turner 190 views IT January 22, 2019

There are three attributes: length, width, and height. Define two constructors Cube(int a, int b, int c) and Cube(int length, int wide) to initialize the object and define a setHeight(int h). To set the height of the box. Define the area() method to calculate the surface area of ​​the cuboid, and the volume() method to calculate the volume of the cuboid.

1 Answers

  1. +3Votes  

    What language, C#?JAVA? C++? Or other?

    This is the most basic (of course requires a mathematical foundation)

    pseudo code

    class Cube {

        Int l,w,e;

    Cube(int a,int b,int c) { l=a;w=b;h=c; }

    Cube(int length , int wide) { l=length;b=wide;}

    void setHeight(int h) { this.h=h;}

    int area() {2* (l*w+w*e+l*e) ; }

    int volume() return l*w*e;

    Joshua Morgan- January 22, 2019 |