Lab Task 1:
Write a program to create a class Student with data ‘name, city and age’ along with getter, setter and printData() method to display the data. Create the two objects s1, s2 to declare and access the values in main class.
Lab Task 2:
Write a class named Employee that has the
following member variables:
• name. A string that holds the
employee’s name.
• idNumber. An int variable that holds
the employee’s ID number.
• department. A string that holds the
name of the department where the employee works.
• position. A string that holds the
employee’s job title.
Write appropriate setter
functions that store values in these member variables and getter functions that return the values
in these member variables.
Once you have
written the class, write a main program that creates FOUR Employee objects to hold the above data.
The program should input the data from user in the four objects and then display the data in tabular form for each employee on the screen.
Lab Task 3:
Design a class that stores a temperature in a temperature member variable
and has the appropriate constructor,
setter and getter functions. In addition to these, the class should have
the following member functions:
• isEthylFreezing. This function should return the bool value
true if the temperature stored in the temperature field is at or below the
freezing point of ethyl alcohol. Otherwise, the function should return false.
• isEthylBoiling. This function should return the bool value
true if the temperature stored in the temperature field is at or above the
boiling point of ethyl alcohol. Otherwise, the function should return false. •
• isWaterFreezing. This function should return the bool value
true if the temperature stored in the temperature field is at or below the
freezing point of water. Otherwise, the function should return false.
• isWaterBoiling. This function should return the bool value
true if the temperature stored in the temperature field is at or above the
boiling point of water. Otherwise, the function should return false.
Write a program that demonstrates the class. The program
should ask the user to enter a
temperature and then display a list of the substances that will freeze at that
temperature and those that will boil at that temperature. For example, if the
temperature is −20 the class should report that water will freeze and for 100
water will boil.