You are on page 1of 1

DEPARTMENT OF COMPUTER SCIENCE

Subject: Java Instructor: M. Haroon Mehmood


Class: BSCS M &E Roll No.……..

Paper: Mid Term Time: 1:30 Hours Total Marks: 30


1. What is a fall through in switch? Explain it with an example. (05)
2. Write a class named “Employee” having following methods (15)
• ‘GetInfo ()’ which adds the salary, number of hours of work per day of
employee as parameter.
• ‘AddSal ()’ which adds 10 rupees to salary of the employee if its salary is
less than 500 rupees.
• ‘AddWork ()’ which adds 5 rupees to salary of employee if the number of
hours of work per day is more than 6 hours.
3. Write a class named Area to print the area of Rectangle and Square. The method which will
print the area of a rectangle will have two parameters i.e. Width and Height. While the
method to print the area of a Square will only have one parameter which will be the one
side only. And Ask user to enter the values separately. (10)

You might also like