Você está na página 1de 13

public class Customer

private String name ;

private String packageID;

private int numAdults;

private int numChildren;

private int numDays;

private int numRooms;

public void setCustomer(String a,String b ,int c ,int d ,int e ,int f )

name = a;

packageID = b;

numAdults = c;

numChildren = d;

numDays= e;

numRooms = f;

public String getName()

return name;

public String getpackageID()

return packageID;

}
public String getpackageType( String packageID)

String packageType ="";

char p = packageID.charAt(1);

if( p == 'D')

packageType = "DELUXE";

else if(p == 'E')

packageType ="ECONOMY";

return packageType;

public double getDestination(String packageID, String packageType){

double Destination = 0.0;

char a = packageID.charAt(0);

if(a == 'K')

if(packageType == "DELUXE")

Destination = 350.00;

else if(packageType =="ECONOMY")

Destination = 220.00;

}
else if(a == 'P')

if(packageType == "DELUXE")

Destination = 470.00;

else if(packageType =="ECONOMY")

Destination = 280.00;

return Destination;

public int getAdults(){

return numAdults;

public int getChildren(){

return numChildren;

public int getDays(){

return numDays;

public int getRooms(){

return numRooms;

public double travelCharge(double Destination, int getAdults, int getChildren) {

double traveCost = 0.0;


double chargeChild = 0.0;

chargeChild =( Destination * numChildren)/2;

traveCost = (Destination * numAdults) + chargeChild;

return traveCost;

public double hotelCharge( String packageType, double travelCharge,int getDays, int getRooms)

double payDays = 0.0;

double discount = 0.0;

if( numDays <= 7){

if(packageType == "DELUXE"){

payDays = travelCharge + ( 430.00*numDays * numRooms);

else if(packageType =="ECONOMY"){

payDays = travelCharge +(130.00 * numDays * numRooms);

else if( numDays > 7){

if(packageType == "DELUXE"){

discount =( travelCharge + ( 430.00*numDays * numRooms)) * 0.1;

payDays = travelCharge +(130.00 * numDays * numRooms)- discount;


}

else if (packageType =="ECONOMY"){

discount = (travelCharge +(130.00 * numDays * numRooms))* 0.1;

payDays = travelCharge +(130.00 * numDays * numRooms) - discount;

return payDays;

public String toString(){

return new String("{ Name = " + name +"\nPackage ID = "+ packageID +"\nNumber of Adults
= "+ numAdults +"\nNumber ofChildren = "+ numChildren +"\nNumber Of Days "
+numDays+"\nNumber of Rooms " +numRooms +"}");

}
import java.util.*;

import javax.swing.*;

public class appCustomer{

public static void main(String args[]){

Scanner sc = new Scanner(System.in);

char q;

int longerst = 0, count = 0;

double totalAgent = 0.0;

Customer z;

z = new Customer();

System.out.print(" Do you want to start =");

q = sc.next().charAt(0);

while(q == 'y' || q == 'Y')

System.out.print("Enter your name =");

String name = sc.next();

System.out.print("Enter package ID =");

String packageID = sc.next();

System.out.print(Enter numbers of adults =");

int adults = sc.nextInt();

System.out.print(Enter numbers of Children=");

int children = sc.nextInt();

System.out.print("Enter numbers of Days =");

int days = sc.nextInt();

System.out.print("Enter number of Rooms =");

int rooms = sc.nextInt();


if( packageID =="KD")

count++;

a.setCustomer(name,packageID,adults,children,days,rooms);

if( days > longerst)

longerst = days;

String type = a.getpackageType(packageID);

double dest = a.getDestination(packageID, type);

double charge = a.travelCharge(dest, adults, children);

totalAgent = totalAgent + a.hotelCharge(type, charge,days, rooms);

System.out.print(" you want to continue ( Y - yes, N- no)?");

i= sc.next().charAt(0);

}
System.out.println(" The count of number customer going to Kenyir Lake under the Deluxe package
is = " + count);

if(longerst >0 ){

System.out.println(" The longers vacation of customer = " + z);

System.out.println(" The total Travel Agency gets = " + totalAgent);

}
public class Box

private String code;

private double length;

private double width;

private double height;

public void Box(String c, double l, double w, double h){

code = c;

length = l;

width = w;

height = h;

public Box(){

code = "";

length = 0;

width = 0;

height = 0;

public String getCode(){

return code;

public double getLength(){

return length;

}
public double getWidth(){

return width;

public double getHeight(){

return height;

public String toString(){

return new String("{ code = " + code +", lenght= "+ length +", width = "+ width +",hweight =
"+ height +"}");

}
import java.util.*;

import javax.swing.*;

public class boxobject{

public static void main(String args[]){

Scanner sc = new Scanner(System.in);

Box a;

int count = 0;

char q;

System.out.print("Do you want to start =" );

q=sc.next().charAt(0);

while(q == 'y')

System.out.println(" Enter the information about code, length,width,height");

String c = sc.next();

double l = sc.nextDouble();

double w = sc.nextDouble();

double h = sc.nextDouble();

a= new Box();

a. Box(c,l,w,h);
if(c == "07")

System.out.println(a);

double area = 0.0;

double b = l * w;

if( b >= 5000)

System.out.println( "The code is = " + c);

if(l == 100 && w == 70)

count++;

JOptionPane.showMessageDialog(null,"Box that has 100cm long and 70 wide is : " + count);

System.out.print("You want to continue (Y -yes or N - no) ?");

q=sc.next().charAt(0);

Você também pode gostar