Ask Question
6 February, 15:41

Given two variables, is Empty of type boolean, indicating whether a class roster is empty or not, and number Of Credits of type int, containing the number of credits for a class, write an expression that evaluates to true if the class roster is empty or the class is exactly three credits.

+4
Answers (1)
  1. 6 February, 16:02
    0
    if (isEmpty || numOfCredits==3) {

    }

    Explanation:

    Consider a complete java program below that prompts user for number of credits and also asks if class roster is empty or not

    import java. util. Scanner;

    public class num13 {

    public static void main (String[] args) {

    boolean isEmpty = false;

    Scanner in = new Scanner (System. in);

    System. out. println ("Is class Rooster Empty? Yes or No");

    String ans = in. next ();

    if (ans. equalsIgnoreCase ("yes")) {

    isEmpty = true;

    }

    else isEmpty = false;

    System. out. println ("Enter number of credits");

    int numOfCredits = in. nextInt ();

    if (isEmpty||numOfCredits==3) {

    System. out. println ("True");

    }

    else {

    System. out. println ("Not true");

    }

    }

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Given two variables, is Empty of type boolean, indicating whether a class roster is empty or not, and number Of Credits of type int, ...” 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