Top Banner
R.M.K ENGINEERING COLLEGE DEPARTMENT OF INFORMATION TECHNOLOGY CS2312 /OBJECT ORIENTED PROGRAMMING LAB Aim: To develop object-oriented programming skills using C++ and Java 1. Function overloading, default arguments in C++ 2. Simple class design in C++, namespaces, objects creations 3. Class design in C++ using dynamic memory allocation, destructor, copy constructor 4. Operator overloading, friend functions 5. Overloading assignment operator, type conversions 6. Inheritance, run-time polymorphism 7. Template design in C++ 8. I/O, Throwing and Catching exceptions 9. Program development using STL 10. Simple class designs in Java with Javadoc 11. Designing Packages with Javadoc comments 12. Interfaces and Inheritance in Java 13. Exceptions handling in Java 14. Java I/O 15. Design of multi-threaded programs in Java TOTAL: 45 PERIODS REQUIREMENT FOR A BATCH OF 30 STUDENTS S.No. Description of Equipment Quantity required Hardware Required 1. Computers (Pentium-4) 40 Nos with one server 2. Dot matrix printer 3 Nos 3. Laser Printer 2 Nos. 4. UPS (5 KVA) 2 Software Required 5. Turbo C++ 40 Nodes 1
63
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript

R.M.K ENGINEERING COLLEGE DEPARTMENT OF INFORMATION TECHNOLOGY CS2312 /OBJECT ORIENTED PROGRAMMING LAB Aim: To develop object-oriented programming skills using C++ and Java 1. Function overloading, default arguments in C++ 2. Simple class design in C++, namespaces, objects creations 3. Class design in C++ using dynamic memory allocation, destructor, copy constructor 4. Operator overloading, friend functions 5. Overloading assignment operator, type conversions 6. Inheritance, run-time polymorphism 7. Template design in C++ 8. I/O, Throwing and Catching exceptions 9. Program development using STL 10. Simple class designs in Java with Javadoc 11. Designing Packages with Javadoc comments 12. Interfaces and Inheritance in Java 13. Exceptions handling in Java 14. Java I/O 15. Design of multi-threaded programs in Java TOTAL: 45 PERIODS REQUIREMENT FOR A BATCH OF 30 STUDENTS S.No. Description of Equipment Quantity required Hardware Required 1. Computers (Pentium-4) 40 Nos with one server 2. Dot matrix printer 3 Nos 3. Laser Printer 2 Nos. 4. UPS (5 KVA) 2 Software Required 5. Turbo C++ 40 Nodes 6. (Java 2 SDK) JDK 5.0 update 6 (1.5.0 - Internal Version No.) 40

1

Ex No. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

Title Students Result Processing using class concept Employee Payroll Processing using array of objects Calculate the volume of different shapes using Function overloading. Interest Calculation with rate of interest as a default value Matrix manipulation using constructors, destructors,dynamic memory allocation of matrix and assignment operator overloading Complex number arithmetic using operator overloading Vector matrix multiplication using friend function Conversion between meter and centimeter using constructor and operator function Student result processing using inheritance Finding area and volume of various shapes using virtual function and typeid (rtti) Insertion sorting using function template Stack operation using class template Operation on stack with exception handling Complex number arithmetic and storing the result in file Program development using STL Simple class designs in Java with Javadoc Interfaces in Java Inheritance in java Exceptions handling in Java Java I/O Design of multi-threaded programs in Java Designing Packages with Javadoc comments

2

SIMPLE CLASS DESIGN IN C++, NAMESPACES, OBJECTS CREATIONS EXNO: 1 AIM: To write a C++ program to maintain student detail and compute the grade using class concept. ALGORITHM: Step1: Start the program Step2: Define a class student with the data members name, roll, marks, total, average, Grade . Step3: Declare the member functions getdata, totalmark, avg, grade and printdata. Step4: The function getdata is used to accept name, roll and subject marks. Step5: The function totalmark is used to calculate the total by adding the marks. Step6: The function avg is used to calculate the average by dividing the total mark by no Of subjects. Step7: The function grade is used to compute the grade based on the average marks. Step8: The function printdata is used to display the name, roll, total, average, grade. Step9: In the main function declare an object for the class student and call the member Function one by one. Step10: Stop the program PROGRAM: #include #include using namespace std; class student { string name; int i; int roll; int m[6]; int total; int avg; char grade; public: void getdata(); void totalmar(); void avg1(); void grade1(); void display(); 3 STUDENTS RESULT PROCESSING

}; void student::getdata() { coutname; coutroll; cout80) grade='B'; else if(avg>70) grade='C'; else if(avg>60) grade='D'; else if(avg>50) grade='E'; else grade='F'; } void student :: display() { cout