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
RSB [31]
2 years ago
11

How could the following line of code be shortened?

Computers and Technology
1 answer:
Alinara [238K]2 years ago
8 0

Answer:

2

Explanation:

The second option is the only one that will work. The last would work but doesn't make the code any shorter.

You might be interested in
Write a program that simulates rolling one die using the following steps: 1. Prompt the user for the number of sides on the die.
Mashcka [7]

Answer:

The program to the given question can be given as:

Program:

//import package.

import java.util.*;                    

//define class.

public class Main                    

{

 public static void main(String ar[])  //define main method.  

 {

Scanner  ob = new Scanner(System.in);     //creating scanner class object.

   Random ran = new Random();                 //creating random class object.

   int roll1,roll2,roll3,number,total=0;          //define variable.

   float avg=0;

   System.out.print("Enter the sides= ");           //print message.

   number = scanner.nextInt();                 //input number by user.

   roll1 = ran.nextInt(number++);         //using random function.

   roll2 = ran.nextInt(number++);

   roll3 = ran.nextInt(number++);

   System.out.print("First roll= ");           //print message

   System.out.println(roll1);               //print value.

   System.out.print("Second roll= ");

   System.out.println(roll2);

   System.out.print("Third roll= ");

   System.out.println(roll3);

   System.out.print("total roll= ");

   total=roll1+roll2+roll3;                            //add all number.

   System.out.println(total);

   System.out.print("Average roll= ");                      

   avg=total/3;                                 //Average of the number.

   System.out.println(avg);

 }

}

Output:

Enter the sides= 4

First roll= 2

Second roll= 3

Third roll= 5

total roll= 10

Average roll= 3.0

Explanation:

In the above program first, we import the package form the user input and random number. In java, there are many packages but we use only the util package because in that package both the class like scanner class and random class are inbuilt. Then we declare the class that name is Main in that class we define the main function. In the main function, we create both class object (scanner class and random class). Then we take input a number from the user and pass into the random function. The random function is used to give a unique number and we pass the number into the random function that is increasing by post-increment operator i.e (X++). Then we print all the rolls and total by add all the roll and at the last, we print an average of it.

7 0
3 years ago
After Brooke has helped Simon to resolve his original problem, Simon asks her about another linked workbook he has received. The
amm1812

Answer:

The answer is "The working book can be opened and the version Links dialogue box will press Continue button".

Explanation:

As we knew, the workbook is a set of files, in which one or more worksheets are uses. All the file of the workbook is defined in the form of the sheets, like Sheet1, Sheet2, and so on, in which we can also change the name of the sheet.

  • To solve another workbook problem the firstly the Simon open the workbook by providing the appropriate link.
  • This file Includes the source file, that doesn't have published, and  he also wants to use the workbook with the new source file values.
7 0
3 years ago
A tracking signal A. is a measurement of how well a forecast is predicting actual values. B. is computed as the mean absolute de
Andrej [43]

The answer to this is:

A. is a measurement of how well a forecast is predicting actual values.

I have seen this type of tracking signal before, they use this for news forecast to track severe weather such as tornadoes, severe weather, hot weather, winter storms and even hurricanes. This helps the people know what the weather will be like in the next few days or so, so they can get prepared for any storms or hot weather.

it's a interesting technology they have.

Hope this helped :)

Have a great day

4 0
4 years ago
again assume that each of the resistors in the circuit shown above has a resistance value of 100k(question in the picture above)
Svetllana [295]
Statement A is true. R4 is not part of the circuit since it has one terminal not connected. The other resistors are in series, so the same current flows through them. Hence they will dissipate equal power.
4 0
3 years ago
WILL GIVE BRAINLIEST
Fiesta28 [93]

Answer:

c

Explanation:

c

6 0
3 years ago
Read 2 more answers
Other questions:
  • What is basic function of an operating system?
    10·2 answers
  • James wishes to access a certain software service via different computing systems over the Internet. What technology provides so
    13·2 answers
  • The first step in database design is defining a _____, which defines how data is created, represented, organized, and maintained
    13·1 answer
  • Consolidating a system's physical and time resources is known as ________________.
    13·1 answer
  • Alisa Miller claims that today's college graduates:
    7·1 answer
  • Which tool is used to plan a web site?<br> HTML<br> Storyboard<br> Text editor<br> WYSIWYG
    5·2 answers
  • Alexandria works for a non-profit company that asks for donations to help the homeless people in her community. Recently the dat
    12·1 answer
  • a deque is a type of collection,but it is not automatically available when you open IDLE. What is missing that allows you to use
    14·2 answers
  • Commercial technical data and commercial software:_________.
    11·1 answer
  • The result of processing data ​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!