Guest User

Untitled

a guest
Jan 21st, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class CheckMail
  4. {
  5. private double length;
  6. private double width;
  7. private double height;
  8. private double weight;
  9. private double girth;
  10.  
  11. public CheckMail()
  12. {
  13. length = width = height = weight = 0;
  14. }
  15.  
  16. public CheckMail(int dim1, int dim2, int dim3, int lb)
  17. {
  18. double length = dim1;
  19. double width = dim2;
  20. double height = dim3;
  21. double weight = lb;
  22. }
  23.  
  24. public double Calc()
  25. {
  26. if(length<width)
  27. {
  28. width=length;
  29. }
  30. else if(length<height)
  31. {
  32. height=length;
  33. }
  34. System.out.println("The longest dimension is: " + length);
  35. System.out.println("The girth is: " + girth);
  36. double girth = 2*(width+height);
  37. return girth;
  38. }
  39.  
  40. public void Package()
  41. {
  42. if(weight>70 && (length+girth)>100)
  43. {
  44. System.out.println("Package is too large and too heavy.");
  45. }
  46. else if(weight<=70 && (length+girth)>100)
  47. {
  48. System.out.println("Package is too large.");
  49. }
  50. else if(weight>70 && (length+girth)<=100)
  51. {
  52. System.out.println("Package is too heavy.");
  53. }
  54. else if(weight<=70 && (length+girth)<=100)
  55. {
  56. System.out.println("Package is acceptable.");
  57. }
  58. }
  59. }
Add Comment
Please, Sign In to add comment