Ask Question
12 September, 03:15

Assume that a variable variable, number Of Sides has been initialized. Write a statement that assigns the value True to the variable is Quadrilateral if number Of Sides is exactly 4 and False otherwise.

+3
Answers (1)
  1. 12 September, 05:01
    0
    public class ANot {

    public static void main (String[] args) {

    int numberOfSides = 20;

    boolean isQuadrilateral;

    if (numberOfSides==4) {

    isQuadrilateral = true;

    System. out. println ("The triangle is quadrilateral");

    }

    else{

    isQuadrilateral=false;

    System. out. println ("The triangle is not quadrilateral");

    }

    }

    }

    Explanation:

    Create and Initilize the int variable numberOfSides (You can also receive this from a user using the scanner class for example). create a boolean variable isQuadrilateral Use if and else statement to check if numberOfSides = =4 and assign true to isQuadrilateral else assign false
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Assume that a variable variable, number Of Sides has been initialized. Write a statement that assigns the value True to the variable is ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers