Advertisement
jgarcia123

excercises week4

Oct 1st, 2014
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. package excercises;
  2. import java.awt.Rectangle;
  3. import java.util.*;
  4. public class excercise4{
  5.  
  6. private static int hight;
  7. private static int width;
  8.  
  9. public static int area(){
  10. int a = hight*width;
  11. return a;
  12. }
  13. public int getwidth(){
  14. return width;
  15. }
  16. public int gethight()
  17. {
  18. return hight;
  19. }
  20.  
  21. public static void main1(String args[]){
  22. Rectangle r;
  23. Rectangle r1=new Rectangle();
  24. r1.setRect(18, width, hight, 0);
  25. System.out.println("Area of R1: "+area());
  26. }
  27.  
  28. }
  29. package excercises;
  30. import java.awt.Rectangle;
  31. import java.util.*;
  32. public class excercise4{
  33.  
  34. private static int hight;
  35. private static int width;
  36.  
  37. public static int perimeter(){
  38. int p = hight+width+hight+hight;
  39. return p;
  40. }
  41. public int getwidth(){
  42. return width;
  43. }
  44. public int gethight()
  45. {
  46. return hight;
  47. }
  48.  
  49. public static void main1(String args[]){
  50. Rectangle r;
  51. Rectangle r1=new Rectangle();
  52. r1.setRect(18, width, hight, 0);
  53. System.out.println("Area of R1: "+perimeter());
  54. }
  55. package excercises;
  56.  
  57. import java.util.Random;
  58.  
  59. public class rand {
  60.  
  61. public static void main(String[] args) {
  62. Random random = new Random();
  63. System.out.println(random.nextInt(6));
  64. }
  65.  
  66. }
  67.  
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement