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
What the heck is a motherboard and why is my computer not working when i take it out
Monica [59]
Ok 1. ur not supposed to take a motherboard out of a computer and 2. a mother board technically controls everything or what u do in ur computer
7 0
3 years ago
Write a program that prompts the user to enter the minutes (e.g., 1 billion), and displays the number of years and days for the
konstantin123 [22]

Answer:

// here is code in c++.

// include headers

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

// variables

long long int minutes,years,days;

long long int s;

cout<<"please enter the minutes:";

 // read the minutes

cin>>minutes;

 // make a copy

s=minutes;

 // calculate days

days=minutes/1440;

 // calculate years

years=days/365;

 // calculate remaining days after years

days=days%365;

// print the result

cout<<s<<" minutes is equal to "<<years<<" years "<<days<<" days."<<endl;

return 0;

}

Explanation:

Read the number of minutes from user and assign it to variable "minutes" of long long int type.Make a copy of input minutes.Then calculate total days by dividing the input minutes with 1440, because there is 1440 minutes in a day.Then find the year by dividing days with 365.Then find the remaining days and print the output.

Output:

please enter the minutes:1000000000                                                                                                                          

1000000000 minutes is equal to 1902 years 214 days.

4 0
3 years ago
Write a program that inputs the following information from the user, using the Win32 Read-Console function: first name, last nam
Jobisdone [24]

Answer:

Following are program using c#

using System;

class detail

{

 static void Main() // main function

 {

     string first_name,last_name, number1; // variable declaration

     int age1;                             //variable declaration

Console.WriteLine("Enter the First Name  ");

first_name = Console.ReadLine(); // read input by win32

Console.WriteLine("Enter the Last Name  ");

last_name = Console.ReadLine(); // read input by win32

Console.WriteLine("Enter the Age  ");

age1 = Int32.Parse(Console.ReadLine()); // read input by win32

Console.WriteLine("Enter the Phone Number  ");

number1 = Console.ReadLine(); // read input by win32

Console.WriteLine("Following are the data which are  entered  ");

Console.WriteLine("First Name  :"+first_name); // display data

Console.WriteLine("Last Name   :"+last_name); // display data

Console.WriteLine("Age         :"+age1);//display data

Console.WriteLine("Phone Number:"+number1); // display data

 }

}

Explanation:

In this program we have declared  first_name,last_name, number1 variable as the string type and age1 as integer type after that we are taking input from user by win32 Read console i.e Console.ReadLine()  function and finally printed the same  information.

Output:

Enter the First Name

san

Enter the Last Name

lan

Enter the Age

45

Enter the Phone Number

9045454545

Following are the data which are  entered

First Name       :san

Last Name        :lan

Age                   :45

Phone Number :9045454545

4 0
4 years ago
Which requires large computer memory?
Sav [38]

Answer:

Imaging , Graphics and voice..... requires large computer memory.

Explanation:

5 0
3 years ago
Should Manufacturers Include Extra Programs in Operating Systems for Computers and Mobile Devices?
Gennadij [26K]

Answer:

Well, it depends. Sometimes the extra programs can be useful or just plain fun, in which case the answer is yes. But extra programs can also sometimes be utterly useless and get in the way, in which case the answer is no.\

4 0
3 years ago
Other questions:
  • Boosting morale in a workplace through reorientation is accomplished by giving employees _____. a. snacks and drinks b. the same
    15·2 answers
  • The buses that connect peripheral (typically input and output) devices to the motherboard are often called expansion buses. ____
    5·1 answer
  • What effect does the comma style format have on the selected cells?
    13·1 answer
  • Data means a group of numbers. <br> a. True<br> b. False
    7·1 answer
  • You want to figure out how much your next paycheck will be. You worked 80 hours and you make $12.50 per hour. You enter the numb
    15·1 answer
  • Given an int variable n that has already been declared and initialized to a positive value, and another int variable j that has
    9·1 answer
  • Javier is asked to explain to IT management as to why he is suggesting replacing the existing company firewall. Javier states th
    11·1 answer
  • List safety conditions when downloading shareware, free free where, or public domain software
    14·1 answer
  • I have no idea what I’m doing and this is due in 45 minutes
    7·1 answer
  • The development methodology where each part of a project is done in order after each other is called:
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!