Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

QUESTION 4 The string variable named $department contains one of the following l

ID: 3734704 • Letter: Q

Question

QUESTION 4

The string variable named $department contains one of the following letters: ‘A’, ‘B’, ‘C’, or ‘D’. Employees in departments A and B are receiving a 2% raise. Employees in department C are receiving a 1.5% raise and employees in department D are receiving a 3% raise. Write the switch (case) statement to assign the correct raise value to the variable $raise based upon the value of the variable $department.

QUESTION 5

Write a while loop to display all the even integer numbers between 10 and 20 separated with a space (e.g. 10 12 14 16 18 20)

QUESTION 6

A company is selling widgets at $49.23 each. There is delivery charge of 10% per widget and $10.00 per entire order. There is also 6% state sales tax. The 'no_widgets' entry of the PHP superglobal array $_POST stores the number of widgets ordered. Write the PHP statements that assigns the no of widgets from the $_POST array to a PHP variable and then calculates and displays the number of widgets ordered, the cost of the purchase, the cost of the delivery charge, the cost of the state sales tax, and the total cost of the order. For example, if the number of widgets is 2, then you code should display:

cost of 2 widget(s) is $98.46
delivery charge is $19.85 and state sales tax is $5.91
total cost is $124.21

The sales tax should apply only to the widgets themselves, and not to the delivery charge. All displayed amounts should be rounded to the nearest cent.

Explanation / Answer

Q4-

switch($department){

case 'A':

case 'B':

$raise=0.02;

break;

case 'C':

case 'D':

$raise=0.15;

}

Q5-

loop to display even numbers between 10-20

for(int i=10;i<=20;i++){

if(i%2==0)

printf("%d ",i);

}

<html>

<body>

  

<?php

for( $i = 10; $i<=20; $i++ ) {

if($i%2==0)

echo ("$i " );   

}

?>

</body>

</html>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote