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
jenyasd209
16 days ago
15

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

e, if givenYear is 2001 or greater (2001-2100), print "21st century". Else, if givenYear is 1901 or greater (1901-2000), print "20th century". Else (1900 or earlier), print "Long ago". Do NOT end with newline.

Computers and Technology
2 answers:
Natasha_Volkova [1K]16 days ago
7 0
Here's a C code snippet: #include <stdio.h> int main() { int year; printf("enter year:"); scanf("%d",&year); if(year>=2101) { printf("Distant future"); } else if(year>=2001&&year<=2100) { printf("21st century"); } else if(year>=1901&&year<=2000) { printf("20th century"); } else if(year<=1900) { printf("Long ago"); } return 0;} Output: enter year:2018 21st century. </stdio.h>
Amiraneli [1K]16 days ago
6 0
if ( givenYear >= 2101 ) { System.out.print("Distant future"); } else if (givenYear >= 2001) { System.out.print("21st century"); } else if ( givenYear >= 1901 ) { System.out.print("20th century"); } else { System.out.print("Long ago"); }
You might be interested in
Your employer, yPlum Corporation is manufacturing two types of products: Mirabelle smartphone, and Blackamber laptop. The compan
Natasha_Volkova [1026]

Answer:

Refer to the explanation

Explanation:

Number of Mobiles=x1

Number of Workstations=x2

Constraints:

50x1 + 70x2 <= 1,60,000

250x1 + 700x2 <= 12,000,000

x1 >= 0 x2 >= 0

Objective function N(x1, x2) = 7800000000 x1 + 7200000000 x2

Excel formulae:

G17 = D9 * E7 + F9 * G7

G18= D10 * E7 * F10 * G7

G19= E7

G20= G7

G21= I17 * E7 + I18 * G7 (This will yield the Maximum)

And E7 and G7 will be the solution.

Set up your sheet as shown in the diagram and apply the formulas.

Access the tool and select solver. Upon opening the Solver dialog, confirm ‘Assume Linear model’ and ‘assume non-negative’. Click to solve the model and keep the solution.

7 0
20 days ago
To encourage good grades, Hermosa High School has decided to award each student a bookstore credit that is 10 times the student’
amid [951]

Answer:

// here's the Java code.

import java.util.*;

// definition of the class

class BookstoreCredit

{

/* method that prints a message including the name and grade point */

   public static void fun(String name,double grade)

   {

// multiplying grade by 10

       grade=grade*10;

// display the message

       System.out.println(name+"\'s average grade is $"+grade);

   }

// main method for the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // scanner instance to read input

       Scanner s=new Scanner(System.in);

        // declaring variables

      String s_name;

      double grade;

      System.out.print("Please enter the name:");

      s_name=s.nextLine();

      System.out.print("Please enter the grade point:");

      grade=s.nextDouble();

   }catch(Exception ex){

       return;}

}

}

Explanation:

Define a string variable named s_name and a double variable named grade. Obtain the name and grade from the user, then invoke the fun() method with these parameters, which will multiply the grade by 10 and output a message that includes the student's name along with their average grade.

Output:

Please enter the name:john

Please enter the grade point:3.2

john's average grade is $32.0

7 0
1 month ago
Assume that the reference variable r refers to a serializable object. Write code that serializes the object to the file ObjectDa
oksian1 [950]
To serialize an object, the following code can be used: FileOutputStream out = new FileOutputStream("ObjectData.dat"); ObjectOutputStream ostream = new ObjectOutputStream(out); ostream.writeObject(r); Explanation: For serializing an object, the writeObject method from the java.io.ObjectOutputStream class is utilized. The complete code snippet is as follows: import java.io.*; class Demo{ public static void main(String args[]){ try{ r = <reference to="" object="" be="" serialized="">; FileOutputStream out = new FileOutputStream("ObjectData.dat"); ObjectOutputStream ostream = new ObjectOutputStream(out); ostream.writeObject(r); ostream.close(); } catch(Exception e){ e.printStackTrace(); }} }. </reference>
5 0
1 month ago
Ishaan is confused between the terms webpage and website help him in understanding the difference between both​
maria [1035]

Answer:

A webpage serves as a single page within a website, while a website encompasses a collection of such pages offering valuable information.

Explanation:

Please follow

7 0
1 month ago
Suppose Host A sends two TCP segments back to back to Host B over a TCP connection. The first segment has sequence number 90; th
Amiraneli [1052]

Answer:

a) Consider the sequence numbers, where the first segment is 90

The second segment equals 110

Data contained in the first segment = 110-90 = 20

b) Assume the first segment is lost while the second one reaches Host B. In the acknowledgment sent from Host B to Host A, the acknowledgment number will correspond to the first segment sequence number, which is 90.

Explanation:

8 0
1 month ago
Read 2 more answers
Other questions:
  • . Electricians will sometimes call ______ "disconnects" or a "disconnecting means."
    12·1 answer
  • To reduce costs and the environmental impact of commuting, your company decides to close a number of offices and to provide supp
    14·1 answer
  • Explain working principle of computer?​
    13·1 answer
  • Susan is assisting a web designer to create a promotional web page on eco-friendly classroom designs. She uses color combination
    5·1 answer
  • In this code, identify the repeated pattern and replace it with a function called month_days, that receives the name of the mont
    14·1 answer
  • Imagine you were using some of our pixelation tools to create an image and you posted it online for your friends to see - but, a
    11·1 answer
  • 3. Megan and her brother Marco have a side business where they shop at flea markets, garage sales, and estate
    9·1 answer
  • The principal that users have access to only network resources when an administrator explicitly grants them is called __________
    6·1 answer
  • Write a generator function named count_seq that doesn't take any parameters and generates a sequence that starts like this: 2, 1
    5·1 answer
  • a.Write a Python function sum_1k(M) that returns the sumí‘ í‘ = ∑1푘푘푀푀푘푘=1b.Compute s for M = 3 by hand and write
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!