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

A particular if-else statement has the form: What code should replace CONDITION

ID: 3574146 • Letter: A

Question

A particular if-else statement has the form: What code should replace CONDITION for the following situations? You may need to define a few variables. The first one is done for you. a. The variable i is larger than 10. Answer: Assume we have a variable i that contains some number. Then replace CONDITION with i > 10 b. The variable y is larger than 50 and smaller than 100. c. either variable index is zero or variable y is less than 25. d. It is not true that: either variable index is zero or variable y is greater than 50.

Explanation / Answer

Answers:

a.Answer:condition is i>10

<script langauage=javascript type="text/javascript">
   if(i>10)   {
       document.write("The result is true");
   }
   else{
       document.write("The result is false");
   }

</script>

b.Answer: Assume that we variable y that have some number, then replace conditon with

y>50 && y<100

<script langauage=javascript type="text/javascript">
   if(y>50 && y<100)   {
       document.write("The result is true");
   }
   else{
       document.write("The result is false");
   }

</script>

c.Answer: Assume that we variables y and index that have some numbers, then replace conditon with

index==0 || y<25

<script langauage=javascript type="text/javascript">
   if(index==0 || y<25)   {
       document.write("The result is true");
   }
   else{
       document.write("The result is false");
   }

</script>

d.Answer: Assume that we variables y and index that have some numbers, then replace conditon with

!( index==0 || y>50)

<script langauage=javascript type="text/javascript">
   if(!( index==0 || y>50))   {
       document.write("The result is true");
   }
   else{
       document.write("The result is false");
   }

</script>

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