size(900, 500);
background(#FFFFFF);
fill(0);
textSize(25);
charge_delivery(2, 13, 6);
}
//cal
void charge_delivery(int p, int s, int w) {
//Choose package
text("Choose 1 is Letter", width/100, height/4);
text("Choose 2 is Box", width/100, (height/4)+50);
//Choose type
text("Choose 11 is Next Day Priority", width/100, (height/4)+100);
text("Choose 12 is Next Day Standard", width/100, (height/4)+150);
text("Choose 13 is 2-Day", width/100, (height/4)+200);
line ((width/2)-10, 0, (width/2)-10, height);
//cal
if (p == 1) {
if (s == 11) {
if (w > 0 && w <= 8) {
text("You choose package : Letter", (width/100)+500, (height/4)+50);
text("You choose service : Next Day Priority", (width/100)+500, (height/4)+100);
text("Weight : "+w+" oz", (width/100)+500, (height/4)+150);
text("Total : $12", (width/100)+500, (height/4)+200);
}
}
}
if (p == 1) {
if (s == 12) {
if (w > 0 && w <= 8) {
text("You choose package : Letter", (width/100)+500, (height/4)+50);
text("You choose service : Next Day Standard", (width/100)+500, (height/4)+100);
text("Weight : "+w+" oz", (width/100)+500, (height/4)+150);
text("Total : $10.5", (width/100)+500, (height/4)+200);
}
}
}
if (p == 1) {
if (s == 13) {
if (w > 0 && w <= 8) {
text("Not available", (width/100)+500, (height/4)+100);
}
if (w > 8) {
text("Overweigth!!!", (width/100)+500, (height/4)+100);
}
if (w <= 0) {
text("Total : $0", (width/100)+500, (height/4)+100);
}
}
}
if (p == 2) {
if (s == 11) {
text("You choose package : Box", (width/100)+500, (height/4)+50);
text("You choose service : Next Day Priority", (width/100)+500, (height/4)+100);
text("$15.75 for the first pound.", (width/100)+500, (height/4)+150);
text("Charge $1.25", (width/100)+500, (height/4)+200);
}
}
if (p == 2) {
if (s == 12) {
text("You choose package : Box", (width/100)+500, (height/4)+50);
text("You choose service : Next Day Standard", (width/100)+500, (height/4)+100);
text("$13.75 for the first pound.", (width/100)+500, (height/4)+150);
text("Charge $1", (width/100)+500, (height/4)+200);
}
}
if (p == 2) {
if (s == 13) {
text("You choose package : Box", (width/100)+500, (height/4)+50);
text("You choose service : 2-Day", (width/100)+500, (height/4)+100);
text("$7 for the first pound.", (width/100)+500, (height/4)+150);
text("Charge $0.5", (width/100)+500, (height/4)+200);
}
}
if(p!=1 && p!=2 || s!=11 && s!=12 && s!=13){
text("Have no data", (width/100)+500, (height/4)+100);
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น