0% found this document useful (0 votes)
58 views2 pages

COMSATS University Islamabad, Islamabad Campus: FIRST Sessional Examination, Fall 2020 Part - Ii

The document provides instructions for a programming assignment that requires students to write a Java program. The program takes in an employee's department number and salary as input, and calculates the raised salary based on different raise percentages for different departments. It also includes an arithmetic expression problem that requires calculating the value of expression S given the values of variables A, B, C, X, and Y.

Uploaded by

Zojaan Aheer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views2 pages

COMSATS University Islamabad, Islamabad Campus: FIRST Sessional Examination, Fall 2020 Part - Ii

The document provides instructions for a programming assignment that requires students to write a Java program. The program takes in an employee's department number and salary as input, and calculates the raised salary based on different raise percentages for different departments. It also includes an arithmetic expression problem that requires calculating the value of expression S given the values of variables A, B, C, X, and Y.

Uploaded by

Zojaan Aheer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Student name & reg. no.

: _________________________________________________

COMSATS University Islamabad, Islamabad campus


Department of Computer Science

FIRST Sessional Examination, Fall 2020


PART – II
Class: BCS/BSE 2 Marks: 15
Subject: CSC103 Programming Fundamentals Time: 25 min
Instructors: Dr. Manzoor Ilahi Tamimy / Mr. Rizwan Rashid / Ms. Saadia Maqbool / Dr. Behjat Zuhaira
Dated: October 23, 2020

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:

 Employees in departments 11 and 22 are receiving a 2% raise in their salaries


 Employees in department 33 are receiving a 1.5% raise in their salaries

 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. : _________________________________________________

Q – 5 (CLO – 2) Operator precedence (Marks 05):


Solve the given arithmetic expression. Write all steps clearly.
The values of variables are: A = 6, B = 3, C = 8, X = 2, Y = 5

S = 7 + 3X % 5 – 11(Y – 4) + A + B – C / X

package test;

public class {

public static void main(String[] args) {


int A = 6 ;B = 3; C = 8; X = 2; Y = 5;

int S = 7 + 3*(X % 5) – 11*(Y – 4) + A + B – C / X;


System.out.println(S);
}
}

Page 2 of 2

You might also like