Laboratory Assignments of OBJECT ORIENTED METHODOLOGY & PROGRAMMING (USING C++) [IT 553]



Similar documents
BCS2B02: OOP Concepts and Data Structures Using C++

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?

Multichoice Quetions 1. Atributes a. are listed in the second part of the class box b. its time is preceded by a colon. c. its default value is

13 Classes & Objects with Constructors/Destructors

Syllabus for Computer Science. Proposed scheme for B.Sc Programme under Choice Based Credit System

Java Interview Questions and Answers

FLORIDA STATE COLLEGE AT JACKSONVILLE COLLEGE CREDIT COURSE OUTLINE. Introduction to Programming with Visual Basic.NET

C++ INTERVIEW QUESTIONS

I PUC - Computer Science. Practical s Syllabus. Contents

Subject Name: Object Oriented Programming in C++ Subject Code:

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON

Objected oriented Programming: C++ Unit 1 1. Introduction 1.1. Introduction to Object Oriented Programming C++ fundamentals.

Python for Rookies. Example Examination Paper

Cohort: BCA/07B/PT - BCA/06/PT - BCNS/06/FT - BCNS/05/FT - BIS/06/FT - BIS/05/FT - BSE/05/FT - BSE/04/PT-BSE/06/FT

CS 111 Classes I 1. Software Organization View to this point:

El Dorado Union High School District Educational Services

Department of Electrical and Computer Engineering. EEL 3160 Embedded C++ and Data Structures. Tuesday & Thursday 3:00 5:00 pm

ALLIED PAPER : DISCRETE MATHEMATICS (for B.Sc. Computer Technology & B.Sc. Multimedia and Web Technology)

Object Oriented Software Design II

Introduction to Java

Factoring and Applications

Glossary of Object Oriented Terms

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

The C Programming Language course syllabus associate level

3 Pillars of Object-oriented Programming. Industrial Programming Systems Programming & Scripting. Extending the Example.

Masters programmes in Computer Science and Information Systems. Object-Oriented Design and Programming. Sample module entry test xxth December 2013

C++FA 5.1 PRACTICE MID-TERM EXAM

An Incomplete C++ Primer. University of Wyoming MA 5310

JavaScript: Control Statements I

Basic Programming and PC Skills: Basic Programming and PC Skills:

Programming and Software Development (PSD)

COMPUTER SCIENCE. Paper 1 (THEORY)

Fourth Grade Math Standards and "I Can Statements"

PES Institute of Technology-BSC QUESTION BANK

Calculating Area, Perimeter and Volume

Moving from CS 61A Scheme to CS 61B Java

CEC225 COURSE COMPACT

Grade 5 Mathematics Curriculum Guideline Scott Foresman - Addison Wesley Chapter 1: Place, Value, Adding, and Subtracting

RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE. CISY 105 Foundations of Computer Science

Show that when a circle is inscribed inside a square the diameter of the circle is the same length as the side of the square.

Java SE 8 Programming

Java 6 'th. Concepts INTERNATIONAL STUDENT VERSION. edition

B.Sc.(Computer Science) and. B.Sc.(IT) Effective From July 2011

5: Magnitude 6: Convert to Polar 7: Convert to Rectangular

Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies)

C++FA 3.1 OPTIMIZING C++

COMPUTER SCIENCE 1999 (Delhi Board)

AP Computer Science Java Subset

Computing Concepts with Java Essentials

Preet raj Core Java and Databases CS4PR. Time Allotted: 3 Hours. Final Exam: Total Possible Points 75

Sources: On the Web: Slides will be available on:

Fundamentals of Java Programming

Progressing toward the standard

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

Data Structures using OOP C++ Lecture 1

Compiling Object Oriented Languages. What is an Object-Oriented Programming Language? Implementation: Dynamic Binding

Charlesworth School Year Group Maths Targets

C++ Programming Language

Java Software Structures

Keystone National High School Placement Exam Math Level 1. Find the seventh term in the following sequence: 2, 6, 18, 54

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas

Get post program 7 W.a.p. that Enter two numbers from user and do arithmetic operation

Facebook Twitter YouTube Google Plus Website

DE 6211 DISTANCE EDUCATION. M.Sc. (IT) DEGREE EXAMINATION, MAY PRINCIPLES OF INFORMATION TECHNOLOGY. (2002 onwards) PART A (10 3 = 30 marks)

2) Based on the information in the table which choice BEST shows the answer to 1 906?

Pseudo code Tutorial and Exercises Teacher s Version

Lecture 3. Arrays. Name of array. c[0] c[1] c[2] c[3] c[4] c[5] c[6] c[7] c[8] c[9] c[10] c[11] Position number of the element within array c

Basic Math for the Small Public Water Systems Operator

Answers to Review Questions Chapter 7

Syllabus OBJECT ORIENTED PROGRAMMING C++

J a v a Quiz (Unit 3, Test 0 Practice)

BPS Math Year at a Glance (Adapted from A Story Of Units Curriculum Maps in Mathematics K-5) 1

Specialized Programme on Web Application Development using Open Source Tools

How do you compare numbers? On a number line, larger numbers are to the right and smaller numbers are to the left.

Stacks. Linear data structures

Paper 1. Calculator not allowed. Mathematics test. First name. Last name. School. Remember KEY STAGE 3 TIER 6 8

Syllabus Introduction to C++ Programming and Numerical Analysis Spring 2016

DATA 301 Introduction to Data Analytics Microsoft Excel VBA. Dr. Ramon Lawrence University of British Columbia Okanagan

Operator Overloading. Lecture 8. Operator Overloading. Running Example: Complex Numbers. Syntax. What can be overloaded. Syntax -- First Example

Chapter 4 OOPS WITH C++ Sahaj Computer Solutions

The Properties of Signed Numbers Section 1.2 The Commutative Properties If a and b are any numbers,

Management Information Systems 260 Web Programming Fall 2006 (CRN: 42459)

How To Teach C++ Data Structure Programming

4. How many integers between 2004 and 4002 are perfect squares?

9 Control Statements. 9.1 Introduction. 9.2 Objectives. 9.3 Statements

Application Note C++ Debugging

Java Application Developer Certificate Program Competencies

Unit Write iterative and recursive C functions to find the greatest common divisor of two integers. [6]

AP Computer Science Java Mr. Clausen Program 9A, 9B

WORKSPACE WEB DEVELOPMENT & OUTSOURCING TRAINING CENTER

Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007

B.Sc. (Computer Science) First Year

ALGORITHMS AND FLOWCHARTS. By Miss Reham Tufail

10CS35: Data Structures Using C

Curriculum Map. Discipline: Computer Science Course: C++

Lecture 9. Semantic Analysis Scoping and Symbol Table

APPLICATIONS AND MODELING WITH QUADRATIC EQUATIONS

Scope and Sequence KA KB 1A 1B 2A 2B 3A 3B 4A 4B 5A 5B 6A 6B

SOLVING EQUATIONS WITH RADICALS AND EXPONENTS 9.5. section ( )( ). The Odd-Root Property

CISC 181 Project 3 Designing Classes for Bank Accounts

Transcription:

Laboratory Assignments of OBJECT ORIENTED METHODOLOGY & PROGRAMMING (USING C++) [IT 553]

Books: Text Book: 1. Bjarne Stroustrup, The C++ Programming Language, Addison Wesley 2. Robert Lafore, Object-Oriented Programming in C++, Fourth Edition, SAMS 3. Dale and Weems, Programming and Problem solving with C++, Jones and Bartlett, 2010 Reference Book 1. E. Balaguruswami, Object Oriented Programming C++, TMH 2. Steve Oualline, Practical C++ Programming O'Reilly & Associates, Inc.

Assignment I Class, object, Function 1. Write an inline function to obtain largest of three numbers. 2. Write a function called hms_to_secs() that takes three int values for hours, minutes, and seconds as arguments, and returns the equivalent time in seconds (type long). Create a program that exercises this function by repeatedly obtaining a time value in hours, minutes, and seconds from the user (format 12:59:59), calling the function, and displaying the value of seconds it returns. 3. 3. Define a class to represent a bank account. It contains Data Members: Name of the depositor Account Number Type of account Balance Member Functions: To assign initial values To deposit an amount To withdraw an amount < amount available Display the name and balance. 4. Create a bank account by supplying a user id and password. Login using their id and password. Quit the program. Now if login was successful the user will be able to do the following: Withdraw money. Deposit money. Request balance.

Quit the program. If login was not successful (for example the id or password did not match) then the user will be taken back to the introduction menu. 5. Create a class to add Two times provided in hour minute format. Use functions a)void input() to provide hour and minute. b) void gettime(int,int) to take hour and minute entered by user. c) sum(time <oj>, time <ob> ) to add minutes and hours. If minutes is >60 add 1 with hour. d) void display() to display the result. 6. To write a C++ program to add two complex numbers using object as argument. Algorithm: class as complex. data members as real and img. member functions void getdata() void show() void sum(complex c1,complex c2) getdata() method is used to get the values. show() method is used to display the values. sum() method is used to perform addition operation using object as argument. 7. To write a C++ program to display the student details using class and array of object. Algorithm: class as student. data members rollno, name, mark1, mark2, mark3, total and average. member functions as getdata() and displaydata(). getdata() method used to get the student details.

displaydata() method used to display the student details. create an object array for the student class using the following syntax: Get the number of students. Enter student details display the student details 8. Re-write the time addition program using friend function. 9. write C++ program to define matrix and vector class, to use function with default argument and to do matrix -vector multiplication using friend function. Declare vector Class Define matrix Class Declare friend function multiply() inside the matrix class Define vector Class Declare friend function multiply(matrix &, vector &) inside the vector class Define getvector() function with for loop to get the elements for vector Define disvector() function with for loop to display the contents of vector Define getmatrix() function with nested for loops to get the matrix elements Define dismatrix() function with nested for loops to display the matrix Define the multiply() to multiply matrix and vector a. No of columns in the matrix should be equal to no. of elements in the vector b. Apply the matrix-vector multiplication mechanism: For simplicity take the matrix as 3X3 and the vector as 1X3. 1,2,3,6, and 9 are basic category and 4,5,7 and 8 are intellectual category

Assignment II Constructor 1. Write a C++ program to add two complex numbers. i) The class Complex contains three constructors. and a) One with no parameter. (Used for the object for storing result.) b) With one parameter(same value for real and imaginary part) c) With two parameters. ii) Two friend functions a) One to add two complex number by taking two reference variables of class complex and returning another reference. b) To display the result. 2. A Bank gives 4% interest on current account and 6% interest on savings account. An additional 3% interest is provided for savings duration of 5 years and above. Using dynamic initialization of constructor write banking program using C++.

Assignment III Operator Overloading and Type Conversion 1. Check whether a number is even or odd by overloading! operator. 2. ii) Check whether a number is prime or not by overloading -- operator [Hints Use the concept of overloading! operator]. 3. Add two complex number by overloading + operator a) Using Member function. b) Using Friend Function. 4. Class Distance consists of length in feet and inches. Class Distance contains i) one default constructor ii) iii) iv) one parameterized constructor function getdata() to take the value of feet and inches. function show() to display. a) Overload < operator to compare two distances. b) Overload += operator in the Distance class. 5. Concatenate two strings by overloading + operator. a) Overload ++ as prefix (++c1) and postfix (c1++) in some class. b) Overload == operator to compare two strings. 6. Write a program to convert a distance entered in Feet and Inches to Meter using class to basic data type conversion. 7. Two classes one is Civil_Time and Another is Railway_Time. Enter hours and minutes in Railway time(24 hour format) and display the time in Civil time(12 hour format with a.m. and p.m.) using one class type to another class type conversion. Assignments in Bold are in intellectual category

Assignment IV Inheritance 1. Class student contains roll number, name and course as data member and Input_student and display_student as member function. A derived class exam is created from the class student with publicly inherited. The derived class contains mark1, mark2, mark3 as marks of three subjects and input_marks and display_result as member function. Create an array of object of the exam class and display the result of 5 students. 2. Try the same program with privately inheritance. 3. Write a program where derived class is a friend of base class. 4. Test whether the Base class be a friend of Derived class. 5. Class user contains data member name and age. A constructor with two arguments is used to assign name and age. User are of two types a) Student and b) Teacher. class Student contains data member i)course ii) Roll Number and iii)marks and method display() to display data related to student. class Teacher contains data member i) subject_assigned (May take this as an array) ii) contact_hour and method display() to display data related to teacher. Implement this program using base class constructor in derived class. 6. Base class count contains a variable c. It contains a no argument constructor, one argument constructor, a method to return c and a operator overloading function for ++. Derived class counter access the value of c from base class constructor through its constructor and a operator overloading function for --. 7. Class Student contains data member Name, roll as protected. Method get() to name & roll and display() to display name and roll. Class Mark is publicly inherited from Student. It contains protected data member mark1,mark2 i.e. marks of two subjects & get_marks() and display_marks() as public. Class Result is publicly inherited from Mark. It contains private data member total and two public method cal_result( ) to calculate total and display_result() with comment whether the student has passed or not.

Write a C++ program to display result in the following format 8. Rewrite the program in 7 with method overriding. Take the methods in all classes are get() and display(). 9.. Write a C++ program to implement the following level of inheritance.

10. A University and a Company have jointly taken a project. Class University contains name of the university, department to which the project is assigned, person to whom the project is assigned. A function display is there to display the information. Class Company contains name of the company, Number of Engineers assigned, amount invested to do the project. A function display is there to display the information. Class Project is inherited from University and Company. It contains type of project, duration of project, amount granted to complete the project. A function display displays the related information. Write a C++ program to implement this and display all information except amount invested by company from Project class. 11. Base1 and Base2 contains a public, protected and private data member. Base1 is a friend of Base2. class Derived is inherited from Base1 a Base2. Write a C++ program to check the accessibility of the data members of Base1 and Base2 from Derived. 12. Result of a student is dependent on his examination mark and extracurricular marks. create four classes Student, Examination, Extracurricular, Result. The data members and methods of different classes are given below. class Examination and Extracurricular are inherited from Student and Result is multiply inherited from Examination and Extracurricular. 13. Test whether the diamond problem exist is Friend Class. Assignments in Bold are in intellectual category

Assignment V Pointer, Virtual Function and Polymorphism 1. Write a program using this pointer to find out the least number obtained among three subjects. Use ternary operator. 2. Class polygon contains data member width and height and public method set_value() to assign values to width and height. class Rectangle and Triangle are inherited from polygon class. Both the classes contain public method calculate_area() to calculate the area of Rectangle and Triangle. Use base class pointer to access the derived class object and show the area calculated. 3. Write a program to create a class shape with functions to find area of and display the name of the shape and other essential component of the class. Create derived classes circle, rectangle and trapezoid each having overridden functions area and display. Write a suitable program to illustrate virtual functions. 4. Write a program with Student as abstract class and create derive classes Engineering, Medicine and Science from base class Student. Create the objects of the derived classes and process them and access them using array of pointer of type base class Student.

Assignment VI Exception Handling 1. Two integers are taken from keyboard. Then perform division operation. a) A try block to throw an exception when a wrong type of data is keyed. b) When division by zero occurs. write appropriate catch block to handle the exception thrown. 2. Design stack and queue classes with necessary exception handling. Assignment VII Template 1. Design a class Template to find the largest among three numbers using ternary operator. 2. Design a class Template to implement stack. 3. Write a template to sort an array by ascending order. 4. Design a template to find the largest among three numbers of different data types. 5. Design a template for calculating x y where x may be integer or float (not char or string) and y must be integer. Put appropriate alert for wrong data type. 6. Design a template to show that integer/integer is integer by if any one of them is float it returns float.