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
LenaWriter [7]
3 years ago
5

Write an if-else statement with multiple branches. If givenYear is 2100 or greater, print "Distant future" (without quotes). Els

e, if givenYear is 2000 or greater (2000-2099), print "21st century". Else, if givenYear is 1900 or greater (1900-1999), print "20th century". Else (1899 or earlier), print "Long ago". Do NOT end with newline. For Java
Computers and Technology
1 answer:
Elanso [62]3 years ago
5 0

Answer:

The program to this question in java can be given as

import java.util.Scanner;

//import package for take input from user.

public class Main //define class

{

public static void main(String[] args) // main function

{

Scanner input = new Scanner(System.in);

System.out.println("Enter a number:");

int givenYear=input.nextInt();

//if condition true output is "Distant future" (without quotes).

if (givenYear >= 2100)

{

System.out.print("Distant future");

}

// else if condition(2000-2099) true output is "21st century".

else if((givenYear >= 2000) && (givenYear <= 2099))

{

System.out.print( "21st century");

}

//else if condition (1900-1999) true output is "20th century".

else if((givenYear >= 1900) && (givenYear <= 1999)){

System.out.print( "20st century");

}

//else condition false output is "Long ago".

else{

System.out.print( "Long ago");

}

}

}

Explanation:

In this program we use the scanner class. Scanner class is used to take input from the user.When the user input the input the year. It hold on a variable(givenYear) that is integer type.Then we check the value between the ranges that is given in question.To check all the condition we use the if-elseif-else statement, and AND(&&) operator.AND operator is a logical operator that is used for compare two values together. The output of the program can be given as:

Output:

Enter a number: 2016

21st century

You might be interested in
Using C++, Write a full class definition for a class named Acc1, containing no constructors, functions, or data members (i.e., a
alexgriva [62]
Hi!

Okay, so - 

To make a C++ class, we have to use the keyword <em>class </em>followed by the class name, and a pair of curly braces which will be our <em>class body</em><em>. </em>

Our class body is what holds all of our constructors, functions, and data members. 

So, to write a completely empty class - we would just have to simply write:

<em>class Acc1 
</em>{

};

<em />Note -

All classes must end with a semi colon! This is just a standard rule we follow since it was how C++ has been defined. If you were to leave the semi colon out, you would get a compiler error! =)
4 0
3 years ago
Read 2 more answers
Eu fui pegar meu ChormeBook(é tipo uma versão de notebook) e aí eu acenei forçando um pouco a tela com o polegar e deu nisso, eu
Aliun [14]

Answer:

It's not good in reality to touch the Chromebook's screen with your finger, a pencil, a pen or anything like your thumb. They might start looking blurred or if you touch them very hard then they might crack as well. If this happens, report to the authorized store immediately, and if warranty prevails you will get it repaired at no extra cost. However, take this as a warning, and keep in mind the precautions mentioned in the explanation.

Explanation:

Never put extra pressure on the Chromebook screen, and even when it is not open.

Always store it in a closed position.

Always keep the things that can put pressure away from your Chromebook.

Never poke your screen with something that put a mark or a kind of scratch on the surface of the screen.

Never ever, place something on the keyboard like pens, disks or pencils prior to shutting the lid.

5 0
4 years ago
The section of the Telecommunications Act that attracted the most attention was the one calling for the creation of ______, whic
jekas [21]

Answer:

the V-chip

Explanation:

8 0
3 years ago
If an occupation is projected to decline by 7% over the next 10 years, how would you rate the job outlook?
Helen [10]
Steady sounds like the best answer but that’s tough
5 0
3 years ago
Which arrangement shows the strongest gravitational effects of the sun and moon on the earth's tides?
julia-pushkina [17]
C rain tides is right
3 0
3 years ago
Other questions:
  • Will upvote!
    12·1 answer
  • Document creation is a key business function because:
    6·2 answers
  • 1. An auto repair shop charges as follows. Inspecting the vehicle costs $75. If no work needs to be done,
    9·1 answer
  • The domain name service (dns is a distributed database that allows users to communicate with each other computers by:
    7·1 answer
  • Grooves and polished surfaces on desert pebbles are most likely caused by
    10·1 answer
  • Which of the following are common data types? Check all that apply.
    6·1 answer
  • 1)What is Big Data?
    14·1 answer
  • suppose a network could gaurantee that all delivered packets were delivered in order. if a reliable transport protocol designer
    10·1 answer
  • What will happend when I got a BSOD in Windows?
    14·1 answer
  • A _____ model is one that is automatically adjusted based on changing relationships among variables.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!