Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package excercises;
- import java.awt.Rectangle;
- import java.util.*;
- public class excercise4{
- private static int hight;
- private static int width;
- public static int area(){
- int a = hight*width;
- return a;
- }
- public int getwidth(){
- return width;
- }
- public int gethight()
- {
- return hight;
- }
- public static void main1(String args[]){
- Rectangle r;
- Rectangle r1=new Rectangle();
- r1.setRect(18, width, hight, 0);
- System.out.println("Area of R1: "+area());
- }
- }
- package excercises;
- import java.awt.Rectangle;
- import java.util.*;
- public class excercise4{
- private static int hight;
- private static int width;
- public static int perimeter(){
- int p = hight+width+hight+hight;
- return p;
- }
- public int getwidth(){
- return width;
- }
- public int gethight()
- {
- return hight;
- }
- public static void main1(String args[]){
- Rectangle r;
- Rectangle r1=new Rectangle();
- r1.setRect(18, width, hight, 0);
- System.out.println("Area of R1: "+perimeter());
- }
- package excercises;
- import java.util.Random;
- public class rand {
- public static void main(String[] args) {
- Random random = new Random();
- System.out.println(random.nextInt(6));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement