1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
oksano4ka [1.4K]
3 years ago
10

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.
Computers and Technology
1 answer:
Alex_Xolod [135]3 years ago
4 0

Answer:

     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

<em>import java.util.Scanner;</em>

<em>public class num13 {</em>

<em>    public static void main(String[] args) {</em>

<em>        boolean isEmpty = false;</em>

<em>        Scanner in = new Scanner(System.in);</em>

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

<em>        String ans = in.next();</em>

<em>        if(ans.equalsIgnoreCase("yes")){</em>

<em>            isEmpty = true;</em>

<em>        }</em>

<em>        else isEmpty =false;</em>

<em>        System.out.println("Enter number of credits");</em>

<em>      int numOfCredits = in.nextInt();</em>

<em>      if(isEmpty||numOfCredits==3){</em>

<em>          System.out.println("True");</em>

<em>      }</em>

<em>      else {</em>

<em>          System.out.println("Not true");</em>

<em>      }</em>

<em>    }</em>

<em>}</em>

You might be interested in
The seven basic internal components found in a computer tower
Minchanka [31]
Motherboard, CPU, RAM, PSU, HDDs, GPU, and a Sound card.
8 0
3 years ago
Write a program with 2 separate functions which compute the GCD (Greatest Common Denominator) and the LCM (Lowest Common Multipl
Maru [420]

Answer:

The program written in Python is as follows

def GCD(num1, num2):

    small = num1

    if num1 > num2:

         small = num2

    for i in range(1, small+1):

         if((num1 % i == 0) and (num2 % i == 0)):

              gcd = i

    print("The GCD is "+ str(gcd))

def LCM(num1,num2):

    big = num2  

    if num1 > num2:

         big = num1

    while(True):

         if((big % num1 == 0) and (big % num2 == 0)):

              lcm = big

              break

         big = big+1

     print("The LCM is "+ str(lcm))

 print("Enter two numbers: ")

num1 = int(input(": "))

num2 = int(input(": "))

GCD(num1, num2)

LCM(num1, num2)

Explanation:

This line defines the GCD function

def GCD(num1, num2):

This line initializes variable small to num1

    small = num1

This line checks if num2 is less than num1, if yes: num2 is assigned to variable small

<em>     if num1 > num2: </em>

<em>          small = num2 </em>

The following iteration determines the GCD of num1 and num2

<em>     for i in range(1, small+1): </em>

<em>          if((num1 % i == 0) and (num2 % i == 0)): </em>

<em>               gcd = i </em>

This line prints the GCD

    print("The GCD is "+ str(gcd))

   

This line defines the LCM function

def LCM(num1,num2):

This line initializes variable big to num2

    big = num2  

This line checks if num1 is greater than num2, if yes: num1 is assigned to variable big

<em>     if num1 > num2: </em>

<em>          big = num1 </em>

The following iteration continues while the LCM has not been gotten.

    while(True):

This if statement determines the LCM using modulo operator

<em>          if((big % num1 == 0) and (big % num2 == 0)): </em>

<em>               lcm = big </em>

<em>               break </em>

<em>          big = big+1 </em>

This line prints the LCM of the two numbers

     print("The LCM is "+ str(lcm))

The main starts here

This line prompts user for two numbers

print("Enter two numbers: ")

The next two lines get user inputs

num1 = int(input(": "))

num2 = int(input(": "))

This calls the GCD function

GCD(num1, num2)

This calls the LCM function

LCM(num1, num2)

<em></em>

<em>See attachment for more structured program</em>

Download txt
5 0
3 years ago
"The Future of Money" notes that the value of cryptocurrency "changes often and depends on demand." How could reading "The Value
maw [93]

Answer:

<em>I think it would  b </em>

Explanation:

3 0
2 years ago
Plz answer me will mark as brainliest ​
Vesnalui [34]
I’m pretty sure the answer for 1 is B.
And the answer for 2 is True.
4 0
3 years ago
2
BaLLatris [955]

Answer:

the control center

Explanation:

<h2><em>hope this helps :)</em></h2>

<em>please make me brainliest\</em>

3 0
2 years ago
Other questions:
  • Throwing an improperly drained oil filter into the trash dumpster is a violation that can carry heavy penalties. A) true b) fals
    7·1 answer
  • Which best describes the relationship between maximum cost-per-click (max. cpc) bids and ad rank?
    12·1 answer
  • Which of the following has allowed computers to have more memory capabilities without making them extremely expensive Virtual me
    9·1 answer
  • Match the terms with their definitions.
    5·2 answers
  • What would be the most popular piece of technology on Earth?
    11·2 answers
  • A user is trying to delete a file located on an ntfs volume on his windows 8 computer but is unable to do so. Why is this.
    5·1 answer
  • If you use the assign software to a user option, how does the new software install to the user's computer? 70-411
    10·1 answer
  • TWO MINUTES LEFT<br> ________ __________ is the physical arrangement of devices on a network.
    9·1 answer
  • Does anyone know a working free spotify premium on ios 2021 plz i have had any luck finding anything:(​
    15·2 answers
  • Can someone pls do a toradora,Mha or princess jellyfish rp I'm open for anyother rp's
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!