void setup()
{
size(300,300);
background(0);
boolean type_Package = true;
int day_Priority = 1;
int day_Standard = 2;
int twoDay = 3;
int choiceDay = twoDay;
float charge = 0;
float weight =8;
if(type_Package)
{
if(choiceDay == day_Priority)
{
if(weight >= 8)
{
charge = 12;
}
}
else if(choiceDay == day_Standard)
{
if(weight >= 8)
{
charge = 10.50;
}
}
else if(choiceDay == twoDay)
{
textSize(24);
text("Not Available",width/3,height-20);
textSize(12);
}
}
else
{
if(choiceDay == day_Priority)
{
charge = AddPriority(weight);
}
else if(choiceDay == day_Standard)
{
charge = AddStandard(weight);
}
else if(choiceDay == twoDay)
{
charge = AddtwoDay(weight);
}
}
if(type_Package)
{
text("Your Package type is LETTER",width/3,height/4);
}
else
{
text("Your Package type is BOX",width/3,height/4);
}
if(choiceDay == day_Priority)
{
text("Next Day Priority",width/3,height/2);
}
else if(choiceDay == day_Standard)
{
text("Next Day Standard",width/3,height/2);
}
else if(choiceDay == twoDay)
{
text("2-DAY",width/3,height/2);
}
text("Charge = $"+charge,width/3,height*0.75);
}
float AddPriority(float weight)
{
float Pcharge = 15.75 ;
if(weight > 1.00)
{
float weightTrue = weight - 1 ;
float add = weightTrue * 1.25 ;
Pcharge = Pcharge + add ;
}
return Pcharge ;
}
float AddStandard(float weight)
{
float Scharge = 13.75 ;
if(weight > 1.00)
{
float weightTrue = weight - 1 ;
float add = weightTrue * 1.00 ;
Scharge = Scharge + add ;
}
return Scharge ;
}
float AddtwoDay(float weight)
{
float TDcharge = 7.00;
if(weight > 1.00)
{
float weightTrue = weight - 1 ;
float add = weightTrue * 1.00 ;
TDcharge = TDcharge + add ;
}
return TDcharge ;
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น