Ask Question
16 April, 01:57

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.

+5
Answers (1)
  1. 16 April, 03:19
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers