Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package proj27012023;
- public class TestBox {
- public static void main(String[] args) {
- Box b1 = new Box(5, 7, 12);
- b1.setLength(10.0);
- System.out.println("Volume=" + b1.getVolume());
- System.out.println(b1);
- double v = b1.getVolume();
- double l = Math.pow(v, 1.0 / 3.0);
- Box b2 = new Box(l, l, l);
- System.out.println(b1.getVolume());
- System.out.println(b2.getVolume());
- if (Math.abs(b1.getVolume() - b2.getVolume()) < 0.000001)
- System.out.println("OK");
- else {
- System.out.println("Error");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement