COMSATS University Islamabad, Islamabad Campus: FIRST Sessional Examination, Fall 2020 Part - Ii
COMSATS University Islamabad, Islamabad Campus: FIRST Sessional Examination, Fall 2020 Part - Ii
: _________________________________________________
Instructions:
1. Solve all questions on question paper within the space provided.
2. Part – I is form-based and consists of Q – 1, Q – 2, and Q – 3.
3. Part – II consists of Q – 4 and Q – 5.
Q – 4 (CLO – 3) Program/Code (Marks 10): Write a complete Java program for the given scenario.
The program takes as input two values from the user: department and salary of an employee. For the value of
department, the user can enter one of the following values: 11, 22, and 33. Calculate and display the appropriate
amount of raised salary by using the following rules:
package sal;
import java.util.Scanner;
public class Sal {
public static void main(String[] args) {
Scanner input = new Scanner ( System.in);
System.out.println("enetr department num 11,22,33 and salary");
int dept = input.nextInt();
int salary = input.nextInt();
if(dept == 11 ||dept == 22)
salary += salary*0.02;
else
salary += salary*0.015;
System.out.println(salary);
}
}
Page 1 of 2
Student name & reg. no. : _________________________________________________
S = 7 + 3X % 5 – 11(Y – 4) + A + B – C / X
package test;
public class {
Page 2 of 2