Advertisement
Guest User

Untitled

a guest
Oct 7th, 2015
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. // The "Create_rectangal_with_cahangable_values" class.
  2. // William-Godkin_ICS201
  3. import java.awt.*;
  4. import hsa.Console;
  5.  
  6. public class Create_rectangal_with_cahangable_values
  7. {
  8. static Console c; // The output console
  9.  
  10. public static void main (String[] args)
  11. {
  12. c = new Console ();
  13.  
  14. //declare vareiables
  15.  
  16. int leangth, width;
  17.  
  18. //input values
  19.  
  20. c.print ("Enter in the leangth (>1) ");
  21. leangth = c.readInt ();
  22.  
  23. c.print ("Enter in the width (>1) ");
  24. width = c.readInt ();
  25.  
  26. c.println ("The leangth is " + leangth + "and the width is " + width);
  27.  
  28. c.print (" ");
  29. for (int counter = 1 ; counter <= leangth ; counter++)
  30. {
  31. c.print ("_");
  32. }
  33.  
  34. c.println ("");
  35.  
  36. for (int counter = 2 ; counter <= width ; counter++)
  37. {
  38. c.print ("|");
  39. for (int counter2 = 1 ; counter2 <= leangth ; counter2++)
  40. {
  41. c.print (" ");
  42. }
  43. c.println ("|");
  44. }
  45.  
  46. c.print ("|");
  47.  
  48. for (int counter = 1 ; counter <= leangth ; counter++)
  49. {
  50. c.print ("_");
  51. }
  52.  
  53. c.println ("|");
  54.  
  55. c.println ("So there you hve it the rectangle and the leangth and the width.");
  56. } // main method
  57. } // Create_rectangal_with_cahangable_values class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement