Problem 1. Write a program that calculates an employee\'s weekly salary, based o
ID: 441715 • Letter: P
Question
Problem 1. Write a program that calculates an employee's weekly salary, based on the number of hours worked and the hourly rate. Hours over 40 get time and half pay. The program displays a web page with two textboxes (one for the number of hours worked, and one for the hourly rate), and one Submit button. I already did the html part, but I can't seem to get the php code right. I keep getting an error. Please tell me if the code is right. <?php $NumHrs = 45; $HrRate = 12; if ($NumHrsEmp > 40.0) echo "Employee earned: $", $NumHrs * $HrRate; else echo "Employee earned: $", (40.0 + (NumHrs - 40.0) * 1.5) * $HrRate; ?> Problem 2. Write a program that allows the user to enter an integer value n in a textbox. The program then prints a square of size n. For example, if n is equal to 6, the program prints ****** * * * * * * * * ****** I can't figure out how to put the space in the center of the four stars that are aligned on each side. This is what I have <?php $SquareSide = 12; $Count = 0; $Count1 = 0; for ($Count = 0; $Count < $SquareSide; ++$Count) echo "*"; echo ""; for ($Count = 0; $Count < ($SquareSide -2); ++$Count) { echo "*"; for ($Count1 = 0; $Count1 < ($SquareSide -2); ++$Count1) { echo " "; } echo "*"; echo "
"; } for ($Count = 0; $Count < $SquareSide; ++$Count) echo "*"; echo "
"; ?> Problem 3. Write a program that allows the user to enter the names of three students together with their grades in a test. The program then prints the average grade, and for each student it prints 'above average", "below average", or "equal to the average". For example, if the input to the program is: Peter 80 Mary 85 John 75 The program prints: Average = 80 Peter Equal to the average Mary Above average John Below average I keep getting an error for line 21, please tell if my code is correct. <?php $Student1 = $_GET["StudentName1"]; $Grade1 = $_GET["Grade1"]; $Student2 = $_GET["StudentName2"]; $Grade2 = $_GET["Grade2"]; $Student3 = $_GET["StudentName3"]; $Grade3 = $_GET["Grade3"]; $Average = 0.0; $Average = $Grade1 + $Grade2 + $Grade3; $Average = 3.0; echo "
Grades:
"; echo $Student1; echo " "; echo $Grade1; echo "
"; echo $Student2; echo " "; echo $Grade2; echo "
"; echo $Student3; echo " "; echo $Grade3; echo "
"; echo "
Grade Average:
; echo "Grade Average: "; echo $Average; echo "
"; echo ""; echo $Student1; echo ""; echo " "; showStatus($Grade1, $Average); echo "
"; echo ""; echo $Student2; echo ""; echo " "; showStatus($Grade2, $Average); echo "
"; echo ""; echo $Student3; echo ""; echo " "; showStatus($Grade3, $Average); echo "
"; function showStatus($grade, $avg) { if ($grade == $avg) echo "Equal to the average"; if ($grade == $avg) echo "Above average"; if ($grade == $avg) echo "Below to the average"; } ?> Problem 4. Write a program that allows the user to enter his/ her first name, middle name, and last name in three separate textboxes. The program then prints the three names, one per line, in a rectangular frame. For example, the name Jon Frederick Smith gets printed as; ************* * Jon * * Frederick * * Smith * ************* I can't get the stars to aligned properly on the sides. Here's my code:
<?php $n = 13; $i = 1; while ($i <= $n){ echo "*"; $i = $i + 1; } echo "
"; echo "*"; for ($i=1; $i<=$n-2; $i++){ echo " "; } echo "*"; echo "
"; print ("John
"); print ("Federick
"); print ("Smith"); ?> <?php $n=13; for ($i=1; $i<=$n; $i++){ echo "*"; } ?>
Explanation / Answer
plz summrizd ur question several questions at once are not allowed thanks
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.