Created
October 18, 2020 11:40
-
-
Save AakashCode12/3851cbb3998f3387d59689a929098434 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import areacalc.area; | |
import areacalc.perimeter; | |
//import areacalc.*; | |
class ar { | |
public static void main(String[] args) { | |
area a = new area(); | |
perimeter p = new perimeter(); | |
System.out.println("area is " + a.areaRect(4, 5)); | |
System.out.println("area is " + a.areaSquare(5)); | |
System.out.println("perimeter is " + p.perirect(4, 5)); | |
System.out.println("perimeter is " + p.perisquare(5)); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package areacalc; | |
public class area { | |
public static void main(String[] args) { | |
} | |
public int areaRect(int length, int breadth) { | |
return length * breadth; | |
} | |
public int areaSquare(int side) { | |
return side * side; | |
} | |
public float areaTriangle(int base, int height) { | |
return 0.5f * base * height; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package areacalc; | |
//this statement indicates the name of the package into which we want to include our class | |
public class perimeter { | |
public static void main(String[] args) { | |
} | |
public int perisquare(int side) { | |
return 4 * side; | |
} | |
public int perirect(int length, int breadth) { | |
return 2 * (length + breadth); | |
} | |
public float pericircle(float radius) { | |
return 2 * 3.14f * radius; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment