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

Lab4x_Multiple_table


def setup():
   n=int(input())
   cal_result(n)
def cal_result(n):
  count=12
  mN=1
  print("Multiple Table")
  while (mN<=count):
     ans=n*mN 
     print(n," x ",mN," = ",ans)
     mN=mN+1
setup()

Lab4x_Plus_Number


def setup():
  n = int(input())
  calculate(n)
def calculate(n):
   i=1
   sums=0
   while(i<=n): 
      print("i = ",i)
      sums=sums+i
      i=i+1
   print("1+2+...+N,N = ",n)
   print("The result is = ",sums)
setup()

Lab4x_Power_of_ten

def setup() :
   power_number=int(input())
   calculate(power_number)
def calculate(power_number) :
     print("Value : 10 ^",power_number )
     if (power_number==6) :
        print("Million")
     elif (power_number==9)  :
        print("Billion")
     elif (power_number==12) :
        print("Trillion")
     elif (power_number==15) :
        print("Quadrillion")
     elif (power_number==18) :
        print("Quintillion")
     elif (power_number==21) :
        print("Sextillion")
     elif (power_number==30) :
        print("Nonillion")
     elif (power_number==100): 
        print("Googol")
     else: 
        print("The value input doesn't have the word")
setup()
   
 

Lab4x_Grade


def setup() :
  score=int(input())
  calculating(score)
  showscore(score)
def calculating(score) :
   if (score>=80) :
       print("Your grade is A ." )
   elif (score>=75) :
       print("Your grade is B+ ." )
   elif (score>=70) :
       print("Your grade is B ." )
   elif (score>=65) :
       print("Your grade is C+ ." )
   elif (score>=60) :
       print("Your grade is C ." )
   elif (score>=55) :
       print("Your grade is D+ ." )
   elif (score>=50) :
       print("Your grade is D ." )
   else :
       print("Your grade is F ." )
def showscore(score):
       print("Your score is ",score,".")
setup()

Lab4x_Leap_Year

def setup():
   year_input=int(input())
   calculate(year_input) #calculate the date
def calculate(year_input) :
  if (year_input%4!=0):
    print(year_input," isn't the Leap Year")
  elif (year_input%100!=0):
    print(year_input," is the Leap Year")
  elif (year_input%400==0):
    print(year_input," is the Leap Year")
  else:
    print(year_input," isn't the Leap Year")
setup()

Lab4x_BMI

def setup():
     w = int(input ())
     h = int(input ())
     calcu_bmi(w,h)
def calcu_bmi(w,h): 
     h2 = (h/100)**2 
     BMI = w/h2
     print("Weight = ",w," Kg.")
     print("Height = ",h," cm.")
     print("Value Of BMI =%.2f"%BMI)
setup()

Lab4x_Circle_Calculation


def setup() :
    dm = int(input())
    cal_circle(dm)
def cal_circle(dm):
    r=dm/2
    r_2=r*r
    A=3.14*r_2
    Cf=2*(3.14)*r
    print("Value of circle's area = %.2f"%A,"m^2.")
    print("Value of circumference's circle = %.2f"%Cf)
    print("Diameter's circle = ",dm," m.")
    print("Radius's circle = ",r," m.")
setup()

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

Lab4_Prime_Number

/////PRIME NUMBER////
void setup() {
  size(500, 200);
  background(0);
  int n=15;//number
  int count=2;
  int sum=0;
  int divNo=2;
  int posx=0;
  while (count<=n) {
    if (PrNum_result(count)) {
      sum=sum+count;
      textSize(20);
      text(count, 30+posx, 100);
      posx=posx+30;
    }
    count+=1;
  }
  text("Sum is = "+sum, 30, 150);
}
boolean PrNum_result(int count) {
  int divNo=2;
  boolean pr=true; //first one =2
  while (divNo<count) {
    if (count%divNo==0) {
      pr=false;
      break;
    }
    pr=true;
    divNo+=1;
  }
  return pr;
}

Lab4_Loan_Payment

//LOAN PAYMENT//
void setup() {
  size(550, 525);
  background(0);
  textSize(20);
  fill(255);
/////////////TITLE//////////////
  text("Monthly Loan Payment", 140, 30);
  textSize(13);
  fill(255);
////////////FLOAT&FUNTION(LOANPAYMENT)//////////
  float loan_Amount = 5000; // loan amount
  float loan_Term = 1; // loan term
  float interest_Rate = 12; // interest rate
  loanPymt(loan_Amount, loan_Term, interest_Rate);
}
////////// Function:Loanpayment/////////////////////////
void loanPymt(float loanAnt, float loanTm, float rate) {
  loanTm = loanTm*12;//year
  ///Calculation///
  float j = ((rate/100)/loanTm);
  float paymentAnt = loanAnt*(j/(1-(pow(1+j, -loanTm))));
  float payment12mths = paymentAnt*loanTm;
  textSize(10);
  text("Loan Amount : "+loanAnt, 60, 65);
  text("Loan Term : "+(int)(loanTm)+" months", 60, 90);
  text("Interest Rate : "+nf(rate, 0, 2)+" %", 60, 115);
  text("Payment Every Month : "+nf(paymentAnt, 0, 2), 240, 65);
  text("Total of 12 Payments : "+nf(payment12mths, 0, 2), 240, 90);
  text("Total Interest : "+nf((payment12mths-loanAnt), 0, 2), 240, 115);
/////////////////////// LOOP (WHILE)////////////////
  int count = 1;
  float unpaid = loanAnt;
  float totalInterest = 0;
  int posy = 25;
  ////////Title////////////////
  textSize(15);
  text("Payment No.", 10, 155);
  text("Interest", 110, 155);
  text("Principal", 190, 155);
  text("Unpaid Balance", 270, 155);
  text("Total interest to Date", 390, 155);
 
  while (count <= loanTm) {
    float interest = unpaid*j;
    totalInterest = totalInterest+interest;
    float principal = paymentAnt - interest;
    unpaid = abs(unpaid - principal);
   
    /////////////result////////////
    //nf(value, "dot total")
    text(count, 40, 155+posy);
    text(nf(interest, 0, 2), 110, 155+posy);
    text(nf(principal, 0, 2), 190, 155+posy);
    text(nf(unpaid, 0, 2), 290, 155+posy);
    text(nf(totalInterest, 0, 2), 430, 155+posy);
    count++;///////UPDATE//////////
    posy=posy+30;////////POSITION Y//////////
  }
}

Lab4_book

//FAV Book Function
//int posX=0; //fill value to move(X)
//int posY=0;//fill value to move(Y)
void setup() {
  size(500, 500);
  background(255);//white
  int n=5;
  int count=1;
  int posy=0;
  int posx=0;
  while (count<n) {
    book(posx, posy);
    count=count+1;
    posy=posy+15;
  }
}

void book(int posX, int posY) {//function
  fill(#B3CFF0);//blue
  strokeWeight(8);//thick line
  rect(80+posX, 130+posY, 340, 220);//body of book
  strokeWeight(6);//thin line
  fill(#78B2F7);//dark blue
  rect(230+posX, 130+posY, 40, 220);//spine
  rect(290+posX, 150+posY, 110, 60);//title's frame
  fill(0);//black
  textSize(30);
  text("Conan", 300+posX, 190+posY);//Title
  strokeWeight(3);//Thinest Line
  line(250+posX, 130+posY, 120+posX, 100+posY);//pages1 r
  line(250+posX, 130+posY, 110+posX, 108+posY);//pages2 r
  line(250+posX, 130+posY, 100+posX, 115+posY);//pages3 r
  line(120+posX, 100+posY, 80+posX, 130+posY);//pages border r
  line(250+posX, 130+posY, 380+posX, 100+posY);//pages1 l
  line(250+posX, 130+posY, 390+posX, 108+posY);//pages2 l
  line(250+posX, 130+posY, 400+posX, 115+posY);//pages3 l
  line(380+posX, 100+posY, 420+posX, 130+posY);//pages border l
}

Lab4_balloon

void draw() {
  size(700, 700);
  int x=mouseX;
  int y=100;
  int posY=-20;
  int posX=0;
  int count=1;
  int n=5;
  frameRate(20);
  background(random(200), random(200), random(200));
  if (x<100) {
    x=100;
    fill(#DD0000);
  } else {
    if (x>600) {
      x=600;
    }
    if (x>100) {
      fill(#0000DD);
    }
    if (x<600) {
      fill(#00DD00);
    }
  }
  while (count<n) {
    draw_balloon(x, y, posY,posX);
    count=count+1;
    posY=posY+100;
    posX=posX+100;
  }
}
  void draw_balloon(int x, int y, int posY,int posX) {
  int radius = 100;
  int string_length = 150;
  strokeWeight(5);
  line(x+posX, y+posY, x+posX, y + string_length+posY);
  ellipse(x+posX, y+posY, radius, radius);
}

Lab4_Plus_Number

int value=0;
int n=1;
void setup() {
  size(300, 300);
}
void draw() {
  background(0);
  frameRate(10);
  int i=1;
  int sum=0;
  while (i<=n) {
    println("i = "+i);
    sum=sum+i;
    i=i+1;
  }
  textSize(20);
  text("1+2+...+N,N = "+n, 70, 130);
  text("The result is = "+sum, 70, 190);
  if (keyPressed) {
    if (key=='w') {
      n++;
    } else if (key=='s') {
      n--;
    }
  }
  if (n<0) {
    n=0;
  }
}

Lab4_Multiple_table

int n=1;
void setup() {
  size(150, 350);
}
void draw() {
  frameRate(10);//make it slow
  background(0);
  cal_result();
  if (keyPressed) {/// can change the number///
    if (key=='w') {
      n=n+1;
    } else if (key=='s')
      n=n-1;
  }
}
void cal_result() {//////// calculation function///////
  int count=12;
  int mN=1;
  int posY=70;
  fill(255);
  textSize(15);
  text("Multiple Table", 20, 40);
  while (mN<=count) {
    int ans=n*mN;
    textSize(12);
    text(n+" x "+mN+" = "+ans, 20, posY);
    posY=posY+20;
    mN=mN+1;
  }
}

Lab4_Linkinpark

//FAV Song function
//int posX=random(0);//fill value to move(X)
//int posY=random(0);//fill value to move(Y)
int value=2;
int movex=0;
void setup() {
  size(500, 500);
}
void draw() {
background(#0000DD);
  int n=3;
  int count=1;
  int movey=-20;
  while (count<n) {
    movex++;
    symbol(movex, movey);
    count=count+1;
    movey=movey+280;
  }
  movex=movex+value;
  if (movex>400||value<0) {
    value=-6;
  }
   if (movex<-200||value>0) {
    value=2;
   }
}
////////////// SYMBOL FUCNTION//////////////////
void symbol(int posX, int posY) {
  //background's circle
  stroke(255);//black line
  strokeWeight(14);//thick line
  fill(0);//line's color
  ellipse(150+posX, 150+posY, 250, 250);//big circle with nothing  inside of it

  //Linkin Park symbol
  line(160+posX, 25+posY, 85+posX, 190+posY);
  line(85+posX, 190+posY, 225+posX, 190+posY);
  line(225+posX, 190+posY, 175+posX, 80+posY);
  line(175+posX, 80+posY, 95+posX, 260+posY);

  //open the circle
  stroke(0);
  line(147+posX, 23+posY, 138+posX, 40+posY);
  line(115+posX, 250+posY, 105+posX, 270+posY);
}

Lab4_Bird

int value =1;
int cenywing=250;
int ceny=250;
int cenx=250;
void setup() {
  size(500, 500);
}
void draw() { 
  int n=5;
  int count=1;
  int posX=50;
  int posY=-100;
  background(255);
  frameRate(40);
  background(255);
  if (value==1) {
    background(#DD0000);
  } else {
    background(#00DD00);
  }
  while (count<n) {
    draw_bird(posX, posY);
    count=count+1;
    posX=posX+50;
    posY=posY+100;
  }
  ceny=ceny+value;
  cenywing=cenywing+(value*2);
  if (ceny>280&&cenywing>290) {
    value--;
  } else if (ceny<200&&cenywing<220) {
    value++;
  }
  if (cenx>500) {
    cenx=cenx%500;
  }
  if (keyPressed) {
    if (key=='d'||key=='D') {
      cenx+=3;
    }
  }
}
void draw_bird(int posX, int posY) {
  int wing_L=100;
  int radius_head=50;
  strokeWeight(10);
  //right wing
  line(cenx+posX, ceny+posY, cenx+wing_L+posX, cenywing+posY);
  //left wing
  line(cenx+posX, ceny+posY, cenx-wing_L+posX, cenywing+posY);
  ellipse(cenx+posX, ceny+posY, radius_head, radius_head);
}

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

Lab3_Leap_Year

LEAP YEAR


void setup() {
  size(500, 500);
  background(255);//white
  calculate(2016);//calculate the date
}
void calculate(int year_input) {
  int posx=80;
  int posy=250;
  textSize(30);
  fill(0);//black
  ////fucntion calculation////
  if (year_input%4!=0) {
    text(year_input+" isn't the Leap Year", posx, posy);
  } else if (year_input%100!=0) {
    text(year_input+" is the Leap Year", posx, posy);
  } else if (year_input%400==0) {
    text(year_input+" is the Leap Year", posx, posy);
  } else{
    text(year_input+" isn't the Leap Year", posx, posy);
  }
}

Lab3_Exercise

Exercise

setup มีการเรียกใช้อัตโนมัติเพียงครั้งเดียว
draw มีการเรียกใช้อัตโนมัติซ้ำ

พิสูจน์ได้อย่างไร
ตอบ พิสูจน์ได้ด้วยการจะเห็นว่าเมื่อมีการทำ Animation นั้นจะใช้ void draw() ในการใส่คำสั่งให้รัน เพราะว่า draw จะทำการรันซ้ำๆทำให้เกิดการเคลื่อนไหว ดัง Code ตัวอย่างนี้

Ex.
int posX=50;
void setup() {
  size(300, 300);
}
void draw() {
  background(0);
  ellipse(posX, 150, 50, 50);
  posX++;
  posX=posX%300;
}



Lab3_Song

LINKINPARK

//FAV Song function
//int posX=random(0);//fill value to move(X)
//int posY=random(0);//fill value to move(Y)
int movex;
int movey;
int value=2;
void setup() {
  size(500, 500);
}
void draw() {
  movex=value+movex;
  if (movex>200||value<0) {
    value=-4;
    background(#0000DD);
    symbol(movex, movey);
  }
  if (movex<-200||value>0) {
    value=4;
    background(#DD0000);
    symbol(movex, movey);
  }
}
void symbol(int posX, int posY) {//function
  //background's circle
  stroke(255);//black line
  strokeWeight(14);//thick line
  fill(0);//line's color
  ellipse(250+posX, 250+posY, 250, 250);//big circle with nothing  inside of it

  //Linkin Park symbol
  line(260+posX, 125+posY, 185+posX, 290+posY);
  line(185+posX, 290+posY, 325+posX, 290+posY);
  line(325+posX, 290+posY, 275+posX, 180+posY);
  line(275+posX, 180+posY, 195+posX, 360+posY);

  //open the circle
  stroke(0);
  line(247+posX, 123+posY, 238+posX, 140+posY);
  line(215+posX, 350+posY, 205+posX, 370+posY);
}

Lab3_Bird

BIRD

int value =1;
int cenywing=250;
int ceny=250;
int cenx=250;
void setup() {
  size(500, 500);
}
void draw() {
  frameRate(40);
  background(255);
  if (value==1) {
    background(#DD0000);
  }else {
  background(#00DD00);
}
draw_bird();
//make the bird fly
ceny=ceny+value;
cenywing=cenywing+(value*2);
if (ceny>280&&cenywing>290) {
  value--;
} else if (ceny<200&&cenywing<220) {
  value++;
}
if(cenx>500){
 cenx=cenx%500;
}
if (keyPressed) {
  if (key=='d'||key=='D') {
    cenx+=3;
  }
}
}
void draw_bird() {
  int wing_L=100;
  int radius_head=50;
  strokeWeight(10);
  //right wing
  line(cenx, ceny, cenx+wing_L, cenywing);
  //left wing
  line(cenx, ceny, cenx-wing_L, cenywing);
  ellipse(cenx, ceny, radius_head, radius_head);
}

Lab3_Doraemon

Doraemon

//MY FAV MOVIE
//int posX=0;//fill value to move(Horizontal)
//int posY=0;//fill value to move(Vertical)
int posX;
int posY;
void setup() {
  size(500, 500);
}
void draw() {
  background(#FACFF4);
  doraemon();
  if (keyPressed) {
    if (key =='a' || key =='A') {
      posX--;
    }if (key =='d' || key =='D') {
      posX++;
    }  if (key =='w' || key =='W') {
      posY--;
    }  if (key =='s' || key =='S') {
      posY++;
    }
  }
}
void doraemon() {
  stroke(#0054A5);
  strokeWeight(3);
  fill(#236ED6);//blue
  ellipse(250+posX, 180+posY, 350, 295);//head
  fill(255);//white
  ellipse(250+posX, 210+posY, 250, 205);//face
  ellipse(210+posX, 120+posY, 80, 100);//right hand
  ellipse(290+posX, 120+posY, 80, 100);//left hand
  fill(#F21D1D);//red
  rect(110+posX, 300+posY, 280, 30);//cat collar
  fill(255);//white
  ellipse(120+posX, 300+posY, 60, 60);//right eye
  ellipse(380+posX, 300+posY, 60, 60);//left eye
  fill(#FF292D);//red
  ellipse(250+posX, 175+posY, 45, 40);//nose
  fill(255);//white
  arc(250+posX, 235+posY, 180, 50, 0, PI);//cute smile <3
  fill(#FAD449);//gold or yellow
  ellipse(250+posX, 300+posY, 40, 40);//bell
  fill(#3C60B9);//blue
  ellipse(225+posX, 135+posY, 20, 20);//inner eye(right)
  ellipse(275+posX, 135+posY, 20, 20);//inner eye(left)
  line(250+posX, 194+posY, 250+posX, 260+posY);//mouth (line)
  line(210+posX, 210+posY, 140+posX, 210+posY);// cat's whiskers mid right
  line(290+posX, 210+posY, 360+posX, 210+posY);// cat's whiskers mid left
  line(210+posX, 220+posY, 140+posX, 230+posY);// cat's whiskers below right
  line(290+posX, 220+posY, 360+posX, 230+posY);// cat's whiskers below left
  line(210+posX, 200+posY, 140+posX, 190+posY);// cat's whiskers above right
  line(290+posX, 200+posY, 360+posX, 190+posY);// cat's whiskers mid left
  line(232+posX, 290+posY, 267+posX, 290+posY);//bell line1
  line(210+posX, 300+posY, 290+posX, 300+posY);//bell line2
  strokeWeight(7);
  line(250+posX, 302+posY, 250+posX, 320+posY);//bell line3
  stroke(255);//white line
  fill(255);//white
  ellipse(258+posX, 170+posY, 12, 12);//reflect nose
}

Lab3_Delivery_Service

Delivery Services

void setup() {
  size(500, 300);
  background(#D16565);
  textSize(30);
  text("Expressimo Delivery Service", 50, 100);
  /////1=Next Day Priority 2=Next Day Standard 3=2-Day/////
 /////fill the detail//////
  calculate_letter(0,0);
  calculate_box(1,8);
}
void calculate_letter(int weight, int type_service) {
  textSize(20);
  ///////////// SERVICE OF LETTER////////////
  if (weight<=8&&type_service==1) {
    text("Letter "+weight+" Oz", 100, 200);
    text("Charges = $12.00", 100, 250);
    text(": Next Day Priority", 220, 200);
  } else if (weight<=8&&type_service==2) {
    text("Letter "+weight+" Oz", 100, 200);
    text("Charges = $10.50", 100, 250);
    text(": Next Day Standrard", 220, 200);
  } else if (weight>8||type_service>2) { 
    textSize(25);
    text("Not available", 170, 250);
  }
}
void calculate_box(int weight, int type_service) {
  float value1=(weight-1)*1.25;
  float charge1=15.75;
  float value2=(weight-1)*1.00;
  float charge2=13.75;
  float value3=(weight-1)*0.50;
  float charge3=7.00;
  textSize(20);
  ///////////// SERVICE OF BOX////////////
  if (weight==1&&type_service==1) {
    text("Box "+weight+" pound", 100, 200);
    text("Charge = $15.75", 100, 250);
    text(": Next Day Priority", 270, 200);
  }
  if (weight>1&&type_service==1) {
    text("Box "+weight+" pounds", 100, 200);
    text("Charges = $"+(charge1+value1), 100, 250);
    text(": Next Day Priority", 270, 200);
  }
  if (weight==1&&type_service==2) {
    text("Box "+weight+" pound", 100, 200);
    text("Charge = $13.75", 100, 250);
    text(": Next Day Standrad", 270, 200);
  }
  if (weight>1&&type_service==2) {
    text("Box "+weight+" pounds", 100, 200);
    text("Charges = $"+(charge2+value2), 100, 250);
    text(": Next Day Standrad", 270, 200);
  } 
  if (weight==1&&type_service==3) {
    text("Box "+weight+" pound", 100, 200);
    text("Charge = $7.00", 100, 250);
    text(": 2-Day", 270, 200);
  }
  if (weight>1&&type_service==3) {
    text("Box "+weight+" pounds", 100, 200);
    text("Charges = $"+(charge3+value3), 100, 250);
    text(": 2-Day", 270, 200);
  }else if (type_service>3) { 
    textSize(25);
    text("Not available", 170, 250);
  }
}

วันเสาร์ที่ 5 กันยายน พ.ศ. 2558

Lab3_Battery

Battery Charging



int space;
int value=1;
void setup() {
  size(500, 500);
}
void draw() {
  frameRate(30);
  background(255);//white
  battery(80, 140);
  space=space+value;
  if (space==300) {
    value=0;
    value=value-1;
  } else if (space==0&&value<0) {
    value=0;
    value=value+1;
  }
  int percent=(space*100)/300;
  textSize(50);
  fill(random(255), random(255), random(255));//rainbow color
  text((int)percent+"%", 210, 400);
  if (percent<10&&value==1) {
    text("Charging", 130, 100);
  }
  if (percent>95) {
    text("Full", 200, 100);
  }
}

void battery(int countX, int countY) {
  int w=300;//width
  int h=120;//height
  stroke(0);//dark blue
  strokeWeight(4);
  fill(255);//white

  //big square
  rect(countX, countY, w, h);
  fill(255);//white
  //batt head
  rect(countX+300, countY+35, w/9, h-70);
  //batt symbol
  strokeWeight(10);
  // + symbol
  line(countX+350, countY-50, countX+350, countY+10);
  line(countX+320, countY-20, countX+380, countY-20);
  /// - Symbol
  line(countX-60, countY-20, countX-10, countY-20);
  //battery quntity
  strokeWeight(2);
  if (space>0) {
    fill(#DD0000);
  }
  if (space>70) {
    fill(#F5ED00);
  }
  if (space>230) {
    fill(#69E376);
  }
  rect(countX, countY, space, h);//#1 batt
}


Lab3_Score

การตัดเกรด

int score=99;// score that you get
void setup() {
  size(500, 500);
  calculating(100,300);
  showscore(100, 200);
}
void calculating(int cX,int cY) {
  background(0);
  textSize(40);
  if (score>=80) {
    text("Your grade is A .", cX, cY);
  } else if (score>=75) {
    text("Your grade is B+ .", cX, cY);
  } else if (score>=70) {
    text("Your grade is B .", cX, cY);
  } else if (score>=65) {
    text("Your grade is C+ .", cX, cY);
  } else if (score>=60) {
    text("Your grade is C .", cX, cY);
  } else if (score>=55) {
    text("Your grade is D+ .", cX, cY);
  } else if (score>=50) {
    text("Your grade is D .", cX, cY);
  } else {
    text("Your grade is F .", cX, cY);
  }
}
void showscore(int x, int y) {//showscore 
  text("Your score is "+score+".", x, y);
}

Lab3_Power_of_ten

Power of ten

void setup() {
  size(300, 500);
  background(255);
  draw_number_form(170, 100);
  fill(#0000DD);
  textSize(15);
  //////////////// INPUT VALUE//////////////
  calculate(19);
  //////////////////////////////////////////
}
void draw_number_form(int posX, int posY) {
  fill(0);
  textSize(25);
  text("Power of Ten", 20, 50);

  //// number's word code
  textSize(25);
  text("Number", posX, posY);
  text("Value", 40, 100);
  textSize(20);
  text("Million", posX, posY+40);
  text("Billion", posX, posY+80);
  text("Trillion", posX, posY+120);
  text("Quadrillion", posX, posY+160);
  text("Quintillion", posX, posY+200);
  text("Sextillion", posX, posY+240);
  text("Nonillion", posX, posY+280);
  text("Googol", posX, posY+320);
}
void calculate(int power_number) {
  int posX=40;//position X
  int posY=100;// position y
  text("Value : 10^"+power_number,190,50);
  /////show the input value////
  if (power_number==6) {
    text("10"+"^"+power_number, posX, posY+40);
  } else if (power_number==9) {
    text("10"+"^"+power_number, posX, posY+80);
  } else if (power_number==12) {
    text("10"+"^"+power_number, posX, posY+120);
  } else if (power_number==15) {
    text("10"+"^"+power_number, posX, posY+160);
  } else if (power_number==18) {
    text("10"+"^"+power_number, posX, posY+200);
  } else if (power_number==21) {
    text("10"+"^"+power_number, posX, posY+240);
  } else if (power_number==30) {
    text("10"+"^"+power_number, posX, posY+280);
  } else if (power_number==100) {
    text("10"+"^"+power_number, posX, posY+320);
  } else {
    fill(#DD0000);
    text("The value input doesn't have the word", 10, 480);
  }
}