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

Function : Easy

   Question : Code a method which draws a circle,giveen the coordinates of the centre and the radius.It header should be
    สร้างฟังก์ชันที่วาดวงกลมโดยมีการกำหนด centre  และ radius

         private void circle(Graphics g,int xCentre, int yCentre, int radius)

   Answer :

          void setup() {
             size(200, 200);
             background(0);
          }
          void draw() {
             fill(#F5076F);
             circle(100, 100, 100);
          }
          void circle(int xCentre, int yCentre, int radius) {
             ellipse(xCentre, yCentre, radius, radius);
          }

source : Java for students
Douglas Bell and Mike Parr. -- 2nd ed. page 253
ISBN : 0-13010922-3



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

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