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

So, you state, \"So testing of the loop counter is before the statements to be r

ID: 3748819 • Letter: S

Question

So, you state, "So testing of the loop counter is before the statements to be repeated in case of for loop. "

Does the addition of the following statement (all one statement), inserted prior to the statement to be repeated, shed any light on the issue?

lstOutput.Items.Add("Loop Count before repeated statements = " & CStr(count) & ". Loop Upper Limit " & CStr(n) & ". Amount " & FormatCurrency(amt, 2).ToString())

So, maybe incrementing and testing both occur after the statements to be repeated. (i.e. Execute repeat statement(s), increment count, test to see if count exceeds upper limit? On true, exit, else repeat?)

Explanation / Answer

package com.deepak.main;      import java.util.Scanner;      public class IfElseDemo   {       public static void main( String[] args )       {           int age;           Scanner inputDevice = new Scanner( System.in );           System.out.print( "Please enter Age: " );           age = inputDevice.nextInt();           if ( age >= 18 )               System.out.println( "above 18 " );           else               System.out.println( "below 18" );       }   }

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