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

MISY - 3433 - Exam2 - Version - Spring 2021 To Post

The document is an exam for a Java Applications course testing programming skills. It has two parts: 1) multiple choice questions and 2) a programming problem. The problem asks students to write a program to calculate an employee's net salary given their hourly rate and hours worked. It provides sample input/output data. The document includes grading rubrics and sample code for a Salary class and tester class to solve the problem.

Uploaded by

Bhimsen Shrestha
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 views8 pages

MISY - 3433 - Exam2 - Version - Spring 2021 To Post

The document is an exam for a Java Applications course testing programming skills. It has two parts: 1) multiple choice questions and 2) a programming problem. The problem asks students to write a program to calculate an employee's net salary given their hourly rate and hours worked. It provides sample input/output data. The document includes grading rubrics and sample code for a Salary class and tester class to solve the problem.

Uploaded by

Bhimsen Shrestha
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/ 8

Version A

MISY 3433-001: Java Applications in Business


Spring 2020
April 06, 2021
Exam #2

Name: Bal Pandey

The exam is made up of two parts:

Part I: Multiple Choice (20 questions) 50 points


Part II: Problem (1 problem) 100 points

Note:
1. Write your name on your test
2. Use ECLIPE to write your code
3. Copy and paste your code in the space labeled “Your code” at the end of the test paper
4. Save your work
5. Upload your work on Canvas
6. The grading rubrics are provided in the last page of the test.

1
Version A

Part I: Multiple Choice (ONLINE on Canvas)

Part II: Problem

Write a program to compute and display the net salary of an employee, given the number of
hours worked and the hourly rate. All employees are entitled to a minimum of 40 hours (if
you work less than 40hours you are paid for 40hours). The rate for taxes varies depending of
the gross salary as follow:
Gross Salary Taxes rate
Gross salary <= 1000 1.5%
Gross salary > 1000 1.61%
Your program will prompt the user to input the data from the keyboard.

Test your program with the following data:

Input Expected result


Number of hours (h) Hourly rate ($) Net Salary
55 $10.75 $582.38
81 $15.45 $1231.30
20 $12 $472.80

CODE FOR CLASS SALARY


/*
Nabharaj Shrestha
MISY 3433-001: Java Applications in Business
EXAM 2 Part 2
Task :- Compute and display Net Salary of Employee
*/
package Salary;

public class Salary


{
String firstName;
String lastName;
double hourlyRate;
double numberOfhour;
double GrossSalary;
double Tax;
double NetSalary;

Salary(String informedFirstName, String informedLastName, double


informedHourlyRate, double
informedNumberOfHourlyWorked)
{
firstName= informedFirstName;
lastName= informedLastName;

2
Version A

hourlyRate= informedHourlyRate;
numberOfhour =informedNumberOfHourlyWorked;

void computeGrossSalary()
{
if (numberOfhour>40)
{
GrossSalary= hourlyRate*numberOfhour;
}
else
{
GrossSalary=40*hourlyRate;
}

}
void computeTax()
{
if (GrossSalary<=1000)
{
Tax = 0.015* GrossSalary;
}
else
{
Tax=0.0161* GrossSalary;
}

}
void computeNetSalary()
{
NetSalary=GrossSalary-Tax;
}
double displayNetSalary()
{
return NetSalary;
}
String getName()
{
return firstName + " " +lastName;
}
}

3
Version A

CODE FOR CLASS NET SALARY DISPLAY

/*
Nabharaj Shrestha
MISY 3433-001: Java Applications in Business
EXAM 2 Part 2
Task :- Compute and display Net Salary of Employee
*/
package Salary;

public class NetSalaryDisplay {

public static void main(String[] args)


{
Salary s1 = new Salary("Nabharaj","Shrestha",10.75, 55);
s1.computeGrossSalary();
s1.computeTax();
s1.computeNetSalary();
System.out.println(s1.getName());
System.out.println(s1.displayNetSalary());

4
Version A

5
Version A

OUTPUT

6
Version A

When hourlyRate= 12, numberOfhour=20

When hourlyRate= 10.75, numberOfhour=55

7
Version A

When hourlyRate= 15.45, numberOfhour=81

Grading Rubrics

Part I: Multiple Choice (2.5 points per question)

Part II: Problem (100 Points)


Analysis => 25pts
No compilation error => 10pts
Comments in the program => 5pts
Class
Attributes => 5pts
Constructor => 5pts
Methods => 15pts

Tester Class
Input data => 10pts
Process data => 15pts
Print result => 10pts

Good Luck!!!

You might also like