What is wrong with the following code? // voluminous.java: interface voluminous { public double volume (); } // Box.java: class Box implements Voluminous { double length, width, height; public...


Java Programing


What is wrong with the following code?<br>// voluminous.java:<br>interface voluminous<br>{<br>public double volume ();<br>}<br>// Box.java:<br>class Box implements Voluminous<br>{<br>double length, width, height;<br>public Box(double 1, double w, double h)<br>{<br>length =<br>width = w;<br>height = h;<br>}<br>1;<br>public double getvolume ()<br>{<br>return (length * width * height);<br>}<br>}<br>O Nothing is wrong. The code will compile and work correctly.<br>O The getvolume method needs to have length. width, and height as parameters.<br>O The Box class doesn't have a method called volume so it doesn't correctly implement voluminous<br>O The variables (length . width. and height need an access level (e.g. public or private )<br>O The Box class must be defined as abstract , because only an abstract class can implement an interface.<br>

Extracted text: What is wrong with the following code? // voluminous.java: interface voluminous { public double volume (); } // Box.java: class Box implements Voluminous { double length, width, height; public Box(double 1, double w, double h) { length = width = w; height = h; } 1; public double getvolume () { return (length * width * height); } } O Nothing is wrong. The code will compile and work correctly. O The getvolume method needs to have length. width, and height as parameters. O The Box class doesn't have a method called volume so it doesn't correctly implement voluminous O The variables (length . width. and height need an access level (e.g. public or private ) O The Box class must be defined as abstract , because only an abstract class can implement an interface.

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here