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
Ainat [17]
4 years ago
11

Write an if-else statement that prints "Goodbye" if userString is "Quit", else prints "Hello". End with newline.

Computers and Technology
2 answers:
vazorg [7]4 years ago
5 0

If you are using Java then the IF statement would be:

If(userSting == "Quit"){

    System.out.println("Goodbye");

}

else

    System.out.println("Hello");

The IF statement will check whether the users input is the word "Quit". If the word is indeed "Quit" then the program will output the word "Goodbye". The ELSE statement on the other hand will only be displayed if the user inputs any other string than "Quit". The program will then output the word "Hello" any other string or number is inputted by the user.

zhannawk [14.2K]4 years ago
4 0

import java.util.Scanner;

public class DetectWord {

  public static void main (String [] args) {

     Scanner scnr = new Scanner(System.in);

     String userString;

     userString = scnr.next();

if(userString.equals("Quit")){

System.out.println("Goodbye");

}

else{

System.out.println("Hello");

}

  }

}

This actually works for anything written and will provide the proper outcome for zybooks

You might be interested in
I have a class named Counter. In this class I have a synchronized method called countRange(). This method prints out a count in
lesya [120]

Answer:

Following are the code to this question:

Counter T = new Counter(1, 100); //creating Counter class object and call its parameterized constructor        

Thread T1 = new Thread(new Runnable()  //creating Thread object T1.

{            

   public void run() //define run method

   {                

       T.countRange(); //call countRange method    

   }          

});    

Thread T2 = new Thread(new Runnable()  //creating another object "T2" of Thread.

{            

   public void run() //define run method

   {                

       T.countRange();           //call countRange method

   }      

});    

T1.start(); //start Thread T1    

T2.start(); //start Thread T2    

Explanation:

Description of the above code as follows:

  • In the given code, inside the main method the Counter class object "T" is created, that calls its parameterized constructor, which accepts two integer value that is "1 and 100".  
  • In the next step, thread class object T1 and T2, is created, which uses run method, in which it called the countRange method inside the method a for loop is declared that prints value between parameter value.  
  • In the last step, the start method is called, which uses the run method to call countRange method.  
  • For full program code please find the attachment.

6 0
3 years ago
Each array in Java has a public field named ________ that contains the number of elements in the array.
Helen [10]

Answer:

length.

Explanation:

length variable determines the size of the array or the number of elements in the array.length variable is a final variable.It is a public field.It is only applicable for array it is not applicable for strings.It is also used to directly access the field member of the array.So we conclude that the answer is length.

7 0
4 years ago
Which is the correct formula to add the values in cells A1 and B1?
arlik [135]
I'm assuming you are referring to Excel. There are a few ways to add A1 and B1.

First you could use '=SUM(A1+B1)'

You could also use '=SUM(A1:B1)' which adds the values of all the cells between A1 and B1, but since they are next to each other, this would work.

You could also use '=SUM(A1,B1)' where you list all the cells you want to add with commas in between.
7 0
4 years ago
Read 2 more answers
WILL GIVE BRAINLIEST AND 30 POINTS!! NEED ASAP!!!!
kotykmax [81]

Answer:

Explanation:

1. In tabletop games and video games, game mechanics are the rules that guide the player's moves or actions, as well as the game's response to them.

5.User interface is about the visual design and the information designs around the screens while the User Experience is about the whole experience and not only about the screen. User interface is mainly focused on the product while User experience on the other hand mostly focuses on the user and their journey through the product.

5 0
3 years ago
Software (often on firmware) designed to make physical products and devices smarter by doing things like sharing usage informati
saveliy_v [14]

Answer:

Embedded Systems.

Explanation:

Software (often on firmware) designed to make physical products and devices smarter by doing things like sharing usage information, helping diagnose problems, indicating maintenance schedules, providing alerts, or enabling devices to take orders from other systems is referred to as Embedded Systems.

6 0
3 years ago
Other questions:
  • Radio waves pros and cons
    10·2 answers
  • Computer science
    6·1 answer
  • Unlike the String class where you must pass a message to an object (instance) of the class, as in x.length( ), in order to use t
    5·1 answer
  • A chef writing up her famed recipe for beef stew realizes she has switched parsley and oregano everywhere in the recipe. The che
    13·1 answer
  • Assume the following variable definition appears in a program:
    8·1 answer
  • Ophelia is entering a Get Fit! sporting goods store in a shopping mall when her heel gets caught in a heating grate at the thres
    9·1 answer
  • after installing a secondary hard drive what needs to be done to the hard drive and what do these two task do?
    12·1 answer
  • The problem analysis phase typically includes which of the following tasks? (Points : 2) Negotiate baseline scope.
    10·1 answer
  • Which of these statements about the truck driving occupation in the U.S. are accurate?
    12·2 answers
  • Does survey monkey remembers you already took survey?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!