Академический Документы
Профессиональный Документы
Культура Документы
UN I V E R S I T Y
(Estd. u/s 3 of UGC Act 1956)
1. Write a program which inputs a person’s height (in centimeters) and weight (in
kilograms) and outputs one of the messages: underweight, normal, or overweight, using
the criteria:
Underweight: weight < height/2.5
Normal: height/2.5 <= weight <= height/2.3
Overweight: height/2.3 < weight
6. Write a program that prints the memory requirements of different data types and their
ranges of values.
7. A parking garage charges a 2.00Rs minimum fee to park for up to three hours. The
garage charges an additional an additional 0.50Rs per hour for each hour or part
therof in excess of three hours.the maximum charge given for any 24 hour period is
10Rs.Assume no car parks for longer than 24 hours at a time.Write a program that
calculates and prints the parking charges for each of the three customers who parked
their cars in this garage yesterday .You should enter the hours parked for each
customer .Your program should print the result in a neat tabular format and should
calculate and print the total of yesterday’s receipts. The program should use the
function calculateCharges to determine the charge of each customer. Your output
should appear in the following format.
Car Hours Charge
1 1.0 2.0
2 4.0 2.50
3 24.0 10.00
8. Write a line to accomplish each of the following tasks. You will want to look up the
documentation for string functions online. (Recall that the way to call a function on a
string variable is, for instance, myString.find("a"). Also note that the usual cin and cout
syntaxes work for strings, but cin will stop reading at the first whitespace character.)
a. Declare a variable papayaWar of type string (assuming header file <string> has
been included). Initialize it to the value "No, sir, away! A papaya war is on!"
b. Print the index of the first instance of the exclamation point character in
papayaWar.
12. Write a program to compute Tax. A Tax Compute function takes two arguments:
amount and tax percentage. Default tax percentage is 15% of income
13. Write a function stringCompare that checks if two strings are equal. Overload
the function stringCompare to compare two strings up till “n
“characters.Overload the same function to do a case insensitive comparison. The
function prototypes as given as below.
stringCompare (char [], char []);
stringCompare (char [], char [], int);
stringCompare (char [], char [], char [] = “sensitive”); //use of default
argument is must
14. Write a function with prototype given as bubbleSort (char [ ] [15], int) to sort
the array of Strings. Overload the function to sort array of integers.
15. Write a C++ program that prompts the user for the radius of a circle then calls
inline function circleArea to calculate the area of that circle.
16. Create a Structure student containing regno, name, age and address. Write an
inline functions to read and display details of a Student.
17. Write a program that uses function template called sqr to find the square of an
integer, a float and a double.
20. Develop a C++ program to perform Complex number arithmetic operations using
class concept. (add,sub,mul,div)
21. Write an OOP to read students name and his average marks. If a student gets less than
40 then declare that he has failed or else he passed. Prepare a computer list to give the list
of names in alphabetical order separately for passed and failed students
22. An automobile dealer has given identity number (id number) to all spare parts.
The class named product was defined to store information about identity number
and listed price of a spare part. Write a program to edit the class product to include
tax in the listed price and then calculate the net price including tax for following
spare parts (Assume: tax is 8 % of listed price.)
a) idno=501 price=1250
b) idno=502 price=1560
23. Create a class Employee (Identity number, name, department code, address,
designation, Salary, DOJ, DOB) and perform the following operations for 5
employees (Use array of objects)
a. Reading the details from keyboard.
b. Displaying the full details of a particular employee.
c. Displaying the detail of senior most employee.
24. Develop an Object Oriented database to carry out the following information from the
keyboard:
Name of the patient
Sex
Age
Ward Number
Bed Number
Nature of the illness
Date of admission
Your program should have the following facilities:
a) Build a master table
b) List a table
c) Insert a new entry
d) Delete old entry
e) Edit an entry
f) Search for a record that to be printed
g) Sort entries
25. Create a class called Rational for performing arithmetic with fractions. Write a
program to test your class. Use integer variables to represent private data of the class-
numerator and the denominator. Provide a constructor that enables an object of this class
to be initialized when it is declared. The constructor should contain default values in case
no initializers are provided. For example the fraction 2/4 would be stored in an object as
1 in numerator and 2 in denominator. Provide public member functions that perform each
of the tasks:
a. Adding 2 rational numbers.
b. Subtracting 2 rational numbers.
c. Multiply two rational numbers.
d. Dividing two rational numbers
e. Printing rational numbers in the form a/b.
f. Printing rational numbers in floating point format.
26. Create a class Rectangle with attributes length and width, each of which defaults
to 1.Provide member function that calculate perimeter and area of the rectangle.
Also provide set and get functions for length and width atrributes.The set function
should verify that length and width are each floating-point numbers larger than
0.0 and less than 20.0
27. Create a class HugeInteger that uses a 40-element array of digits to store integers
as large as 40 digits each.Provide member functions input,output,add and
subtract.Forcomparing HugeInteger objects ,provide functions isEqualTo ,
isLessThan,isGreaterThan,isNotEqual-each of this is a predicate function that
simply return true if relationship holds between two HugeIntegers and returns
false otherwise.
28. Create a class String that uses an array to store the value of a string.Provide
proper constructor and destructor as well as set and get functions. The class
should also provide the following overloaded operator capabilities.
Overloaded + operator to concatenate two strings.
Overloaded += operator.
Overloaded = operator
Overloaded ==,! =, <, > for comparing two string objects.
Also provide a member function sortStrings that sorts string objects using the
suitable overloaded functions defined above. Write a main function to check the
usage of above defined functions.
29. Create a class Matrix having data members- 2D Array, rows, columns for storing
matrix information. Include operation functions for reading and displaying a
matrix. Also include operator member functions for adding, subtracting and
multiplying matrix objects. Also include a friend function to find the transpose of
a matrix. Write a menu driven main function to do all matrix operations.
Account
SavingsAccount CheckingAccount
Base class Account should include one data member of type double to represent
account balance.The class should provide constructor that receives an initial
balance and uses it to initialize the data member.The constructor should validate
the initial balance to ensure that it is greater than or equal to 0.If not the balance is
set to 0.0 and the constructor should display an error message,indicating that the
initial balance was invalid.The class also provides three member functions-
credit, debit(debit amount should not exceed the account balance) and
enquiry.Derived class SavingsAccount should inherit the functionality of an
Account,but also include data member of type double indicating the interest rate
assigned to the Account.SavingsAccount constructor should receive the initial
balance ,as well as an initial value for SavingsAccount’s interest
rate.SavingsAccount should provide public member function calculateInterest
that returns double indicating the amount of interest earned by an
account.Member function calculateInterest should determine this amount by
multiplying the interest rate by the account balance.SavingsAccount function
should inherit member functions credit,debit and enquiry without redefining them.
Derived class CheckingAccount should inherit the functionality of an Account,
but also include data member of type double that represents the fee charged per
transaction.CheckingAccount constructor should receive the initial balance ,as
well as parameter indicating fee amount.class CheckingAccount should redefine
credit and debit function so that they subtract the fee from account balance
whenever either transaction is performed.CheckingAccount’s debit function
should charge a fee only if the money is actually withdrawn(debit amount should
not exceed the account balance).After defining the class hierarchy, write program
that creates object of each class and tests their member functions.Add interest to
SavingAccount object by first invoking its calculateInterest function, then passing
the returned interest amount to object’s credit function.
PostGraduateStudent
DoctralStudent
Create classes to implement the following hierarchy. Include data members and member
functions as given in the table below.
Thesis_submitted
Academician ProfessionalSoceity
Member
Create required classes to implement the hierarchy. Include data members and member
functions as given in the table below.
CricketPlayer
Batsman Bowler
AllRounder
Base class Shape has a data member of type double to store information about
side/radius and area. Include virtual member functions area () and perimeter () and
display (). Make the class Shape abstract.classes Circle, Rectangle, Triangle, Square
are subclasses to Shape.Include data members in subclass if necessary.Redefine
member functions area and perimeter in respective subclasses to find the area and
perimeter. Write a menu driven main function to call the functions of the subclasses.
36. Create a class Node having data of generic type and a pointer to itself (self
referential class).Create a class Stack List; make the class friend to Node. Include
necessary member functions and data members in Stack List class to implement
operations on Stack. Write a menu driven main program to implement stack
operations on an integer, float and char data items.
37. Write a C++ program to implement a sequential file. the program supports code
for writing into the file the grade sheet of student and to display grade sheet of
the student about student
38. Write a C++ program that implements random access file to read the file
backwards and display the contents of the file on to the screen and on to another
file.
39. An owner of a hardware store has kept an inventory of different tools available in
his store in a random access file. Write a c++ program that initializes the file. The
program enables him to list the tools, delete a record for a tool that is no longer
available; update information about a tool .The tool identification number should
be record number. The information stored in the file looks like