Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package sam.male;
- public class Box {
- double length;
- double width;
- double height;
- Box(double x,double y,double z){
- length=x;
- width=y;
- height=z;
- }
- Box(Box b){
- length=b.length;
- width=b.width;
- height=b.height;
- }
- Box(double leng){
- length=width=height;
- }
- Box(){
- height=1;
- width=1;
- length=1;
- }
- double vol() {
- return length*width*height;
- }
- double area(){
- return length*width;
- }
- }
- class Bweight extends Box{
- double weight;
- Bweight(Bweight b){
- super(b);
- weight=b.weight;
- }
- Bweight(double x, double y,double z,double a){
- super(x,y,z);
- weight=a;}
- Bweight(){
- super();
- weight=1;
- }
- Bweight(double leng, double a){
- super(leng);
- weight=a;
- }
- static class Demo {
- public static void main (String args[]){
- Bweight wei = new Bweight(3,4,5,7);
- double vol;
- vol=wei.vol();
- System.out.print(vol);
- }
- }}
Advertisement
Add Comment
Please, Sign In to add comment