answer.
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]
2 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]2 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]2 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
The term load is often used to describe opening a page in a ____. Answer
mote1985 [20]
The answer is b web page
8 0
2 years ago
Which decimal value (base 10) is equal to the binary number 1012?
GaryK [48]

Answer:

The decimal value of 101₂² base 2 = 25 base 10

Explanation:

The number 101₂² in decimal value is found as follows;

101₂ × 101₂ = 101₂ + 0₂ + 10100₂

We note that in 101 + 10100 the resultant 2 in the hundred position will have to be converted to a zero while carrying over 1 to the thousand position to give;

101₂ + 0₂ + 10100₂ = 11001₂

Therefore;

101₂² =  11001₂

We now convert the result of the square of the base 2 number, 101², which is 11001₂ to base 10 as follows;

Therefore converting 11001₂ to base 10 gives;

11001₂= 1 × 2⁴ + 1 × 2³ + 0 × 2² + 0 × 2 ¹ + 1 × 2⁰

Which gives;

16 + 8 + 0 + 0 + 1 = 25₁₀.

7 0
2 years ago
Java uses interfaces to provide the benefits of multiple inheritance. A superclass object is a subclass object. A subclass is of
WITCHER [35]

COMPLETE QUESTION

Which of the following is false?

a. A subclass is often larger than its super class.

b. A super class is object is a subclass object.

c. The class following the extends keyword in a class declaration is that direct super class of the class being declared.

d. Java uses interfaces to provide the benefits of multiple inheritance

Answer:

B) A super class is object is a subclass object.

Explanation:

In object oriented programming, the concept of inheritance is greatly utilized, this refers to deriving a class from another class. The derived class is the sub-class and it is derived from its super class, as a matter of fact in Java programming language, all classes are derived from some other class. Objects are made from classes with their state (fields) and behavior (methods) since objects are made from classes, the objects of the super class will not be the same as that of the subclass.

4 0
2 years ago
Temperature Class Write a Temperature class that will hold a temperature in Fahrenheit and provide methods to get the temperatur
posledela

Answer:

Explanation:

   public class Temperature

   {

       double ftemp;

       public int Constructor(double fahrenheit)

       {

           ftemp = fahrenheit;

          return Convert.ToInt32(ftemp);

       }

       public void setFahrenheit(double fahrenheit)

       {

           ftemp = fahrenheit;

       }

       public void getFahrenheit()

       {

           ftemp = Constructor(ftemp);

       }

       public void getCelcius()

       {

           ftemp = (ftemp - 32) * 5 / 9;

       }

       public void getKelvin()

       {

           ftemp = (ftemp - 32) * 5 / 9 + 273.15;

       }

   }

8 0
2 years ago
Can you find the reason that the following pseudocode function does not return the value indicated in the comments? // The calcD
Alexus [3.1K]

Answer:

see explaination

Explanation:

Function Real calcDiscountPrice(Real price, Real percentage) // Calculate the discount.

Declare Real discount= (price * percentage) / 100.0 // Subtract the discount from the price.

//dividing by 100.0 because of % concept

Declare Real discountPrice = price - discount // Return the discount price.

Return discount End Function

5 0
2 years ago
Other questions:
  • your monthly living expenses are $1500 on an income of $1,650 per month. your goal is to have an emergency fund of 4 times your
    5·1 answer
  • python A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun
    15·2 answers
  • Suppose that a scheduling algorithm (at the level of short-term CPU scheduling) favors those processes that have used the least
    10·1 answer
  • In mathematics, the notation n! represents the factorial of the nonnegative integer n. The factorial of n is the product of all
    7·1 answer
  • If byte stuffing is used to transmit Data, what is the byte sequence of the frame (including framing characters)? Format answer
    6·1 answer
  • For any element in keysList with a value greater than 60, print the corresponding value in itemsList, followed by a semicolon (n
    14·2 answers
  • You are using a polynomial time 2-approximation algorithm to find a tour t for the metric traveling salesman problem. Which of t
    7·1 answer
  • Which of the following should get a Page Quality (PQ) rating of Low or Lowest? Select all that apply. True False A page with a m
    8·1 answer
  • Section 6.9 of your textbook ("Debugging") lists three possibilities to consider if a function is not working. Describe each pos
    14·1 answer
  • The most likely reason a firm would decide to establish an extranet would be the desire to Multiple Choice speed the flow of inf
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!