Sunday, 23 April 2017

CLASS-XII ASSIGNMENT CH-4 (CLASSES AND OBJECTS)


MAXFORT SCHOOL ROHINI
CLASS-XII
ASSIGNMENT CH-4 (CLASSES AND OBJECTS)



Q1. Write a complete program by considering a class Book with the following specification                                                                                      
Private members of the class Book are –
                Book_No integer ,Book_Title 20 char, Price float , (price per copy)
                Total_Cost ( ) . A function  to calculate the total cost for N numbers of copies, where N is passed to the function as argument.
                Public members of the class Book are –
                INPUT( ) function to read Book_No,Book_Title, Price.
                PURCHASE() function to ask the user to input no. of copies to be purchased. It invokes Total_Cost( ) & prints the total cost to be paid by the user.

Q2. Write a complete program by considering a class TEST in C++ with following description:                                                                                   
Private Members
TestCode of type integer
Description of type string
NoCandidate of type integer
CenterReqd (number of centers required) of type integer
A member function CALCNTR() to calculate and return the number of centers as (NoCandidates/100+1)
Public Members
A function SCHEDULE() to allow user to enter values for TestCode, Description, NoCandidate & call function CALCNTR() to calculate the number of Centres
A function DISPTEST() to allow user to view the content of all the data members

Q3. Write a complete program by considering a class Candidate in C++ with following description:                                                                       
Private Members
·         A data member RNo (Registration Number) of type long
·         A data member Name of type string
·         A data member Score of type float
·         A data member Remarks of type string349
·         A member function AssignRem( ) to assign Remarks as per the Score obtained by a candidate.
Score range and the respective Remarks are shown as follows:
·         Score                                             Remarks
·         >=50                                              Selected
·         less than 50                                Not selected
Public Members
·         A function ENTER ( ) to allow user to enter values for RNo, Name, Score & call function AssignRem( ) to assign the remarks.
·         A function DISPLAY ( ) to allow user to view the content of all the data members.
·          
Q4. Write a complete program by considering a class ITEM in C++ with following description:                                                                  
Private members:
·         Icode of type integer (Item Code)
·         Iname of type string (Item Name)
·         Price  of type Float (Price of each item)
·         Qty of type integer (Quantity in stock)
·         Discount of type float (Discount percentage on the item)
·         A find function finddisc( ) to calculate discount as per the following rule:
o   If Qty <=50 discount is 0%
o   If 50 < Qty <=100 discount is 5%
o   If Qty>100 discount is 10%
Public members:
·         A function Buy( ) to allow user to enter values for Icode, Item, Price, Qty and call function finddisc ( ) to calculate the discount.
·         A function showall ( ) to allow user to view the content of all the data members.

Q5. Write a complete program by considering a class named ADMISSION in C++ with the following descriptions:
Private members:                                                                                                                                                           
AD_NO integer (Ranges 10-2000)
a.       NAME Array of characters(String)
b.      CLASS Character
c.       Fees Float
Public members:
a.       Function Read_Data() to read and object of Admission type
b.      Function Display() to display the details of an object
c.       Function Draw_Nos() to choose 2 students randomly and display the details. Use random function to generate admission nos. to match with AD_NO.
Q6. Write a complete program by considering a class employee with the following specifications:
            Private members
            empno                         integer type
            ename                         20 character
            basic,hra,da                float
            netpay                        float
         ctotal( )                         A function to calculate the total as basic+hra+da with float return type.
            Public members:
         takedata ( )                function to read empno, ename,basic,hra,da and invoke ctotal( ) to calculate total.
         showdata ( )              to display all the data members on the screen.

Q7.     Write a complete program by considering a class worker with the following specification:
            Private members
                        Wno                           integer
                        wname                     20 character
                hrwrk,wgrate      float (hours worked and wagerate per hour)
                totwage               float (hrwrk * wgrate)
               calwg( )              A function to calculate the totwage  with float return type.
            Public members:
                     takedata ( )    function to reed wno, wname ,hrwrk, wgrate and invoke calwgl( ) to calculate total wages.
                     showdata ( ) function to display all the data members on the screen.




Thursday, 3 November 2016

CLASS-XII STACKS AND QUEUES




PRACTICAL PROGRAMS 
ON
STACKS AND QUEUES



1. Write a menu driven program in C++ to perform insert, delete and display operation on a dynamically allocated queue containing passanger details. consider the following definition of node in the code.


struct node
{
long pno;
char pname[20];
node *next;
};


2. Write a menu driven program in C++ to perform insert, delete and display operation on a dynamically allocated stack containing book details. Consider the following definition of node in the code.

struct node
{
char book_no;
char book_titla[20];
node *next;
};




Thursday, 20 October 2016

Class-XI Programs On While Loop



PRACTICAL QUESTIONS ON WHILE LOOP


     1.       Write a program to enter an integer number and print the series upto n numbers in a given format.
1              2              3              .               .               .               .               n

     2.       Write a program to print all characters from 0 to 255.
     3.       Write a program to enter a decimal number and convert it into binary number.
     4.       Write a program to enter a binary number and convert it into decimal number.
    5.       Write a program to enter a positive integer number and count the total number of digits and sum of digits.
    6.       Write a program to find the factorial of a number.
    7.       Write a program to display the Fibonacci series.
    8.       Write a program to display the hailstone series.
    9.       Write a program to display the Lucas series.
    10.   Write a program to enter an integer number and check if it is a palindrome or not.
    11.   Write a program to enter an integer number and check if it is Armstrong number or not.
    12.   Write a program to enter the lower limit and upper limit of a number and calculate the sum of all numbers in the given limit.
    13.   Write a program to enter a positive integer number and print the table.
    14.   Write a program to enter a number and generates its cube.
    15.   Write a program to count the total even and odd numbers in a given range.
    16.   Write a program to enter a number and check if it is prime number or not.


Thursday, 25 August 2016

CLASS - XI PROGRAMS ON IF ELSE IF LADDER





1.      Given three numbers A, B, and C, write a program to write their values in an ascending order. For example,
 if   A=12, B=10 and  C=15,
Your program should print out:
Smallest number = 10
Next highest number = 12
Highest number = 15

2.      Write a short program to calculate simple interest.
3.      Write a short program to convert a lowercase character to uppercase.
4.      Write a short program to find whether the given character is digit or a letter.
5.      A Program to check number is positive and how many digits number have?
6.      Write a c++ program that inputs the experience and the age of a person. The salary of the person is 6000 if the person is experienced and his age is more than 35, otherwise if the person is experienced and his age is more than 28 but less than 35 then the salary should be 4800 otherwise for experienced person the salary should be 3000 and for the inexperienced person, the salary should be 2000.
7.      A computer contest requires teams of 5 members each. Write a program that asks for the number of players, and then gives the number of teams and no of players left over.
8.      Write a program in c++ to accept monthly salary from the user, find and display income tax with the help of the following rules:
MONTHLY SALARY                                       INCOME TAX
9000 or More                                                  40% of the monthly salary
7500-8999                                                       30% of the monthly salary
7499 or less                                                    20% of the monthly salary   
9.      An electricity board charges according to the following rules:
For the first 100 units- 40P per unit (P- paise)
For the next 200 units-50P per unit
Beyond 300 units-60P per unit.
All users have to pay meter charge also, which is Rs.50/-
10.    Write a program to read the number of units consumed and print out the charges.
Computech  company has ninety-six employees who are divided into four grades as per their basic pay as the following:
GRADE 1            Basic: Rs.10,000 p.m. or more
                             D.A. : 40% of Basic
                             H.R. : 30% of Basic
GRADE 2             Basic : Rs. 5,000 p.m. or more but less than Rs. 10,000
                             D.A. :40% of Basic
                              H.R. : 25% of Basic
GRADE 3              Basic : Less than Rs 5,000 but more than Rs 2,000
                              D.A. : 30% of Basic
                              H.R. : 20% of Basic
GRADE 4               Basic: Rs 2,000 p.m. or less
                                D.A. : 30% of Basic
                               H.R. : 15% of Basic
If the salary, which is total of Basic, D.A. and H.R.A. is above Rs 50,000 per annum  then income tax at the rate of 30% of the annual salary exceeding Rs 50,000 is deducted on monthly basis at source. Taking name of the employee and the basic (monthly) pay as inputs, a pay slip for each employee is to be printed. Write a c++ programme to perform the job.
11.  A Computerized ticket counter of an underground metro station charges for each ride at the following rate :
AGE                                                                    AMOUNT/HEAD
18 or above                                                                  Rs 5
5 or above  but below 18                                            Rs 3
Accompanying kids below 5                                       Nil
Write a c++ programme, which takes as input the number of people of various age groups and prints a ticket.
At the end of the journey, the program states the number of passengers of different age groups who travelled and the total amount received as collection of fares .


Sunday, 21 August 2016

CLASS - XII ASSIGNMENT-2 ON DATA FILE HANDLING



CLASS-XII

PROGRAM ON BINARY FILE


     1.      Given a binary file STUDENT.DAT, containing records of the following class Student type
class Student
{
            char S_Admno[lO];    //Admission number of student
            char S_Name[30];       //Name of student
            int Percentage;            //Marks Percentage of student
            public:
                        void EnterData();
                        void DisplayData();
                        int get_Percentage();
};
Write a program in C++, that would read contents of file STUDENT.DAT and display the details of those Students whose Percentage is above 75.

      2.      Assuming the class Computer as follows :
class computer
{
            char chiptype[10];
            int speed;
            public:
                        void getdetails();
                        void showdetails();
};
Write a function readfile( ) to read all the records present in an already existing binary file SHIP.DAT and display them on the screen, also count the number of records present in the file.

      3.      Consider the given class

class student
{
            int admno;
            char name[20];
public:
          void getdata();
          void showdata();
          int retadmno();
};

Write a menu driven program for the following:

1.     Add new records
2.     Display records
3.     Search and display record
4.     Delete the record
5.     Modify the record

4.      Write a menu driven program in C++ to perform the following functions on a binary file “BOOK.DAT” containing objects of the following class:
class Book
{           int BookNo;
            char Book_name[20];
  public:
            void enterdetails();
            void showdetails();
            int Rbook_no() {return Book_no;}
            int Rbook_name() {return Book_name;}

};
a)      Append Records
b)      Modify a record for a given book no.
c)      Delete a record with a given book no.
d)      Search for a record with a given Book name
e)      Display a sorted list of records (sort on Book No.)
            f)       Display a sorted list of records (Sort on Book Name)

5.      A blood bank maintains a data file that contains the following information for every donor: Name, Date of Birth, Telephone number, Blood group. Write a program in C++ to do the following:
a) Given a blood group, display name, date of birth and phone number of all the persons of the given    
   blood group.
b) Append records in the file.
c)  Input a telephone number and modify the corresponding record.

6.      Declare a structure telerec in C++, containing name (20 characters) and telephone number. Write a program to maintain a file of telephone records. The program should allow the following functions on the file:
a)      To append records in the file.
b)      Display the name for a given telephone number. If the telephone number does not exist then display error message "record not found".
            c)      Display the telephone number(s) for a given name. If the name does not exist then display error message "record not found".

      7.      Assuming the class TOYS as declared below and write a program in C++ to read the objects of TOYS from binary file TOYS.DAT and display details of those TOYS, which are meant for children of AgeRange "5 to 8".                                                                                                          
class TOYS
    {
            int ToyCode;
            char ToyName[10];
            char AgeRange;
            public:
            void Enter()
            void Display()
                        char* WhatAge()
 };
       8.      Write a program in C++ to search for a camera from a binary file “CAMERA.DAT” containing the objects of class CAMERA (as defined below). The user should enter the Model No and the function should search and display the details of the CAMERA.                                 
 class CAMERA                                            
 {
            long ModelNo;
            float MegaPixel;
            int Zoom;
            char Details[120];
            public:
            void Enter();
            void Display();
            long GetModelNo();

};