Assignment 03

OOP #5 Question Bank
#Questions
Note that you have always to comment and test your programs appropriately, not just for this exercise on this worksheet. We will not write this to the exercises in future, but still if you fail to do so you cannot gain full marks.
1Write a program to create a room class, the attributes of this class is roomno, roomtype, roomarea and ACmachine. In this class the member functions are setdata and displaydata.
2Define a class ClubMember and a constructor to create it. A club member should be constructed from the three field variables firstName, surname, and yearOfJoining of types String, String, and int, resp. Implement methods public String getFirstName(), public String getSurname(), public String getYearOfJoining(), and public void setSurname(String newSurname), sets the surname to the newSurname. Furthermore write a public String toString() method that is used for printing objects of class ClubMember in a user friendly way.
3Define a class Student. A Student should be represented by the field variables name, gender, studentID, and degreeProgramme, each of type String. Write a constructor Student, and getters public String getName(), public String getGender(), public String getStudentID(), and public String getDegreeProgramme(). Also write a method public String toString() that produces the following format:
[John Smith, male, ID: 1111111, ICY].
4Write a class Employee. Each employee is represented by their name, their hourlySalary, and their numberOfHours of types String, double and int, respectively. Write a class with constructor, getters, setters, and a toString method. Note that the naming of constructors, getters, and setter must follow the strict naming convention. Furthermore write two methods: First the monthly salary, public double monthlySalary(), which computes for an Employee object their monthly salary (as the product of hourly salary and their number of hours). Second, public void increaseSalary(double percentage), which increases the hourly salary by the percent- age in the argument.

Assignment Submission Form : Click here!