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;
             }

   }

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 .

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

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

Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.