Object Oriented Programming Lab-1 + 2 Special Section - C335 Instructions
Object Oriented Programming Lab-1 + 2 Special Section - C335 Instructions
Lab- 1 + 2
Instructions:
• Work on your own in the lab task. No collaboration is allowed; otherwise it would result
in 'F'. You can use your books, notes, handouts etc.
• NO Evaluation will be done after lab.
• To get full credit of your efforts, follow the coding conventions as well as the comments
section that describes your logic to the teacher assistant.
• Email the lab to the email [email protected] with a proper subject of following
format: [RollNum]-Lab(1+2).
Task # 1:
Write a program that will take three parameters of integer type from user and display the table of
the required value from the starting limit to ending limit (starting limit < ending limit). The first
parameter will be the table value, second will be the starting limit and third will be the ending
limit. See the sample output for reference. (10 marks)
Sample Execution
Enter table value: 2 Enter table value: 2
Enter starting limit: -1 Enter starting limit: 0
Enter ending limit: -5 Enter ending limit: 8
Error, invalid starting limit, 2x0=0
ending limit must be greater
2 x 1= 2
than starting limit
. . . .
2 x 8 = 16
Write a program that reads a sentence (maximum 100 characters) as input and converts each
word to “Pig Latin.” In one version, to convert a word to Pig Latin you remove the first letter and
place that letter at the end of the word. Then you append the string “ay” to the word. (10 marks)
Here is an example:
English:
I SLEPT MOST OF THE NIGHT
Pig Latin:
IAY LEPTSAY OSTMAY FOAY HETAY IGHTNAY
Task # 3:
ADT: SchoolBus
3) Provide the implementation of appropriate accessor functions to get the values stored in
an object’s busNo, owner, and capacity member variables.
4) Provide the implementation of appropriate mutator functions to set the values of object’s
busNo, owner, and capacity member variables.
5) Provide the implementation of following member functions:
setSchoolBus(): accepts busNo, owner, and capacity as arguments and assigns them
to the appropriate member variables.
6) Test all of your functions in main function, and also creates three objects of SchoolBus
with following data with the following format:
(20 Marks)