Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class CheckMail
- {
- private double length;
- private double width;
- private double height;
- private double weight;
- private double girth;
- public CheckMail()
- {
- length = width = height = weight = 0;
- }
- public CheckMail(int dim1, int dim2, int dim3, int lb)
- {
- double length = dim1;
- double width = dim2;
- double height = dim3;
- double weight = lb;
- }
- public double Calc()
- {
- if(length<width)
- {
- width=length;
- }
- else if(length<height)
- {
- height=length;
- }
- System.out.println("The longest dimension is: " + length);
- System.out.println("The girth is: " + girth);
- double girth = 2*(width+height);
- return girth;
- }
- public void Package()
- {
- if(weight>70 && (length+girth)>100)
- {
- System.out.println("Package is too large and too heavy.");
- }
- else if(weight<=70 && (length+girth)>100)
- {
- System.out.println("Package is too large.");
- }
- else if(weight>70 && (length+girth)<=100)
- {
- System.out.println("Package is too heavy.");
- }
- else if(weight<=70 && (length+girth)<=100)
- {
- System.out.println("Package is acceptable.");
- }
- }
- }
Add Comment
Please, Sign In to add comment