วันอาทิตย์ที่ 6 กันยายน พ.ศ. 2558

lab3deliverie

void setup() {
  size(1000, 500);
  background(255);
  fill(0);
  textSize(20);
  charge_delivery(1,2,6);
}

//p=package
//s=service
//w=weight
void charge_delivery(float p, float s ,float w) {

  //package
  text("Step 1 choose your package",width/100,(height/4)-50);
  text("choose 1 Letter", width/100, height/4);
  text("choose 2 Box", width/100, (height/4)+50);
  //service type
  text("Step 2 choose your service",width/100,(height/4)+150);
  text("choose 1 Next Day Priority", width/100, (height/4)+200);
  text("choose 2 Next Day Standard", width/100, (height/4)+250);
  text("choose 3 2 Day", width/100, (height/4)+300);
  //show status
  fill(0,0,205);
  text("Your status",(width/100)+500,height/4);



  //calculate
  if (p == 1) {
    if  (s == 1) {
      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);
      fill(255, 0, 0);
      text("Total : $12", (width/100)+500, (height/4)+200);
      }
    }else  if  (s == 2) {
    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);
      fill(255, 0, 0);
      text("Total : 10.5$", (width/100)+500, (height/4)+200);
      }
    }else if  (s == 3) {
     
      text("Not available no data", (width/100)+500, (height/4)+100);
         
    }
 




  if (p == 2) {//box
    if  (s == 1) {
 

      text("You choose package Box", (width/100)+500, (height/4)+50);
      text("You choose service Next Day Priority", (width/100)+500, (height/4)+100);
      fill(255, 0, 0);
      text("$15.75", (width/100)+500, (height/4)+150);
      text("Charge $1.25 for pound", (width/100)+500, (height/4)+200);
    }else    if  (s == 2) {
 
      text("You choose package Box", (width/100)+500, (height/4)+50);
      text("You choose service Next Day Standard", (width/100)+500, (height/4)+100);
      fill(255, 0, 0);
      text("$13.75", (width/100)+500, (height/4)+150);
      text("Charge $1 for pound", (width/100)+500, (height/4)+200);
    }else    if  (s == 3) {
 
      text("You choose package Box", (width/100)+500, (height/4)+50);
      text("You choose service 2 Day", (width/100)+500, (height/4)+100);
      fill(255, 0, 0);
      text("$7", (width/100)+500, (height/4)+150);
      text("Charge $0.5 for pound", (width/100)+500, (height/4)+200);
    }
  }
   
  if (p!=1 && p!=2 || s!=1 && s!=2 && s!=3 || p==1 && w!=1 && w!=2 && w!=3 && w!=4 && w!=5 && w!=6 && w!=7 && w!=8){
    fill(255, 0, 0);
    text("Not available no data", (width/100)+500, (height/4)+150);
  }
}
}

ไม่มีความคิดเห็น:

แสดงความคิดเห็น