CS212-Object Oriented Programming (3+1) Assignment No. 1 (CLO-2)

$30.00

Category:

Description

5/5 - (3 votes)

Assignment must be submitted in printed form as well as in soft form (on LMS). Plagiarism in assignment
will lead to zero marks. Clearly mention your name, section & registration number on the assignment.
To get good marks you must use good programming practices & explain your solution through
comments.
Submission Date: 3
rd March 2016
__________________________________________________________________
Tasks:
1. Implement a class car. A car has a petrolLevel that indicates the level of petrol in the car. You are
required to do the following:
 Provide getter and setter for this data member.
 Implement constructor with default argument and with an initializer list.
 Supply a method movecar() that takes an integer as an argument and move the car
to the argument value which is in Km. Provided the petrol tank is not empty
otherwise displays an appropriate message. Moving for each km causes the
petrolLevel to go low by one.
 Write a method refill that refills the car tank to the maximum value of petrolLevel.
 Supply a method isEmpty that tells whether the Petrol tank is Empty or not.
 Write main program to test this functionality.
2. Create a class called Time that takes time in 24 hour format (create a constructor for this) and has a
member function which converts it into 12 hour format (i.e. a.m. / p.m. format). Also create a
display function which prints this output. Use getter and setter functions in your implementation.
Also implement a destructor in your class.
3. Make a program using class/classes that can have student score information including:
 3 Assignments
 2 OHTs
 5 Quizzes
 ESE
The program should ask user to enter total and obtained number for each item. You have seen how your
final score of each subject is calculated i.e. 10% Assignments, 30% OHTs, 10% quizzes and 50% ESE. You
have to calculate the average of each item if there is more than 1 value for that item. And calculate a
final score out of 100. Use member functions for setting, getting values and other functions for
calculations.
Deliverables
Submit hard copy of assignment in the class. For soft form submit folder of source code files on the
given LMS link which contains all solved questions. Make sure your folder/files are named on your
Name, Section & Reg. No. You must submit a source code file, not an exe or any other kind of file.
Always submit well before the deadline to avoid any last minute delays.