Create a class called compartment which represents the ship compartments with attributes like height, width and breadth.
Answers
Answered by
0
Answer:
The program is written in java:-
import java . io . * ;
public class compartment
{
float height ;
float width ;
float breadth;
public compartment( float height , float width , float breadth )
{
height=this.height ;
width=this.width ;
breadth=this.breadth ;
}
}
Explanation:
In this program, the data members of the class are declared and a constructor is declared, where the members of the classes are initialized.
Similar questions
Political Science,
6 months ago
World Languages,
6 months ago
History,
6 months ago
Political Science,
1 year ago
Business Studies,
1 year ago
English,
1 year ago