0

Can someone tell me if this is write?


Rewrite the following if/else/if structure as nested if elses.

if (status == ‘P’ && amount >= 10000)
	due_flag = true;
else if (status == ‘P’)
	time_remaining - = 1;
else if (status == ‘O’)
{
	time_remaining = 0;
	warning_flag = true;
}

This is what I have:

if (status == 'P' && amount >= 10000)
   {
              due_flag = true;
   }
   {
             if (status == 'P')
             {
                  time_remaining - = 1;
             }
             else (status == 'O')
             {
                  time_remaining = 0;
                  warning_flag = true;
             }

   }
2
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by tallygal
0

try this code

if (status == 'P')
             {
                  time_remaining - = 1;
             
		if(amount >= 10000)
			due_flag = true;

	     }

		else if (status == 'O')
             {
                  time_remaining = 0;
                  warning_flag = true;
             }

I really cant tell wat exactly ur expecting , if u could enunciate ur problem statement , then i can help u better .

0

That is all she gave us. That is the exact question, word for word.

0

then my answer is somewat close , cuz for the last case u cannot incorporate that into a nested if , it has to be in else part .
and the 1st 2 i have nested them

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.