Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
You are on page 1of 3

OOPs Lab B.

E Question

Q1. Write a program to read two numbers from Keyboard and return the largest
number.

Q2. Write a program to read a number in Farenheit and convert it into celcius.

Q3. Write a program to print a given no in reverse order.

Q4. Write a program to find roots of a given quadratic equation.

Q5. Write a program to find factorial of a given number.

Q6. Write a program to concatenate two strings.

Q7.Write a program to declare a class emplotee consisting date member emp-id,


emp-name.

Write a member function to accept and display data of 5 employees.

Q8.Define a class to represent a bank_account.

Data members are:

·0 name of depositor.

·1 Account Number

·2 Type of Account

·3 Balance

member Functions are:

·4 initialise

·5 Deposit

·6 Withdraw(After Depositor Balance check)

·7 Display Amount
Write a program to implement the above problem.

Q9. An Electricity board charges the following rates to domestic users to


discourge large consumption of energy:

·8 For the first 100 units: 60P per unit

·9 for next 200 units: 80P per unit

·10 Beyond 300 units : 90P per unit

All users are charged a minimum of Rs 50.00.

If the total amount is more than Rs 300.00 then an additional surcharge of 15% is
added.

Write a program to read the names of users and no of units consumed and print
out the charges with names.

Q10.Create two classes DM and DB which store the value of distances. DM


Stores distances in metres and cetinmetres adnd DB in feet and inches. Write a
program that can read values for the class ovjects and add one one object of DM
with another object of DB.

Use a friend fucntion to carry out the addtition operation. The object that stores
the results may be a DM object or DB object, depending on the units in which the
results are required.

The display should be in the format of feet and inches or metres and centimetres
depending on the object on display.

Q11. A book shop maintian the inventory of books that are being sold at the shop.
The list includes details such as author, title, price, publisher and stock positon.
Whenever a customer wants a book, the sales person inputs the title and author
and the system searches the list and diplays system displays the book details
and requests for the number of copies required. If the requested copies are
available, the total cost of the requested copies is displayed; otherwise the
message "Required copies not in stock" is displayed.

You might also like