Assume that isIsosceles is a boolean variable, and that the variables isoCount, triangleCount, and polygonCount have all been declared and initialized. Write a statement that adds 1 to each of these count variables (isoCount, triangleCount, and polygonCount) if isIsosceles is true.

Respuesta :

ijeggs

Answer:

if (isIsosceles){

           isoCount +=1;

           triangleCount +=1;

           polygonCount+=1;

       }

Explanation:

Using Java programming language, we have shown the full implementation.

The three variables  (isoCount, triangleCount, and polygonCount) were declared and initialized to 1,2,3 respectively

After the if condition, the new values for these variables are printed to the screen and they become 2,3,4 respectively. complete code is given below

public class num3 {

   public static void main(String[] args) {

       boolean isIsosceles = true;

       int isoCount = 1;

       int triangleCount=2;

       int polygonCount=3;

       if (isIsosceles){

           isoCount +=1;

           triangleCount +=1;

           polygonCount+=1;

       }

       System.out.println(isoCount);

       System.out.println(triangleCount);

       System.out.println(polygonCount);

           }

}