1. Suppose you are working in an airline company. Customers check baggage with various sizes and weights. Each piece of baggage has its own dimensions (length, width, height) as well as weight. You will write a Java program that allows the airline staff to input baggage dimensions and weight information. The computer will determine if the baggage is allowed to be checked in. If it is allowed, the system will then calculate the price based on the size and weight. If not allowed, the system will notify the staff by telling that piece of baggage is not allowed due to the weight limit and/or size limit.
The baggage policy of this airline company is as follows:
(1) Any dimension (length, width, height) should not exceed 32 inches. Total dimensions (length+width+height) should not be over 60 inches.
(2) Weight limit for each piece of baggage is 50 pounds. Any baggage more than 50 pounds will not be accepted.
(3) The price for each piece of baggage is determined by its weight at the rate of $1.50 per pound. However, there is a minimum charge of $5.00 regardless of weight (this is not a base charge).
Example: (1) Customer A brings her luggage case weighted at 75 pounds. This piece will be rejected due to the weight limit.
(2) Customer B brings a small box (2 inches by 2 inches by 3 inches) weighted at 3 pounds. The charge is $5.00 not $4.50.
(3) Customer C brings a large box (20 inches by 30 inches by 15 inches) weighted at 45 pounds. This piece will be rejected due to the size limit.
(4) Customer D brings his luggage case (10 inches by 30 inches by 5 inches) weighted at 20 pounds. This luggage case is accepted and the charge is $30.00.
Instructions on coding: (1) You will need to write separate classes. One is the main class (the driver) and the other one is the Baggage class that handles weights, sizes, prices, etc.
(2) Inputs of weight and three dimensions are from the keyboard.
(3) Your program should accept one entry with inputs of three dimensions and weight information. You do not have to write a loop to accept multiple entries at this time. But if you write the loop, it will be accepted and welcomed.
Note: Could you plz go through this code and let me
know if u need any changes in this.Thank You
_________________
// Baggage.java
public class Baggage {
//Declaring instance variables
private int length;
private int width;
private int height;
private int weight;
//Parameterized constructor
public Baggage(int length, int width, int height, int
weight) {
this.length = length;
this.width = width;
this.height = height;
this.weight = weight;
}
// getters and setters
public int getLength() {
return length;
}
public void setLength(int length) {
this.length = length;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public int getWeight() {
return weight;
}
public void setWeight(int weight) {
this.weight = weight;
}
public double calculatePrice() {
double perPoundCharge = 1.5;
double price = 0;
if (length > 32 || width > 32
|| height > 32
|| (length + width + height) > 60) {
System.out.println("The Price is rejected due to size
limit.");
price =
-1;
}
else if(weight > 50)
{
System.out.println("This piece will be rejected due to the weight
limit.");
price =
-1;
}
else {
if (weight *
perPoundCharge < 5) {
price = 5.0;
} else {
price = weight * perPoundCharge;
}
}
return price;
}
}
____________________________
// Test.java
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
int
length,width,height,weight;
/*
* Creating an Scanner class object
which is used to get the inputs
* entered by the user
*/
Scanner sc = new
Scanner(System.in);
//Getting the input entered by
the user
System.out.print("Enter length :");
length=sc.nextInt();
System.out.print("Enter width :");
width=sc.nextInt();
System.out.print("Enter height :");
height=sc.nextInt();
System.out.print("Enter weight :");
weight=sc.nextInt();
Baggage b=new Baggage(length, width, height, weight);
if(b.calculatePrice()!=-1)
{
System.out.printf("This luggage case is accepted and the charge is
$%.2f.\n",b.calculatePrice());
}
}
}
____________________________________
Output#1::
Enter length :2
Enter width :2
Enter height :2
Enter weight :3
This luggage case is accepted and the charge is
$5.00.
____________________________
Output#2::
Enter length :20
Enter width :30
Enter height :15
Enter weight :45
The Price is rejected due to size limit.
____________________________
Output#3::
Enter length :10
Enter width :30
Enter height :5
Enter weight :20
This luggage case is accepted and the charge is
$30.00.
_______________Could you plz rate me well.Thank You
1. Suppose you are working in an airline company. Customers check baggage with various sizes and...
Part 1. 3.13 Overweight baggage: Suppose weights of the checked baggage of airline passengers follow a nearly normal distribution with mean 44.8 pounds and standard deviation 3.3 pounds. Most airlines charge a fee for baggage that weigh in excess of 50 pounds. Determine what percent of airline passengers incur this fee. (Round to the nearest percent.) __________. Part 2. There are two distributions for GRE scores based on the two parts of the exam. For the verbal part of the...
C++ Lone Star Package Service ships packages within the state of Texas. Packages are accepted for shipping subject to the following restrictions: Shipping requirements The package weight must not exceed 50 pounds. The package must not exceed 3 feet in length, width, or height. The girth of the package must not exceed 5 feet. The girth is the circumference around the two smallest sides of the package. If side1, side2, and side3 are the lengths of the three sides, and...
Sing to your answers and simplify your answers whenever possible. 1. A shipping company offers various sized shipping boxes to its customers. Some of these boxes are cube-shaped, with equal height, width, and depth. As part of an upcoming sales promotion, the company will offer two cube-shaped boxes for the price of one. a. Write an expression to represent the total volume of two different sized boxes as a sum of cubes if one of the boxes has sides with...
summarizr the followung info and write them in your own words and break them into different key points. 6.5 Metering Chamber: 6.5.1 The minimum size of the metering box is governed by the metering area required to obtain a representative test area for the specimen (see 7.2) and for maintenance of reasonable test accuracy. For example, for specimens incorporating air spaces or stud spaces, the metering area shall span an integral number of spaces (see 5.5). The depth of...
summatize the following info and break them into differeng key points. write them in yojr own words
apartus
6.1 Introduction—The design of a successful hot box appa- ratus is influenced by many factors. Before beginning the design of an apparatus meeting this standard, the designer shall review the discussion on the limitations and accuracy, Section 13, discussions of the energy flows in a hot box, Annex A2, the metering box wall loss flow, Annex A3, and flanking loss, Annex...
10. Write a one-page summary of the attached paper? INTRODUCTION Many problems can develop in activated sludge operation that adversely affect effluent quality with origins in the engineering, hydraulic and microbiological components of the process. The real "heart" of the activated sludge system is the development and maintenance of a mixed microbial culture (activated sludge) that treats wastewater and which can be managed. One definition of a wastewater treatment plant operator is a "bug farmer", one who controls the aeration...