SlideShare a Scribd company logo
Object Oriented Programming
Assignment # 03
Deadline: Monday, 20th June
How to Submit
 Create the assignment in MS Word or write it by hand
 Attach screenshot of the output of each program
 Take printout of the assignment and submit it in hard form.
Please read the following instructions carefully before submitting the assignment.
It should be clear that your assignment will not get any credit if the assignment is copied (partial
or full) from any source (websites, forums, students etc.).
Question 01:
Write a class Marks with three data members to store three marks. Write three member
functions in() to input, sum() to calculate and return the sum and avg() to calculate and return
the average marks. Also write the constructor for this class that initializes all data members to
zero. In main function, create an object and make use of all functions.
Question 02:
Write a class Circle with one data member radius. Write three member functions setRadius() to
set radius value with parameter value, area() to calculate and display area of circle and circum()
to calculate and display circumference of circle. Also write the constructor for this class that
initializes all data members to zero. In main function, create an object and make use of all
functions.
Question 03:
Write a class Book with three data members BookID, Pages and Price. It also contains the
following member functions:
 The get() function is used to input values
 The show() function is used to display values
 The set() function is used to set the values of data members using parameters
 The getPrice() is used to return the value of Price
The program should create two objects of this class and input values for these objects. The
program should display the details of the most costly book.
Question 04:
Write a class Result that contains roll no, name and marks of three subjects. The marks are
stored in an array of integers. The class also contains the following member functions:
 The input() function is used to input values of data members
 The show() function is used to display the values of data members
 The total() function returns the total marks of a student
 The avg() function returns the average marks of a student
The program should create an object of this class and make use of all member functions.
Question 05:
Write a class Array that contains an array of integers to store five values. It also contains the
following member functions:
 The fill() function is used to fill the array with values form user
 The display() function is used to display the values of array
 The max() function shows the maximum value in array
 The min() function shows the minimum value in array
All the member functions should be defined outside class. In main function, create an object of
type Array and make use of all member functions.
Question 06:
Create a class called employee that contains two members: an employee number (type int) and
the employee’s compensation (in rupees; type float). Member functions should allow the user
to enter this data and display it.
Question 07:
Define a class for Bank Account that includes following data members:
 Name of account holder
 Account Number
 Type of Account (Current, Saving)
 Balance amount in the account
The class also contains the following member functions:
 A constructor to assign the initial values
 CreateAccount() function to assign all data members through parameters
 Deposit function to deposit some amount. It should accept the amount as parameter.
 Withdraw function to withdraw an amount after checking the balance. It should accept
the amount in parameter.
 Display function to display all account details.
In main function, create an object and make use of all functions. The program should display a
proper menu to the user and perform the appropriate function according to the user choice.
The menu should be continuously displayed to the user again and again until user gives proper
choice to exit the program.
Question 08:
Write a class Run that contains the following data members:
 The name of the runner
 The distance covered by the runner
This class has following member functions:
 Get function to input runner name and distance
 Show function to display runner name and distance
The user should be able to show the name of the runner who has covered the longest distance
at any point of time. Use appropriate function in class to implement this functionality.
Question 09:
Write a class Car that contains the following attributes:
 The name of car
 The direction of car (E, W, N, S)
 The position of car (from imaginary zero point)
The class has following member functions:
 A constructor to initialize the attributes
 Turn function to change the direction of car to one step right side (e.g. if the direction is
to E, it should be changed to S and so on.)
 Overload the Turn function to change the direction to any side directly. It should accept
the direction as parameter.
 Move function to change the position of car away from zero point. It should accept the
distance as parameter.
 Show function to display all the data for a car
In main function, create an object and make use of all functions. The program should display a
proper menu to the user and perform the appropriate function according to the user choice.
The menu should be continuously displayed to the user again and again until user gives proper
choice to exit the program.
Question 10:
Imagine a tollbooth at a bridge. Cars passing by the booth are expected to pay 50 rupees toll.
Mostly they do, but sometimes a car goes by without paying. The tollbooth keeps track of the
number of cars they have gone by, and of total amount of money collected.
Model this tollbooth with a class called tollbooth. The two data items are a type unsigned int to
hold the total number of cars and a type int to hold the total amount of money collected. A
constructor initializes both of these to zero. A member function called payingCar() increments
the car total and adds 50 to the cash total. Another function called noPayCar() increments the
car total but adds nothing to the cash total. Finally, a member function called display() displays
the two totals. Make appropriate member function const.
In main function, create an object of this class. The program should display a proper menu to
the user and perform the appropriate function according to the user choice. The menu should
be continuously displayed to the user again and again until user gives proper choice to exit the
program.
Question 11:
Create a class called Time that has separate int data members for hours, minutes and seconds.
One constructor should initialize this data to 0 and another should initialize it to parameterized
values. A member function should display it, in 11:59:59 format. Another member function
should adjust the time values if they exceed by their limits (e.g. adjust seconds if they are
greater than 59 and add relative seconds to minutes). The final member function should add
two objects of type time passed as arguments.
A main() program should create two initialized time objects and one that isn’t initialized. Then
it should add the two initialized values together, leaving the result in third time variable. Adjust
the time values of this third variable and finally display its values. Make appropriate member
function const.
Question 12:
Create a class that includes a data member that records a count of how many objects have
been created so far. (This member should be applied to the class as a whole; not to individual
objects. What keyword specifies this?) Then, as each object is created, its constructor can
examine this count member variable to determine the appropriate serial number for the new
object. Add a member function that permits an object to report its own serial number.
Write main() program that creates three objects and queries each one about its serial number.
They should respond I am object number 2, and so on.
Question 13:
Create a class Student that contains following data members:
 static variable to create unique numbers
 A variable to store roll number
 A variable to store name of student
 An array to store marks of 5 subjects
This class should have following member functions:
 A constructor with no-parameters that increments static variable and assign it to roll
number. Remaining data members should be initialized to zero or empty values.
 Input() function to input name and marks of 5 subjects from user
 Show() function to display roll number, name and marks of 5 subjects to the user
 TotalStudents() function that should display the number of objects that has been
created so far. This function should be static.
 TotalMarks() function that should calculate and return to total marks of a student
 getHighest() function that returns highest marks of the student
 getLowest() function that returns lowest marks of the student
 getAverage() function that returns average marks of student
 getPassCount() function that counts and returns total number of subjects in which the
student is passed. (A student is passed if he gets 50% or above marks)
In main function, create three objects, input their values and display them. For each student, display
his total marks, highest, lowest, average marks and the number of subjects in which he is passed. Also
display how many students have been registered so far.

More Related Content

What's hot

Functions in c language
Functions in c language Functions in c language
Functions in c language
tanmaymodi4
 
friend function(c++)
friend function(c++)friend function(c++)
friend function(c++)
Ritika Sharma
 
Data types in C
Data types in CData types in C
Data types in C
Tarun Sharma
 
Unit 2. Elements of C
Unit 2. Elements of CUnit 2. Elements of C
Unit 2. Elements of C
Ashim Lamichhane
 
Software requirements
Software requirementsSoftware requirements
Software requirements
Dr. Loganathan R
 
Data Types and Variables In C Programming
Data Types and Variables In C ProgrammingData Types and Variables In C Programming
Data Types and Variables In C Programming
Kamal Acharya
 
Polymorphism in oop
Polymorphism in oopPolymorphism in oop
Polymorphism in oop
MustafaIbrahimy
 
Structure of C++ - R.D.Sivakumar
Structure of C++ - R.D.SivakumarStructure of C++ - R.D.Sivakumar
Structure of C++ - R.D.Sivakumar
Sivakumar R D .
 
Inheritance in JAVA PPT
Inheritance  in JAVA PPTInheritance  in JAVA PPT
Inheritance in JAVA PPT
Pooja Jaiswal
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
RahulAnanda1
 
Friend functions
Friend functions Friend functions
Friend functions Megha Singh
 
Operators in c programming
Operators in c programmingOperators in c programming
Operators in c programming
savitamhaske
 
Constructor overloading & method overloading
Constructor overloading & method overloadingConstructor overloading & method overloading
Constructor overloading & method overloading
garishma bhatia
 
Parse Tree
Parse TreeParse Tree
Parse Tree
A. S. M. Shafi
 
JAVA AWT
JAVA AWTJAVA AWT
JAVA AWT
shanmuga rajan
 
Control structure C++
Control structure C++Control structure C++
Control structure C++
Anil Kumar
 
Operators in java
Operators in javaOperators in java
Operators in java
Then Murugeshwari
 
Data members and member functions
Data members and member functionsData members and member functions
Data members and member functions
Marlom46
 
Major and Minor Elements of Object Model
Major and Minor Elements of Object ModelMajor and Minor Elements of Object Model
Major and Minor Elements of Object Model
sohailsaif
 
C Programming: Control Structure
C Programming: Control StructureC Programming: Control Structure
C Programming: Control Structure
Sokngim Sa
 

What's hot (20)

Functions in c language
Functions in c language Functions in c language
Functions in c language
 
friend function(c++)
friend function(c++)friend function(c++)
friend function(c++)
 
Data types in C
Data types in CData types in C
Data types in C
 
Unit 2. Elements of C
Unit 2. Elements of CUnit 2. Elements of C
Unit 2. Elements of C
 
Software requirements
Software requirementsSoftware requirements
Software requirements
 
Data Types and Variables In C Programming
Data Types and Variables In C ProgrammingData Types and Variables In C Programming
Data Types and Variables In C Programming
 
Polymorphism in oop
Polymorphism in oopPolymorphism in oop
Polymorphism in oop
 
Structure of C++ - R.D.Sivakumar
Structure of C++ - R.D.SivakumarStructure of C++ - R.D.Sivakumar
Structure of C++ - R.D.Sivakumar
 
Inheritance in JAVA PPT
Inheritance  in JAVA PPTInheritance  in JAVA PPT
Inheritance in JAVA PPT
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Friend functions
Friend functions Friend functions
Friend functions
 
Operators in c programming
Operators in c programmingOperators in c programming
Operators in c programming
 
Constructor overloading & method overloading
Constructor overloading & method overloadingConstructor overloading & method overloading
Constructor overloading & method overloading
 
Parse Tree
Parse TreeParse Tree
Parse Tree
 
JAVA AWT
JAVA AWTJAVA AWT
JAVA AWT
 
Control structure C++
Control structure C++Control structure C++
Control structure C++
 
Operators in java
Operators in javaOperators in java
Operators in java
 
Data members and member functions
Data members and member functionsData members and member functions
Data members and member functions
 
Major and Minor Elements of Object Model
Major and Minor Elements of Object ModelMajor and Minor Elements of Object Model
Major and Minor Elements of Object Model
 
C Programming: Control Structure
C Programming: Control StructureC Programming: Control Structure
C Programming: Control Structure
 

Similar to OOP Assignment 03.pdf

Exercise1[5points]Create the following classe
Exercise1[5points]Create the following classeExercise1[5points]Create the following classe
Exercise1[5points]Create the following classe
mecklenburgstrelitzh
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
C++ Homework Help
 
Bottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docxBottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docx
AASTHA76
 
Lab exam question_paper
Lab exam question_paperLab exam question_paper
Lab exam question_paper
Kuntal Bhowmick
 
OOP Programs
OOP ProgramsOOP Programs
OOP Programs
hirrahAzhar
 
OOP program questions with answers
OOP program questions with answersOOP program questions with answers
OOP program questions with answers
Quratulain Naqvi
 
A06
A06A06
A06
lksoo
 
Chapter 8Exercise1.Design an application that accept.docx
Chapter 8Exercise1.Design an application that accept.docxChapter 8Exercise1.Design an application that accept.docx
Chapter 8Exercise1.Design an application that accept.docx
tiffanyd4
 
Java conceptual learning material
Java conceptual learning materialJava conceptual learning material
Java conceptual learning material
ArthyR3
 
Develop a system flowchart and then write a menu-driven C++ program .pdf
Develop a system flowchart and then write a menu-driven C++ program .pdfDevelop a system flowchart and then write a menu-driven C++ program .pdf
Develop a system flowchart and then write a menu-driven C++ program .pdf
leventhalbrad49439
 
COIT20245, 2016 Term One - Page 1 of 9 Assessment detail.docx
COIT20245, 2016 Term One - Page 1 of 9 Assessment detail.docxCOIT20245, 2016 Term One - Page 1 of 9 Assessment detail.docx
COIT20245, 2016 Term One - Page 1 of 9 Assessment detail.docx
clarebernice
 
Exercise P8.1. Derive a class Programmer from Employee. .docx
Exercise P8.1. Derive a class Programmer from Employee. .docxExercise P8.1. Derive a class Programmer from Employee. .docx
Exercise P8.1. Derive a class Programmer from Employee. .docx
delciegreeks
 
Presentation 2 (1).pdf
Presentation 2 (1).pdfPresentation 2 (1).pdf
Presentation 2 (1).pdf
ziyadaslanbey
 
Intro To C++ - Class 05 - Introduction To Classes, Objects, & Strings
Intro To C++ - Class 05 - Introduction To  Classes, Objects, & StringsIntro To C++ - Class 05 - Introduction To  Classes, Objects, & Strings
Intro To C++ - Class 05 - Introduction To Classes, Objects, & Strings
Blue Elephant Consulting
 
Mmt 001
Mmt 001Mmt 001
Mmt 001
sujatam8
 
CSCI1250 Project 3 Fall 2015 CSCI1250 INTRODUCTIO.docx
CSCI1250    Project 3  Fall 2015  CSCI1250 INTRODUCTIO.docxCSCI1250    Project 3  Fall 2015  CSCI1250 INTRODUCTIO.docx
CSCI1250 Project 3 Fall 2015 CSCI1250 INTRODUCTIO.docx
faithxdunce63732
 
Cis 355 i lab 3 of 6
Cis 355 i lab 3 of 6Cis 355 i lab 3 of 6
Cis 355 i lab 3 of 6helpido9
 
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
gilbertkpeters11344
 
C++ Lab Maual.pdf
C++ Lab Maual.pdfC++ Lab Maual.pdf
C++ Lab Maual.pdf
Thejeswara Reddy
 
C++ Lab Maual.pdf
C++ Lab Maual.pdfC++ Lab Maual.pdf
C++ Lab Maual.pdf
ShivamParjapati2
 

Similar to OOP Assignment 03.pdf (20)

Exercise1[5points]Create the following classe
Exercise1[5points]Create the following classeExercise1[5points]Create the following classe
Exercise1[5points]Create the following classe
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
 
Bottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docxBottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docx
 
Lab exam question_paper
Lab exam question_paperLab exam question_paper
Lab exam question_paper
 
OOP Programs
OOP ProgramsOOP Programs
OOP Programs
 
OOP program questions with answers
OOP program questions with answersOOP program questions with answers
OOP program questions with answers
 
A06
A06A06
A06
 
Chapter 8Exercise1.Design an application that accept.docx
Chapter 8Exercise1.Design an application that accept.docxChapter 8Exercise1.Design an application that accept.docx
Chapter 8Exercise1.Design an application that accept.docx
 
Java conceptual learning material
Java conceptual learning materialJava conceptual learning material
Java conceptual learning material
 
Develop a system flowchart and then write a menu-driven C++ program .pdf
Develop a system flowchart and then write a menu-driven C++ program .pdfDevelop a system flowchart and then write a menu-driven C++ program .pdf
Develop a system flowchart and then write a menu-driven C++ program .pdf
 
COIT20245, 2016 Term One - Page 1 of 9 Assessment detail.docx
COIT20245, 2016 Term One - Page 1 of 9 Assessment detail.docxCOIT20245, 2016 Term One - Page 1 of 9 Assessment detail.docx
COIT20245, 2016 Term One - Page 1 of 9 Assessment detail.docx
 
Exercise P8.1. Derive a class Programmer from Employee. .docx
Exercise P8.1. Derive a class Programmer from Employee. .docxExercise P8.1. Derive a class Programmer from Employee. .docx
Exercise P8.1. Derive a class Programmer from Employee. .docx
 
Presentation 2 (1).pdf
Presentation 2 (1).pdfPresentation 2 (1).pdf
Presentation 2 (1).pdf
 
Intro To C++ - Class 05 - Introduction To Classes, Objects, & Strings
Intro To C++ - Class 05 - Introduction To  Classes, Objects, & StringsIntro To C++ - Class 05 - Introduction To  Classes, Objects, & Strings
Intro To C++ - Class 05 - Introduction To Classes, Objects, & Strings
 
Mmt 001
Mmt 001Mmt 001
Mmt 001
 
CSCI1250 Project 3 Fall 2015 CSCI1250 INTRODUCTIO.docx
CSCI1250    Project 3  Fall 2015  CSCI1250 INTRODUCTIO.docxCSCI1250    Project 3  Fall 2015  CSCI1250 INTRODUCTIO.docx
CSCI1250 Project 3 Fall 2015 CSCI1250 INTRODUCTIO.docx
 
Cis 355 i lab 3 of 6
Cis 355 i lab 3 of 6Cis 355 i lab 3 of 6
Cis 355 i lab 3 of 6
 
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
 
C++ Lab Maual.pdf
C++ Lab Maual.pdfC++ Lab Maual.pdf
C++ Lab Maual.pdf
 
C++ Lab Maual.pdf
C++ Lab Maual.pdfC++ Lab Maual.pdf
C++ Lab Maual.pdf
 

Recently uploaded

一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理
v3tuleee
 
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
yhkoc
 
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Subhajit Sahu
 
Quantitative Data AnalysisReliability Analysis (Cronbach Alpha) Common Method...
Quantitative Data AnalysisReliability Analysis (Cronbach Alpha) Common Method...Quantitative Data AnalysisReliability Analysis (Cronbach Alpha) Common Method...
Quantitative Data AnalysisReliability Analysis (Cronbach Alpha) Common Method...
2023240532
 
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
ahzuo
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
ewymefz
 
Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
Subhajit Sahu
 
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
vcaxypu
 
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
John Andrews
 
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
slg6lamcq
 
The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...
jerlynmaetalle
 
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
NABLAS株式会社
 
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
vcaxypu
 
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
AbhimanyuSinha9
 
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
nscud
 
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
u86oixdj
 
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project PresentationPredicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Boston Institute of Analytics
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
ewymefz
 
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
oz8q3jxlp
 
一比一原版(BU毕业证)波士顿大学毕业证成绩单
一比一原版(BU毕业证)波士顿大学毕业证成绩单一比一原版(BU毕业证)波士顿大学毕业证成绩单
一比一原版(BU毕业证)波士顿大学毕业证成绩单
ewymefz
 

Recently uploaded (20)

一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理
 
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
 
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
 
Quantitative Data AnalysisReliability Analysis (Cronbach Alpha) Common Method...
Quantitative Data AnalysisReliability Analysis (Cronbach Alpha) Common Method...Quantitative Data AnalysisReliability Analysis (Cronbach Alpha) Common Method...
Quantitative Data AnalysisReliability Analysis (Cronbach Alpha) Common Method...
 
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
 
Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
 
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
 
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
 
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
 
The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...
 
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
 
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
 
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
 
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
 
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
 
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project PresentationPredicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
 
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
 
一比一原版(BU毕业证)波士顿大学毕业证成绩单
一比一原版(BU毕业证)波士顿大学毕业证成绩单一比一原版(BU毕业证)波士顿大学毕业证成绩单
一比一原版(BU毕业证)波士顿大学毕业证成绩单
 

OOP Assignment 03.pdf

  • 1. Object Oriented Programming Assignment # 03 Deadline: Monday, 20th June How to Submit  Create the assignment in MS Word or write it by hand  Attach screenshot of the output of each program  Take printout of the assignment and submit it in hard form. Please read the following instructions carefully before submitting the assignment. It should be clear that your assignment will not get any credit if the assignment is copied (partial or full) from any source (websites, forums, students etc.). Question 01: Write a class Marks with three data members to store three marks. Write three member functions in() to input, sum() to calculate and return the sum and avg() to calculate and return the average marks. Also write the constructor for this class that initializes all data members to zero. In main function, create an object and make use of all functions. Question 02: Write a class Circle with one data member radius. Write three member functions setRadius() to set radius value with parameter value, area() to calculate and display area of circle and circum() to calculate and display circumference of circle. Also write the constructor for this class that initializes all data members to zero. In main function, create an object and make use of all functions. Question 03: Write a class Book with three data members BookID, Pages and Price. It also contains the following member functions:  The get() function is used to input values  The show() function is used to display values  The set() function is used to set the values of data members using parameters  The getPrice() is used to return the value of Price
  • 2. The program should create two objects of this class and input values for these objects. The program should display the details of the most costly book. Question 04: Write a class Result that contains roll no, name and marks of three subjects. The marks are stored in an array of integers. The class also contains the following member functions:  The input() function is used to input values of data members  The show() function is used to display the values of data members  The total() function returns the total marks of a student  The avg() function returns the average marks of a student The program should create an object of this class and make use of all member functions. Question 05: Write a class Array that contains an array of integers to store five values. It also contains the following member functions:  The fill() function is used to fill the array with values form user  The display() function is used to display the values of array  The max() function shows the maximum value in array  The min() function shows the minimum value in array All the member functions should be defined outside class. In main function, create an object of type Array and make use of all member functions. Question 06: Create a class called employee that contains two members: an employee number (type int) and the employee’s compensation (in rupees; type float). Member functions should allow the user to enter this data and display it. Question 07: Define a class for Bank Account that includes following data members:  Name of account holder  Account Number  Type of Account (Current, Saving)  Balance amount in the account The class also contains the following member functions:  A constructor to assign the initial values  CreateAccount() function to assign all data members through parameters  Deposit function to deposit some amount. It should accept the amount as parameter.
  • 3.  Withdraw function to withdraw an amount after checking the balance. It should accept the amount in parameter.  Display function to display all account details. In main function, create an object and make use of all functions. The program should display a proper menu to the user and perform the appropriate function according to the user choice. The menu should be continuously displayed to the user again and again until user gives proper choice to exit the program. Question 08: Write a class Run that contains the following data members:  The name of the runner  The distance covered by the runner This class has following member functions:  Get function to input runner name and distance  Show function to display runner name and distance The user should be able to show the name of the runner who has covered the longest distance at any point of time. Use appropriate function in class to implement this functionality. Question 09: Write a class Car that contains the following attributes:  The name of car  The direction of car (E, W, N, S)  The position of car (from imaginary zero point) The class has following member functions:  A constructor to initialize the attributes  Turn function to change the direction of car to one step right side (e.g. if the direction is to E, it should be changed to S and so on.)  Overload the Turn function to change the direction to any side directly. It should accept the direction as parameter.  Move function to change the position of car away from zero point. It should accept the distance as parameter.  Show function to display all the data for a car In main function, create an object and make use of all functions. The program should display a proper menu to the user and perform the appropriate function according to the user choice. The menu should be continuously displayed to the user again and again until user gives proper choice to exit the program.
  • 4. Question 10: Imagine a tollbooth at a bridge. Cars passing by the booth are expected to pay 50 rupees toll. Mostly they do, but sometimes a car goes by without paying. The tollbooth keeps track of the number of cars they have gone by, and of total amount of money collected. Model this tollbooth with a class called tollbooth. The two data items are a type unsigned int to hold the total number of cars and a type int to hold the total amount of money collected. A constructor initializes both of these to zero. A member function called payingCar() increments the car total and adds 50 to the cash total. Another function called noPayCar() increments the car total but adds nothing to the cash total. Finally, a member function called display() displays the two totals. Make appropriate member function const. In main function, create an object of this class. The program should display a proper menu to the user and perform the appropriate function according to the user choice. The menu should be continuously displayed to the user again and again until user gives proper choice to exit the program. Question 11: Create a class called Time that has separate int data members for hours, minutes and seconds. One constructor should initialize this data to 0 and another should initialize it to parameterized values. A member function should display it, in 11:59:59 format. Another member function should adjust the time values if they exceed by their limits (e.g. adjust seconds if they are greater than 59 and add relative seconds to minutes). The final member function should add two objects of type time passed as arguments. A main() program should create two initialized time objects and one that isn’t initialized. Then it should add the two initialized values together, leaving the result in third time variable. Adjust the time values of this third variable and finally display its values. Make appropriate member function const. Question 12: Create a class that includes a data member that records a count of how many objects have been created so far. (This member should be applied to the class as a whole; not to individual objects. What keyword specifies this?) Then, as each object is created, its constructor can examine this count member variable to determine the appropriate serial number for the new object. Add a member function that permits an object to report its own serial number. Write main() program that creates three objects and queries each one about its serial number. They should respond I am object number 2, and so on. Question 13: Create a class Student that contains following data members:  static variable to create unique numbers
  • 5.  A variable to store roll number  A variable to store name of student  An array to store marks of 5 subjects This class should have following member functions:  A constructor with no-parameters that increments static variable and assign it to roll number. Remaining data members should be initialized to zero or empty values.  Input() function to input name and marks of 5 subjects from user  Show() function to display roll number, name and marks of 5 subjects to the user  TotalStudents() function that should display the number of objects that has been created so far. This function should be static.  TotalMarks() function that should calculate and return to total marks of a student  getHighest() function that returns highest marks of the student  getLowest() function that returns lowest marks of the student  getAverage() function that returns average marks of student  getPassCount() function that counts and returns total number of subjects in which the student is passed. (A student is passed if he gets 50% or above marks) In main function, create three objects, input their values and display them. For each student, display his total marks, highest, lowest, average marks and the number of subjects in which he is passed. Also display how many students have been registered so far.