Thursday, 27 October 2016

ISC Computer 2015 Theory Part II : Section C Fully Solved



Section C : 2015 Solved Theory


Question : 11
WordPile is an entity ……………..not be written.
public class WordPile
{
    char ch[]=new char[20];
    int capacity,top;
    WordPile(int cap)
    {
        capacity=cap;
        top=-1;
    }
    void pushChar(char v)
    {
        if((top+1)==capacity)
        {
            System.out.println("WordPile is full");
        }
        else
        {
            ch[++top]=v;
        }
    }
    char popChar()
    {
        if(top==-1)
        {
            return ('\\');
        }
        else
        {
            return (ch[top--]);
        }
    }
}


Question : 12
A line on a plane can……………………….not be written.
public class Plane
{
    int x1,y1;
    Plane(int nx,int ny)
    {
        x1=nx;
        y1=ny;
    }
    void show()
    {
        System.out.println("Coordinate : ("+x1+","+y1+")");
    }
}



public class Circle extends Plane
{
    int x2,y2;
    double radius,area;
    Circle(int ax,int ay,int bx,int by)
    {
        super(ax,ay);
        x2=bx;
        y2=by;
    }
    void findRadius()
    {
        radius=(Math.sqrt(Math.pow((x2-x1),2)+Math.pow((y2-y1),2)))/2;
    }
    void findArea()
    {
        area=(22/7)*(Math.pow(radius,2));
    }
    void show()
    {
        System.out.println("Coordinates : ("+x1+","+y1+") and ("+x2+","+y2+")");
        System.out.println("Radius : "+radius);
        System.out.println("Area : "+area);
    }
}

No comments:

Post a Comment