Saturday, 10 September 2016

ISC Computer 2012 Theory Part II : Section C Fully Solved

Section C : 2012 Solved Theory


Question : 11

Link is an entity which can........................NOT BE WRITTEN.

Solution of sub question (a)

public class Link
{
    int lnk[]=new int[100];
    int max,begin,end;
    Link(int mm)
    {
        max=mm;
        begin=0;
        end=0;
    }
    void addlink(int v)
    {
        if(end==max)
        {
            System.out.println("OUT OF SIZE");
        }
        else
        {
            lnk[end++]=v;
        }
    }
    int dellink()
    {
        if(begin==end)
        {
            System.out.println("EMPTY");
            return (-99);
        }
        else
        {
            return (lnk[begin++]);
        }
    }
    void display()
    {
        System.out.println("Entity Elements");
        for(int i=(end-1);i>=begin;i--)
        {
            System.out.println(lnk[i]);
        }
    }
}
  

Solution of sub question (b)

The given entity is known as queue.
        

Question : 12

A super class detail................................NOT BE WRITTEN.


Inheritance from Bill to Details

public class Detail
{
    String name,address,telno;
    double rent;
    Detail(String n,String a,String t,double r)
    {
        name=n;
        address=a;
        telno=t;
        rent=r;
    }
    void show()
    {
        System.out.println("Customer Name : "+name);
        System.out.println("Customer Address : "+address);
        System.out.println("Customer Phone Number : "+telno);
        System.out.println("Customer Monthly Rent : "+rent);
    }
}


public class Bill extends Detail
{
    int n;
    double amt;
    Bill(String nm,String ad,String ph,double rt,int no)
    {
        super(nm,ad,ph,rt);
        n=no;
        amt=0.0;
    }
    void cal()
    {
        if((n>0)&&(n<101))
        {
            amt=rent;
        }
        else if((n>100)&&(n<201))
        {
            amt=rent+(0.6*n);
        }
        else if((n>200)&&(n<301))
        {
            amt=rent+(0.8*n);
        }
        else
        {
            rent=rent+n;
        }
    }
    void show()
    {
        super.show();
        System.out.println("Number of call(s) made : "+n);
        System.out.println("Amount to be paid : "+amt);
    }
}

1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete