1. Create an HTML file that has input variables for the First Name, Last Name, Hours Worked, and Hourly Rate. Save the file as phpPaycheck2.html and store it in your ch02 directory on your personal...

1 answer below »



1. Create an HTML file that has input variables for the First Name, Last Name, Hours Worked, and Hourly Rate. Save the file as phpPaycheck2.html and store it in your ch02 directory on your personal web server. Within the HTML file, do not state that any of the input values are required and do not state the minimum and maximum values for Hours Worked or Hourly Rate. The phpPaycheck2.html file must use the POST method to send data to the phpPaycheck2.php file for processing. (2 Points)


2. Create a PHP file that displays the results shown in the screenshot above. The PHP file processes First Name, Last Name, Hours Worked, and Hourly Rate using the POST method from the phpPaycheck2.html file. The application calculates and displays the Regular Pay, Overtime Pay, Gross Pay, FICA Tax Withheld, State Tax Withheld, Federal Tax Withheld, Total Taxes, and Net Pay. The FICA Tax Rate, State Tax Rate, Federal Tax Rate, and Employee Name are also displayed. Save the file as phpPaycheck2.php and store it in your ch02 directory on your personal web server. (1 Point)


3. Style the phpPaycheck2.php file using CSS. For my solution, I modified the CSS code used in the CSS fancy table example at the W3Schools website: http://www.w3schools.com/css/tryit.asp?filename=trycss_table_fancy. Style the phpPaycheck.html file using CSS. For my solution, I modified the styles.css file used in the Ch05 JavaScript assignment. (1 Point)


4. The phpPaycheck2.php file must be free of errors that are throwing error messages with line numbers when viewed in the web server. If you submit a php file that has errors within it causing error messages and line numbers to appear and no output to be displayed, you will lose 20 points off of this assignment. I will debug and correct the first 5 errors for you when giving feedback, but I will not debug beyond your first 5 errors. In summary, you will lose 20 points off of the final grade for not debugging the PHP file. (20 Points)


5. Once you have output, the resulting HTML code from the phpPaycheck2.php file must be validated. Please see the additional document entitled FirefoxTidyHTMLValidator on how to use a validator that works as an add-on within a browser. Search in google for an HTML Validator that works with the browser of your choice. I will validate it with Firefox’s Tidy HTML Validator when grading. (1 Point)


6. The phpPaycheck2.php file must meet the following specifications (24 Points Total as broken down below):


a. Via the PHP comment tag, comments are used correctly and appropriately throughout the document. (1 Point)


b. Input variables for the First Name, Last Name, Hours Worked, and Hourly Rate are submitted from the phpPaycheck2.html file and processed by the phpPaycheck2.php file using the POST method. (1 Point)


c. Validate that First Name is entered. If not, display a message that says “You forgot to enter your First Name. Please go back and fill out the form again.” (1 Point) See screenshot 3 above.


d. Validate that Last Name is entered. If not, display a message that says “You forgot to enter your Last Name. Please go back and fill out the form again.” (1 Point) See screenshot 4 above.


e. Validate that Hours Worked is entered and is between 0 and 80. If not, display a message that says “You must enter Hours Worked that is between 0 and 80.” (1 Point) See screenshot 5 above.


f. Validate that Hourly Rate is entered and is between 0 and 100.00. If not, display a message that says “You must enter an Hourly Rate that is between 7.25 and 100.00.” (1 Point) See screenshot 6 above.


g. If one or more of the above conditions are not met, display a message that says “Please go back and fill out the form.” (2 Points) See screenshot 7 above.


h. FICA Tax Rate of 5.65% is defined as a constant. (1 Point)


i. State Tax Rate of 5.75% is defined as a constant. (1 Point)


j. Federal Tax Rate of 28.00% is defined as a constant. Remember that percentages are actually decimals. (1 Point)


k. Regular Pay will be correctly calculated as up to 40 Hours Worked * Hourly Rate and formatted with the number_format() function as shown. (1 Point)










l. Overtime Pay will be correctly calculated as Hours Worked over 40 * Hourly Rate * 1.5 and formatted with the number_format() function as shown. (1 Point)


m. Gross Pay will be correctly calculated as Regular Pay + Overtime Pay and formatted with the number_format() function as shown. (1 Point)


n. FICA Tax Rate will be correctly displayed. (1 Point)


o. FICA Tax Withheld will be correctly calculated as Gross Pay * FICA Tax Rate and formatted with the number_format() function as shown. (1 Point)


p. State Tax Rate will be correctly displayed. (1 Point)


q. State Tax Withheld will be correctly calculated as Gross Pay * State Tax Rate and formatted with the number_format() function as shown. (1 Point)


r. Federal Tax Rate will be correctly displayed. (1 Point)


s. Federal Tax Withheld will be correctly calculated as Gross Pay * Federal Tax Rate and formatted with the number_format() function as shown. (1 Point)


t. Total Taxes will be correctly calculated as FICA Tax Withheld + State Tax Withheld + Federal Tax Withheld and formatted with the number_format() function as shown. (1 Point)


u. The Employee Name will be correctly displayed by concatenating the First Name and Last Name. (1 Point)


v. The Net Pay will be correctly calculated as Gross Pay – Total Taxes and formatted with the number_format() as shown. (1 Point)


7. Submit the phpPaycheck2.html and phpPaycheck2.php and any supporting .css files to Blackboard. (1 Point)


Helpful Hints:


1. The most helpful resources to review for completing this assignment (besides the paycheck.php from Week 9) are the form.html and handle_form.php files demonstrated on Pages 49-53 in your textbook.


2. On Page 57, the second to last tip on the page can save you a lot of aggravation when coding. Basically, the author is directing you to save a superglobal array value posted from the form into a variable as in $name=$_POST[‘name’] so that you don’t have to keep repeating $_POST[‘name’] in your code. After saving $_POST[‘name’] into $name, you can refer to $name from that point forward.


3. Remember that parse errors are usually the result of mismatched (), [], {}, “”, or ‘’. They should normally be paired up. I use the Find feature in my text editor to count all of the ( entered and then count all the ) entered. In general, the counts should be the same. I repeat for the other brackets and double and single quotation marks.


4. Don’t try to code the whole program at once. Break it into smaller programs in a logical manner. First, pass the first name over from your HTML form into the PHP form and perform the validation related to the first name. Debug until it works and save it as version 1. Then pass the second name over from your HTML form into the PHP form and perform the validation. Repeat the process. It is much easier to debug 10 lines of code at a time than it is to debug 50 lines of newly added code in one sitting.

Answered Same DayJul 11, 2022

Answer To: 1. Create an HTML file that has input variables for the First Name, Last Name, Hours Worked, and...

Anurag answered on Jul 12 2022
79 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here