Computer and Information Science 201 Java

Homework in general –
Each homework assignment is to be turned in complete. ie: turn in all of lab 1 together. On the first page put your name, lab #, course #, campus. ie:

Your Name
Lab 1
CIS 201
Marion or Mansfield Campus

Staple or paper clip all the pages. You can do this in the library. Do not staple or paper clip more than one lab together.

Lab 1 (see payroll1.htm)

Concepts - arithmetic, if statement, JavaScript, opening a browser window

You are to start writing code which will become an online payroll system.

Inputs - employee name, hours worked, payrate.

Assume the pay is weekly.

Calculations- total pay and overtime if necessary.

Display calculations in a new window.

Print out the 2 browser windows and the source code.

 

Lab 2 (see payroll2.htm)

Concepts - IF - ELSE, WHILE, CLOSE, stepwise refinement

Take the code from lab 1 (which is working correctly) and ...

1) Combine the two IF statement to form one IF - ELSE

2) Use a WHILE loop so the program will keep asking for an employee name. If the user clicks OK without entering a name, the program should exit.

3) When the new window opens to display the results, a new question will prompt the user if there are more employees (Y or N)

Note: You may eliminate the 2nd window if it is not working correctly and have the program only use one window. 

 

Lab 3 (see payroll3.htm)

Concepts - functions, methods

Modify lab2 and include two methods(Java) - functions(JavaScript)

1) use a function for the calculations.

2) use a function for the display (hint: include the code that opens the window up to the code that closes the window in the function.

 

Lab 4 (see Java6.htm)

Concepts - FOR statement, Arrays

Modify lab 3 to include a calculation for city tax withholding and federal tax withholding.

1) City tax flat rate 1.75%

2) Federal tax rate - use an array to store the federal tax table. Use a FOR loop to calculate the tax. See accompanying tables.

 

Lab 5 (see Java11.htm)

Concepts - HTML forms, buttons

Modify lab4 so all user input is through a form. This program must retain all functionally of lab 4 except you may eliminate the while & open statement. See java11.html

 

Lab 6 (see Java12.htm)

Concepts - Radio button (forms)

Modify lab5 so the user selects Single or Married and the program will use the correct tables. Output must display the word Single or Married.

 

Lab 7 (see Java71.htm)

Modify lab6. Sort all the Arrays used as tax tables. Use a function that will sort the Arrays. Pass array names to the function (see Java71.htm, Java15.htm)

Prefill entry for Payrate (ie: 8.00)

Prefill, check the Radio button for Single (see Java13.htm)

Add a box for Salary. Use an if statement to calculate a total pay if the salary is 0. Use salary for total_pay if the salary is not 0.  

 

Lab 8

Concepts - Radio button (forms)

Modify lab7

All output must rounded to 2 decimal places.

Provide an Alert box if the hours are greater than 40

Document the program with comment lines. Provide adequate spaces for readability.