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

In this assignment, you are asked to modify the below code from using a number o

ID: 3728913 • Letter: I

Question

In this assignment, you are asked to modify the below code from using a number of nested if statements to using if/else statements with compound conditional expression. A compound condition expression can use logical operators || (or) and && (and) between condition statements to enforce multiple criteria for a condition statement to be either TRUE or FALSE.




Create a new document in your IDE.


Enter all the HTML and PHP code exactly as seen in the image below. Indent in your code as shown in the image.

Modify the PHP code in the image to make better use of the compound condition expression

Explanation / Answer

Try this compound expression as per your code.But the given logic does not work for numbers greater than 25.

Need to take care of it using if else condition if guessNum is greater than 25.

This is modified code for the given requirement using compound expression:

<?php

$guessNum=8;

if( ($guessNum>=10) && ($guessNum<=25))

{

echo "<p>Number is between 10 and 25</p>";

}else if(($guessNum>=5) || ($guessNum>=1))

{

echo "<p>Number is between 1 and 10</p>";

}

?>