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();

};

Thursday 11 August 2016

CLASS-XI BASIC PROGRAMS IN C++





SIMPLE PROGRAMS IN C++

1.                  Write a program to calculate the area and perimeter of rectangle and square.
2.                  Write a program to calculate the area and circumference of a circle.
3.                  Write a program to calculate the surface area and volume of a cuboid.
4.                  Write a program to calculate the area of a triangle using heron’s formula.
5.                  Write a program to enter the temperature in Fahrenheit and convert into Celsius
6.                  Write a program to calculate the speed of a vehicle.
7.                  Write a program to swap two integer numbers by using third variable.
8.                   Write a program to swap two integer numbers without using third variable.
9.                   Write a program to calculate the discriminant of a quadratic equation.
10.               Write a program to enter the salary of an employee and calculate the gross salary and net salary as per the following : (salary !=0)
              (Gross Salary=Basic+HRA+DA)
             (Net Salary=Gross Salary-PF)

HRA
DA
PF
5% OF Salary
2% Salary
12% of salary