40 likes | 62 Views
C++ ADT Example The Stack. Java ADT Example The Stack. C++ Parameterized ADT The Stack. Java Naming Encapsulation Example. package Square; public class area { public double compute(double side) { return (side*side); } }. package Circle; public class area {
E N D
C++ ADT Example The Stack
Java ADT Example The Stack
C++ Parameterized ADT The Stack
Java Naming Encapsulation Example package Square; publicclass area { public double compute(double side) { return (side*side); } } package Circle; publicclass area { public double compute(double radius) { return (3.14*radius*radius); } } import java.lang.*; import Circle.area; publicclass Main { public Main() { } publicstaticvoid main(String[] args) { Square.area s = new Square.area(); area c = new area(); System.out.print("Circle area: "); System.out.println(c.compute(5.0)); System.out.print("Square area: "); System.out.println(s.compute(5.0)); } }