Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
Java
public class Main{
   public static void main(String [] args){
       Persegi persegi = new Persegi();
       persegi.sisi = 8;
       System.out.println(persegi.computeArea());
   }
}

public interface BangunDatar {
   public float computeArea();
   public float computeAround();
}

public class Persegi implements BangunDatar {
   public int sisi;

   public Persegi(){}
   public Persegi(int sisi) {
       super();
       this.sisi = sisi;
   }
@Override
   public float computeArea() {
       // TODO Auto-generated method stub
       return this.sisi*this.sisi;
   }

   @Override
   public float computeAround() {
       // TODO Auto-generated method stub
       return 4*this.sisi;
   }

}

public class BangunRuang implements BangunDatar {

   @Override
   public float computeArea() {
       // TODO Auto-generated method stub
       return 0;
   }

   @Override
   public float computeAround() {
       // TODO Auto-generated method stub
return 0;
   }

   public float computeVolume() {
       return 0;
   }

}

public class Kubus extends BangunRuang implements BangunDatar {
   public int rusuk;

   public Kubus(int rusuk) {
       super();
       this.rusuk = rusuk;
   }

   @Override
   public float computeArea() {
       // TODO Auto-generated method stub
       return 6*this.rusuk*this.rusuk;
   }

   @Override
   public float computeAround() {
       // TODO Auto-generated method stub
       return 12*this.rusuk;
}

   @Override
   public float computeVolume() {
       // TODO Auto-generated method stub
       return this.rusuk*this.rusuk*this.rusuk;
   };
}


What I have tried:

Java
public class Main{
   public static void main(String [] args){
       Persegi persegi = new Persegi();
       persegi.sisi = 8;
       System.out.println(persegi.computeArea());
   }
}

public interface BangunDatar {
   public float computeArea();
   public float computeAround();
}

public class Persegi implements BangunDatar {
   public int sisi;

   public Persegi(){}
   public Persegi(int sisi) {
       super();
       this.sisi = sisi;
   }
@Override
   public float computeArea() {
       // TODO Auto-generated method stub
       return this.sisi*this.sisi;
   }

   @Override
   public float computeAround() {
       // TODO Auto-generated method stub
       return 4*this.sisi;
   }

}

public class BangunRuang implements BangunDatar {

   @Override
   public float computeArea() {
       // TODO Auto-generated method stub
       return 0;
   }

   @Override
   public float computeAround() {
       // TODO Auto-generated method stub
return 0;
   }

   public float computeVolume() {
       return 0;
   }

}

public class Kubus extends BangunRuang implements BangunDatar {
   public int rusuk;

   public Kubus(int rusuk) {
       super();
       this.rusuk = rusuk;
   }

   @Override
   public float computeArea() {
       // TODO Auto-generated method stub
       return 6*this.rusuk*this.rusuk;
   }

   @Override
   public float computeAround() {
       // TODO Auto-generated method stub
       return 12*this.rusuk;
}

   @Override
   public float computeVolume() {
       // TODO Auto-generated method stub
       return this.rusuk*this.rusuk*this.rusuk;
   };
}
Posted
Updated 13-Jul-22 5:05am
v3
Comments
0x01AA 13-Jul-22 10:31am    
Sir, is it ok for you to have have an answer in about 2 hours?
Anchal sharma 2022 13-Jul-22 10:47am    
Hello, Thank you but you can leave this as this is done . I don't want to waste your time.
Richard Deeming 13-Jul-22 10:31am    
No.

Nobody here is going to do your homework for you.

And demanding that we do it "fast" simply tells us that you can't be bothered to manage your own time, so any attempt to help you is pointless.
Richard MacCutchan 13-Jul-22 10:39am    
The answer is 64.0.
CPallini 13-Jul-22 10:41am    
I reckon 'Persegi' is Rectangle.
I reckon 'Kubus' is 'Cube'.
Now, what (the fresh Hell) is a 'BangunRuang' ?

We can't, for a number of reasons:
1) We have no idea what the code is meant to do, so we have no idea if what it does do is by intent or an error.

2) We have no idea how to use your code, or what test data it expects.

And even if we did and could, there is also this:

3) While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
 
Share this answer
 
No problem

My rates;

$75/hr. 24hr turn around
$125/hr, fast turn around


Please let me know quickly
 
Share this answer
 
Comments
OriginalGriff 13-Jul-22 11:14am    
You forgot "Pro Froma" for new customers. :D
Mike Hankey 13-Jul-22 11:22am    
Only except wire transfers... :)
Dave Kreskowiak 13-Jul-22 12:01pm    
You forgot the "minimum 4 hours, even if it take 5 minutes. Payable up front."
Mike Hankey 13-Jul-22 12:21pm    
Ah good point, I'll amend the contract!
0x01AA 13-Jul-22 12:40pm    
Even I can feel with that answer, we should take care HOW TO ANSWER A QUESTION - C# Discussion Boards[^] and here 'Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid..'

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900