Question

In: Computer Science

Scenario: The human resources department for your company needs a program that will determine how much...

Scenario: The human resources department for your company needs a program that will determine how much to deduct from an employee’s paycheck to cover healthcare costs. Health care deductions are based on several factors. All employees are charged at flat rate of $150 to be enrolled in the company healthcare system. If they are married there is an additional charge of $75 to cover their spouse/partner. If they have children, the cost is $50 per child. In addition, all employees are given a 10% deduction in the total cost if they have declared to be a “non-smoker”. Your goal is to create a program that gathers the employee’s name, marital status, number of children and whether or not they smoke tobacco for a single employee. While gathering this information, if the user enters at least one invalid value, the program must display one error message telling the user they made a mistake and that they should re-run the program to try again. The program must then end at this point. However, if all valid values are entered, the program should calculate the total cost of the healthcare payroll deduction and then print a well-formatted report that shows the employee’s name, marital status, total number of children, and smoker designation, and total deduction amount.

1. Create a defining diagram that shows the input, processing, and output

2. Show testing using the desk checking table method, to include test data, expected results, and a desk checking table. Make sure your desk checking considers multiple cases including both valid and invalid test data to prove your algorithm will work in all cases

Solutions

Expert Solution

Java Code for the following Scenario.

import java.util.*;

class Main

{

public static void main(String args[])

{

Scanner in=new Scanner(System.in);  

System.out.println("Please Enter your Name:");

String name=in.next();

System.out.println("Please Enter your marital status:\n 1 - Yes\n 0 - No");

int ms=in.nextInt(); //ms for storing Martial Status.

System.out.println("Please Enter the No of Children:");

int children=in.nextInt(); //for storing no. of children.

System.out.println("Do you Smoke Tobacco:\n 1 - Yes\n 0 - No ");

int smoke=in.nextInt(); //for storing weather they smoke or not.

if( (ms==0 || ms==1) && (children>=0) && (smoke==0 || smoke==1))

{

double amount=150; //it is intialized with 150$ beacuse all employee will be charged 150$.

if(ms==1) //checking the martial status,if 1 then married otherwise not.

{

amount=amount+75; //we have to add 75$

}

int childcost=children*50; //finding the cost for children by multiplying no of children with 50$.

amount=amount+childcost; //adding childcost.

  

// checking the smoking status.

if(smoke==0)

{

int deduction=(amount*10)/100;

amount=amount-deduction;

}

System.out.println("Name :"+name);

if( ms==0)

System.out.println("Martial Status : Unmarried");

else

System.out.println("Martial Status : Married");

System.out.println("No of Children: "+children);

   if(smoke==0)

System.out.println("Smoker Designation : Non Smoker");

else

System.out.println("Smoker Designation : Smoker");

System.out.println("Your Total Deduction Amount is :"+amount);

}

else //re-run

  {

System.out.println("Please Re Run the Program because entered details are Invalid.");

}

}

FLOW


Related Solutions

The human resources department for your company needs a program that will determine how much to...
The human resources department for your company needs a program that will determine how much to deduct from an employee’s paycheck to cover healthcare costs. Health care deductions are based on several factors. All employees are charged at flat rate of $150 to be enrolled in the company healthcare system. If they are married there is an additional charge of $75 to cover their spouse/partner. If they have children, the cost is $50 per child. In addition, all employees are...
The Human Resources Department of a company conducts a survey to determine if a new medical...
The Human Resources Department of a company conducts a survey to determine if a new medical insurance plan is viewed favorably. Out of 200 employees surveyed 80 said they liked the change.    a. Calculate a 95% confidence interval for the population proportion who view the change favorably. b. What is the proper interpretation of the interval constructed in Part a? i. There is a 95% chance that the population proportion lies within the constructed interval. ii. If 20 similar...
Making Human Resource Decisions Scenario: You are the Director of Human Resources for your company. The...
Making Human Resource Decisions Scenario: You are the Director of Human Resources for your company. The CEO has just informed you that the financial state of the company is dire, and as a result, he is approaching the managers of each department and asking them to reduce personnel costs. The company makes its profits primarily on services such as business consulting, cloud-based storage for large companies, and other small miscellaneous business products. The industry has become highly competitive and sales...
The human resources department needs to forecast the number of sexual harassement investigations for the entire company.
  The human resources department needs to forecast the number of sexual harassement investigations for the entire company. The data for several months is supplied below. Be careful since the data is listed beginning with the most recent. The forecasting method to be used here is the 4 month weighted moving average adjusting for seasonality where the weights, starting with the most recent time period, are 0.4, 0.3, 0.2, 0.1. Again, you must find the seasonality factors for the data....
Why human resources planning needs for the company? What is impact of human resources planning to...
Why human resources planning needs for the company? What is impact of human resources planning to business objectives?
How the Human Resources Department rewards the employees?
How the Human Resources Department rewards the employees?
The human resources department of a very large organisation is trying to determine the proportion of...
The human resources department of a very large organisation is trying to determine the proportion of all employees that are satisfied with their current position. They randomly select 121 employees and ask them: "Are you satisfied with your current position?" 61 replied yes they were. Construct a 95% confidence interval to estimate the true proportion of all employees at this workplace who were satisfied with their position. A 95% confidence interval for the true proportion of all employees at this...
How much Human Resources cost would be allocated to Cafeteria?
Marshall Welding Company has two service departments (Cafeteria and Human Resources) and two production departments (Machining and Assembly). The number of employees in each department follows. cafeteria 20 human resources 30 machining 100 assembly 150 Marshall Welding uses the step-down method of cost allocation and allocates cost on the basis of employees. Human Resources cost amounts to $1,200,000, and the department provides more service to the firm than Cafeteria. How much Human Resources cost would be allocated to Cafeteria? a....
How would a human resources department use information in the operating budgets?
How would a human resources department use information in the operating budgets?
Scheherazade is using the needs approach to determine how much life insurance to buy. Her needs...
Scheherazade is using the needs approach to determine how much life insurance to buy. Her needs are as follows: cash needs $130,000; income needs $780,000; special needs $100,000. Scheherazade has the following assets: cash $20,000, retirement plans $175,000, securities $35,000. She owns no individual life insurance but has an $85,000 group life policy through her employer. Based on this information, how much additional life insurance should Scheherazade purchase? Be sure to show your calculations.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT