You are on page 1of 2

Page 1 of 2

Assignment 01

OOP Section C ( Fall, 2020 )

Marks: 5*5=25
-All students of OOP Section C are requested to submit the solution in Moodle on/before 30 th, October,Friday.

-No submission will be accepted after due date. This is individual assignment.

-viva may be conducted if found suspicion on cheating/plagiarism.

-on front page must mention your full name, registration and section.

Task 1:

Write a program (using user define functions ) which asks user to select the one of the following operations
while calling void Menu() function in main.

Welcome to the calculator program

Press 1 for Addition

Press 2 for Subtraction

Press 3 for Multiplication

Press 4 for Division

Press 5 for Power

Press 6 for Exit

After selecting one of the options program ask two numbers from user and do perform the task accordingly.

Task 2:

A class named “Employee” holds information like employee code, name,gender, year of joining. Write a
program to create three objects of employee and enter some data into it through setters. Make getters and
setters for all employee information. Then ask the user to enter current year. Display the names of those
employees whose tenure is 2 or more than 2 years according to the given current year only using getters.

Task 3:
Page 2 of 2

A class named “Employee” holds information like employee code, name,gender, year of joining. Write a
program to create five hundred objects (Array of employee objects )of employee and enter some data into it
through setters. Make getters and setters for all employee information. Then ask the user to enter current year.
Display the names of those employees whose tenure is 5 or more than 5 years according to the given current
year only using getters.

Note: employee code is automatically assigned to newly created object by calling default constructor

Task 4:

Raising a number to a power p is the same as multiplying n by itself p times. Write a function called power that
takes two arguments, a double value for n and an int value for p, and return the result as double value. Use
default argument of 2 for p, so that if this argument is omitted the number will be squared. Write the main
function that gets value from the user to test power function.

Task 5:

Define a class StudentReport with the following specification:

Private members :

adno 4 digit admission number

name 20 characters

marks an array of 5 floating point values

average average marks obtained

GETAVG() a function to compute the average obtained in five subject

Public members:

READINFO() function to accept values for adno, name, marks. Invoke the function

GETAVG()

DISPLAYINFO() function to display all data members of StudentReport on the screen.

You should give function definitions outside the class using scope resolution operator.

You might also like