.doc - Download Now DOC

Document Sample
.doc - Download Now DOC Powered By Docstoc
					Code for Teletubbies.java

/*
        A program that imitates the BBC's Teletubbies program,
        where the at the end of the show the Tubbies pop up from
        behind the foreground. However I have only used two of the characters
        instead of all four.
*/
import uwejava.*;
import java.awt.*;
public class Teletubbies
{

        static Turtle myTurtle; //This enables the turtle class for all
                                                             // sub methods.

        static void circle(int xPos,int yPos,int length,int red,int green,int blue)
        {
                 myTurtle.setWidth(4);
                 myTurtle.setColor(new Color(red,green,blue));
                 while (length >= 0)
                 {
                          myTurtle.penUp();
                          myTurtle.moveTo(xPos,yPos);
                          yPos = yPos - 5;
                          myTurtle.penDown();
                          myTurtle.turnTo(0);
                          for (int i = 1; i <=20; i++)
                          {
                                     myTurtle.moveBy(length);
                                     myTurtle.turnBy(18);
                          }
                          length = length -1;
                 }
        }

        static void rectangle(int xPos,int yPos,int yLimit,int length,int angle,int red,int green,int
blue)
        {
                while ( yPos >= yLimit)
                {
                         myTurtle.setColor(new Color(red,green,blue));
                         myTurtle.penUp();
                         myTurtle.moveTo(xPos,yPos);
                         yPos = yPos - 1;
                         myTurtle.turnTo(angle);
                         myTurtle.penDown();
                         myTurtle.moveBy(length);
                }
        }

        static void sky()//This draws the sky.
        {
                 int xPos = 1;
                 int length = 390;
                 int angle = 310;
                 myTurtle.penUp();
                 myTurtle.setColor(Color.blue);
        myTurtle.setWidth(10);
        while ( xPos <=500)
        {
                 myTurtle.penUp();
                 myTurtle.moveTo(xPos,0);
                 xPos = xPos + 10;
                 myTurtle.penDown();
                 myTurtle.turnTo(angle);
                 myTurtle.moveBy(length);
          length = length - 8;
        }
}

static void background()//This draws the hills in the background.
{
         int yPos = 0;
         int length =390;
         int angle1 = 310;
         int angle2 = 50;
         myTurtle.setColor(Color.black);//The outline colour.
         myTurtle.setWidth(10);
         while ( yPos <=500)
         {
                  myTurtle.penUp();
                  myTurtle.moveTo(0,yPos);
                  yPos = yPos + 1;
                  myTurtle.penDown();
                  myTurtle.turnTo(angle1);
                  myTurtle.moveBy(length);
                  myTurtle.turnTo(angle2);
                  myTurtle.moveBy(length);
                  myTurtle.setColor(new Color(0,150,0));//The fill colour.
         }
}

static void sun (int xPos)//This draws the sun which will move
                                            // across the sky.
{
         int yPos = 80;
         circle(xPos,yPos,10,255,230,0);
         eyes(xPos - 5,yPos - 35,xPos + 15);
         smile(xPos - 13,yPos -20);
}

static void eyes(int xPos,int yPos,int finPos)
{
         while (xPos <= finPos)
         {
                 myTurtle.penUp();
                 myTurtle.setColor(Color.black);
                 myTurtle.moveTo(xPos,yPos);
                 myTurtle.penDown();
                 myTurtle.turnTo(90);
                 myTurtle.moveBy(4);
                 xPos = xPos + 20;
         }
}
static void smile(int xPos,int yPos)
{
         myTurtle.penUp();
         myTurtle.setWidth(2);
         myTurtle.moveTo(xPos,yPos);
         myTurtle.turnTo(315);
         myTurtle.penDown();
         myTurtle.moveBy(10);
         myTurtle.turnTo(0);
         myTurtle.moveBy(20);
         myTurtle.turnTo(45);
         myTurtle.moveBy(10);
}

static void head(int xPos,int yPos,int red,int green,int blue)
//This draws both of the tubbies heads
{
         circle(xPos,yPos,10,red,green,blue);
         circle(xPos,yPos-5,9,192,192,192);
         eyes(xPos - 5,yPos - 35,xPos + 15);
         smile(xPos - 13,yPos -20);
}

static void body(int xPos,int yPos,int red,int green,int blue)
//This will draw both of the tubbies bodies
{
         circle(xPos,yPos,20,red,green,blue);
         rectangle(xPos - 40,yPos - 85,yPos -105,100,225,red,green,blue);
         rectangle(xPos + 60,yPos -85,yPos -105,100,315,red,green,blue);
         rectangle(xPos - 20,yPos - 20,yPos - 70,60,0,192,192,192);
}

static void poaerial(int xPos,int yPos)
//This draws the aerial for one of the characters.
{
         myTurtle.setWidth(4);
         myTurtle.setColor(new Color(250,0,0));
         myTurtle.penUp();
         myTurtle.moveTo(xPos+3,yPos+10);
         myTurtle.turnTo(90);
         myTurtle.penDown();
         myTurtle.moveBy(10);//This lifts the circular aerial from the head.
         myTurtle.penUp();
         myTurtle.moveTo(xPos,yPos);
         myTurtle.turnTo(0);
         myTurtle.penDown();
         for (int i = 1; i<=20; i++)//This draws the circular aerial.
         {
                    myTurtle.moveBy(6);
                    myTurtle.turnBy(18);
         }
}
static void dipaerial(int xPos,int yPos)
// This draws the other characters aerial.
{
                int width = 4;
                myTurtle.penUp();
                myTurtle.setColor(new Color(0,250,0));
                myTurtle.moveTo(xPos,yPos);
                myTurtle.turnTo(90);
                myTurtle.penDown();
                while (width >= 1)//Creates a line that decreases in width as
                                                  // it rises from the characters head.
                {
                         myTurtle.setWidth(width);
                         myTurtle.moveBy(10);
                         width = width - 1;
                }
        }

        static void dipsi(int yPos)//This draws the first character
                                                                      //by combining the head, body
and aerial.
        {
                int xPos = 150;
                body(xPos,yPos,0,250,0);
                head(xPos + 5,yPos - 130,0,250,0);
                dipaerial(xPos +11,yPos - 194);
        }

        static void po(int yPos)//This draws the second character.
        {
                 int xPos = 350;
                 body(xPos,yPos,250,0,0);
                 head(xPos + 5,yPos - 130,250,0,0);
                 poaerial(xPos + 6,yPos - 202);
        }

        static void delay(int time)//This uses a for loop to create a delay
                                              //between each re-draw of the scene giving the
                                              //illusion of animation.
        {
                 for (int i = 1; i <= time; i++)
                 {
                 }
        }
        /*
                 The main method will draw all of the sub methods together
                 to finally create the image and animate it.
        */
        public static void main( String args[] )
        {
                 //I have used the paper parameter to colour the sky
                 // rather than repeatedly drawing it.
                 Paper myPaper = new Paper("Teletubbies");
                 myTurtle = new Turtle(myPaper);
                 int xPosition = 470;
                 int dipsiYposition = 700;
                 int poYposition = 700;
                 int wait = 500;
                 int longWait = wait * 200000000;
                 while (xPosition >=0)
                 {
                          sky();
                          sun(xPosition);
                          background();
                          xPosition = xPosition - 5;
                          delay(wait);
                 }
                 while (dipsiYposition >=460)
                 {
                          sky();
                          background();
                          dipsi(dipsiYposition);
                          dipsiYposition = dipsiYposition - 5;
                          delay(wait);
                 }
                 delay(longWait);

                 while (dipsiYposition <=700)
                 {
                          sky();
                          background();
                          dipsi(dipsiYposition);
                          dipsiYposition = dipsiYposition + 5;
                          delay(wait);
                 }
                 while (poYposition >=460)
                 {
                          sky();
                          background();
                          po(poYposition);
                          poYposition = poYposition - 5;
                          delay(wait);
                 }
                 delay(longWait);

                 while (poYposition <=700)
                 {
                         sky();
                         background();
                         po(poYposition);
                         poYposition = poYposition + 5;
                         delay(wait);
                 }
                 while (xPosition <=500)
                 {
                         sky();
                         sun(xPosition);
                         background();
                         xPosition = xPosition + 5;
                         delay(wait);
                 }

        }//main()

}//Teletubbies
Flowchart showing Usage of Methods in Teletubbies.java.


Static void background()                      Static void sky()                 Static void circle(int xPos, int yPos, int
                                                                                length, int red, int green, int blue)




Static void rectangle (int xPos, int
yPos, int yLimit, int length, int             Static void eyes( int xPos, int              Static void smile(int xPos, int
angle, int red, int green, int blue)          yPos, int finPos)                            yPos)




Static void body( int xPos, int
yPos, int red, int green, int blue)           Static void sun(int xPos)           Static void head(int xPos, int yPos,
                                                                                  int red, int green, int blue)




Static void dipaerial(int xPos, int           Static void dipsi(int yPos)             Static void poaerial(int xPos, int
yPos)                                                                                 yPos)




                                              Public static void main(                  Static void po(int yPos)
    Static void delay(int time)               String[] args)
ek 1)

Support for the Human Rights of the Burmese People And Protestors

Proposer: Aled Dilwyn Fisher 200502527
Seconder: Adrian Rogstad 200503506

Union notes:
   1. The protests in Burma/Myanmar against the military junta carried out this
      Autumn by broad sections of Burmese society, leading to many deaths and
      thousands of arrests of peaceful protestors;
   2. The continuation of the house arrest of Aung San Suu Kyi, who was
      democratically elected in 1990 until the military junta now ruling the country
      overturned the elections;
   3. The death last week of one protestor, Win Shwe (a member of Aung San Suu
      Kyi‟s party, the National League for Democracy), in custody;
      http://www.guardian.co.uk/worldlatest/story/0,,-6986965,00.html
   4. The UN Security Council‟s censure of the actions of the Burma/Myanmar
      regime, supported unanimously by the council‟s 15 members.
      http://www.guardian.co.uk/burma/story/0,,2189556,00.html




                                                4
Union believes:
   1. That the Burmese people have a right to peaceful protest;
   2. That the use of violence, intimidation and arbitrary arrest are affronts to justice
      everywhere;
   3. That the international community should do everything in its power to non-
      violently pressure the military junta and non-violently show solidarity for the
      protestors;
   4. That the historical involvement of students in the Burmese democracy
      movement – including the protagonists of protests in 1988 – means that
      students across the world should show solidarity with oppressed student
      groups.

Union resolves:
   1. To mandate the Students‟ Union Executive to support Amnesty International
      and others in their campaign for human rights in Burma/Myanmar by sending
      a letter condemning the denial of human rights to the Burma/Myanmar
      authorities, including Foreign Minister Nyan Win, and calling for the release of
      political prisoners currently held by the junta;
   2. To support the Burma Campaign UK in their work for human rights in
      Burma/Myanmar and to join any future protests with the SU banner after
      promoting the march to all students;
   3. To encourage other SUs around the country, as well as the NUS, to take
      similar action in support of human rights;
   4. To forge links with Burmese student groups to foster exchange, solidarity and
      support.


Code of Practice (week 1)

Support the Campaign Against Climate Change Demonstration on December 8 th And
Make Climate Change Action Week an Official SU Week

Proposer: Aled Dilwyn Fisher 200502527
Seconder: Louise Robinson 200503597

Union notes:
   1. The Intergovernmental Panel on Climate Change (IPCC) 2007 Report on
      climate change, which detailed the possible effects of climate change if we do
      not take action to reverse it, including temperature rises of a minimum of
      1.8°C (best estimate for a "low scenario") and as much as 4.0 °C (best
      estimate for a "high scenario", with an upper range of 6.4°C), and sea level
      rises of a minimum of 18 to 38 cm (“low scenario”) and as much as 26 to
      59 cm (“high scenario”); [1]
   2. That it has been agreed through scientific consensus in the IPCC report, with
      600 authors from 40 countries collaborating (reviewed by over 620 experts
      and representatives from 113 governments), that the impacts of climate
      change include increased flooding, airborne diseases, drought, famine,
      extreme weather events and many other potential effects; [1]
   3. That according to a survey of 928 peer-reviewed scientific articles on global
      climate change published between 1993 and 2003 carried out in Science,


                                           5
      none (0%) have challenged the thesis that rising carbon emissions, caused by
      human activity, are linked to the greenhouse effect and the attendant
      consequences of climate change; [2]
   4. The introduction of SU Climate Change Action Week last year under the
      portfolio of the Environment and Ethics Officer, which will take place this year
      in Michaelmas Week 9 (December 3rd to 7th) in the run up to global
      demonstrations on December 8th.

Union believes:
   1. That climate change is one of the most serious issues facing us in the 21 st
      century, challenging our understanding of the human impact of our
      economies, societies and political systems on the ecological balance of the
      world;
   2. That taking action on climate change is urgent to avert potential catastrophes
      that will affect the most vulnerable people in the world, including people living
      on marginal land (the vast majority of which are some of the poorest on the
      planet) and those living in difficult environments in the Global South;
   3. That raising awareness about the issue among students is essential to
      integrating sustainable thinking into the future generation of skilled and
      educated people.

Union resolves:
   1. To mandate the Students‟ Union to support the national Campaign against
      Climate Change Demonstration on December 8th 2007 (to coincide with global
      climate change talks), which is part of worldwide protests, following the noted
      Climate Change Action Week;
   2. To make Climate Change Action Week a continuing part of the SU calendar
      and part of the Environment and Ethics Officer‟s job description in the SU
      Constitution, adding new article Article 9 to Annex C Section 7 of the Codes of
      Practice, to read:
      “9. who will hold an Environment Week in Lent Term Week 2 and a Climate
      Change Action Week in the run up to an annual major climate change
      demonstrations or events, or in line with weeks organised by the others
      across the student movement (such as the Mayor of London and People and
      Planet „Student Go Green Week‟), at whatever time this is deemed
      appropriate by the officer and the other members of the Executive.“

Notes:
1. http://ipcc-wg1.ucar.edu/wg1/wg1_ar4.html - WG I Fourth Assessment Report
(AR4)
2. http://www.sciencemag.org/cgi/content/full/306/5702/1686 Oreskes, Naomi
(December 3, 2004). "Beyond the Ivory Tower: The Scientific Consensus on Climate
Change". Science 306 (5702): 1686


Business Motion 3 (week 1)

Democracy and Student Union Societies

Proposer: Azan Marwah 200616468


                                          6
Seconder: Dhire Nainani 200717819

Union notes:
   1. That this is the beginning of the year, when many societies meet and elect
      their committees.
   2. The practice of postponed elections for Society Committees.
   3. The alarming practice of some unconstitutional positions in Society
      Committees.
   4. The allegations that members of last year‟s Executive allowed some
      committees to go unelected.

Union believes:
   1. Societies should elect their committees in line with the principles of the
      Constitution.
   2. That societies should conduct these elections in a timely and fair fashion as
      far as possible in line with the rules set down in their respective constitutions.
   3. That all positions in Society Committees should be elected.

Union resolves:
   1. To request the Returning Officer to report and look into these reports and
      practices.
   2. To mandate the Societies Officer to instruct societies about their duties to
      conduct fair and free elections in a timely fashion.




                           SHOP OPENING HOURS
                         MONDAY - FRIDAY 9.30 - 5.30
                   LOOK OUT FOR SPECIAL OFFERS IN STORE

                     ALSO CHECK OUT CRUSH THIS FRIDAY!


                                           7