Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 1l: Running calculations on the retrieved data Code Step 4: Write php code in display results.php that will calculate the following yalues: Unadjusted (or

image text in transcribed
image text in transcribed
Part 1l: Running calculations on the retrieved data Code Step 4: Write php code in display results.php that will calculate the following yalues: Unadjusted (or plain): Annual Salary, Daily Salary, Hourly Salary. Adjusted: Annual Salary, Daily Salary Hourly Salary You may need additional variables to store days worked per year and hours worked per day. Healculations are as follows: Values of annual salary, daily salary, days worked per year and hours worked per day are. derived from the user inputs as follow. Assume total number of weeks per year is 52 and days per year is 260 . The value of annualSalary, dailySalary, daysWorkedPerYear and hoursWorkedPerYear are stored in php variables. annualSalary = hourtySalary*hrsPerWeek 52.0; dailySalary = annualSalary/260; daysWorkedPerYear =260 - (vacPerYear + holsPerYear); hours WorkedPerDay = hrsPerWeekldaysPerWeek; Adjusted salaries are calculated by considering the actual days worked per year. By considering the vacations and holidays the employee works fewer days than 260 days. Fewer workdays are reflected in the values of adjustedAnnualSalary, adjustedDailySalary and adjustedHourly Salary that is calculated as shown below. adjAnnualSalary = dallySalary"days WorkedPerYear; adjDailySalary = adj AnnualSalary/260; adjHourly Salary = adjDailySalary/\$hoursWorkedPerDay; Code Step 5: To test the calculated values before they are displayed using html, use var dump method. Write var dump statements for all the 7 variables that you created in Code_ Step 4 (as listed above). Calculate by hand to make sure the values and the data types of these variables that are displayed by the var_dump statements are what you would expect. Checking the data types of variables using var dump is particularly useful when we work with databases later in the course. Databases are picky on the data types that we supply through the web applications. So, make it a habit to var_dump the values and check them as you go along. Code step 6: Display the results of the calculation in display-results using html and embedded php scripts. You may choose to display these values as a table, or as a neatly displayed list. The screenshot below shows the display as an html table. Reflect and make notes. Notes.txt Make note of the following and append to the notes.txt page. I) How is var_dump helpful in testing your code? Why do we care about data types of values? m) What is role of FILTER VALIDATE FLOAT in a fiter input method? What will happen to the data type of a numeric value if it is not validated at all using either FILTER_VALIDATE_FLOAT, or FILTER_VALIDATE INT? n) Find out what are other possible validations you could do with filter input method? o) What is a divide by zero error and why is it important to watch out for in your code

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions