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
8_murik_8 [283]
2 years ago
14

1.Write a Java program to solve the following problem using modularity. Write a method that rotates a one-dimensional array with

one position to the right in such a way that the last element becomes the first element. Your program will invoke methods to initialize the array (random values between 1 and 15) print the array before the rotation, rotate the array, and then print the array after rotation. Use dynamic arrays and ask the user for the array size. Write your program so that it will generate output similar to the sample output below:
Computers and Technology
1 answer:
Westkost [7]2 years ago
6 0

Answer:

Explanation:

The following code is written in Java and it asks the user for the size of the array. Then it randomly populates the array and prints it. Next, it rotates all the elements to the right by 1 and prints the new rotated array.

import java.util.ArrayList;

import java.util.Arrays;

import java.util.Random;

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       Random r = new Random();

       Scanner in = new Scanner(System.in);

       System.out.println("Enter Size of the Array: ");

       int arraySize = in.nextInt();

       ArrayList<Integer> myList = new ArrayList<>();

       for (int x = 0; x < arraySize; x++) {

           myList.add(r.nextInt(15));

       }

       System.out.println("List Before Rotation : " + Arrays.toString(myList.toArray()));

       for (int i = 0; i < 1; i++) {

           int temp = myList.get(myList.size()-1);

           for (int j = myList.size()-1; j > 0; j--) {

               myList.set(j, myList.get(j - 1));

           }

           myList.set(0, temp);

       }

       System.out.println("List After Rotation :  " + Arrays.toString(myList.toArray()));

   }

}

You might be interested in
Dynamic programming does not work if the subproblems: ___________
nirvana33 [79]

Answer:

A. Share resources and thus are not independent

Explanation:

This would be the answer. If this is wrong plz let me know

6 0
2 years ago
Nolan has just created a linked cell to another cell in a separate worksheet in his current Excel 2016 workbook.
kipiarov [429]

Answer: dependent

Explanation:

A Cells containing formulas which refer to other cells are known as dependents.

These are cells that depend on values in the selected cell.

A dependents cell can either contain a formula or a constant value.

(Ctrl + ] ) Is used as a shortcut when selecting dependents cells in an active cell.

Another option is to make use of you (Tools > Formula Auditing > Trace Precedents).

4 0
3 years ago
Read 2 more answers
A ____ firewall keeps a record of the state of a connection between an internal computer and an external device and then makes d
Yakvenalex [24]

Answer:

Stateful frame filtering

Explanation:

<h2><u>Fill in the blanks</u></h2>

A <u>Stateful frame filtering </u> keeps a record of the state of a connection between an internal computer and an external device and then makes decisions based on the connection as well as the conditions.

8 0
3 years ago
High quality pages in a task should all get the same Needs Met rating. For example, a high quality page for a common interpretat
miskamm [114]

Answer:

The given statement is False.

Explanation:

  • Needs Met Rating of a result show us that how much the result is fulfilling the query of the user. The greater the needs met rating is, the greater the satisfaction of the user is.
  • If a page has high quality then it can or can not be useful for the user.
  • If the page has high quality as well as high needs met rating then it is best for the user.
  • If the page has high quality and has low needs met rating that means it is not relevant to the query so not useful for the user.
  • Thus, it is concluded that high quality pages in a task shouldn't all get the same needs met rating rating rather need met rating is dependent upon the relevancy and usefulness of the result to the need and query of the user.
8 0
3 years ago
Andrea wants to to install a new internet connection . she eants to use the fastest one she can find . what are the maximum spee
DaniilM [7]

A dial-up access connection supports a speed up to <u>5</u><u>6kbps</u>, whereas an ISDN line goes up to 1.9Mbps. A DSL connection can support a maximum of 20<u>mbps</u>. Internet access speed through cable TV is capable of up to 1000mbps.

Dial-up connection is by far the slowest of all known internet connections. The maximum speeds that can be supported by this connection are about 56Kbps. Use of this type of connection requires a separate phone line. In an ISDN type of connection, the maximum speeds depend on where in the world you are. The highest to have ever been recorded is an ISDN E1 line that has a combined data rate of 1.9 Mbit/s. Speeds transmitted through DSL are generally the same ones that are transmitted through cable internet and satellite connection. You can expect DSL speeds of 512Kbps to a max of 20Mbps. The cable internet is a broadband internet access and the highest bit rates of cable internet can go be up to 1GBPS which is equivalent to 1000Mbps.

6 0
3 years ago
Other questions:
  • In Linux, the most popular remote access tool is OpenSSH. Which software performs the same remote command line (CLI) access from
    7·1 answer
  • How many bits are required to address a 1mx8 main memory if main memory is byte addressable?
    6·1 answer
  • What coding scheme is used by most microcomputers?
    11·1 answer
  • The first screen you see when you open word2016 what is called?​
    5·2 answers
  • Need help writing a program that reads a string if the option "E" (enter a string) is chosen, and checks if parentheses (), brac
    14·1 answer
  • Differences between Quality of Services and a Service of Quality approach
    9·1 answer
  • Write the definition of a function named quadratic that receives three double parameters a, b, c. If the value of a is 0 then th
    12·1 answer
  • Click cell C6 in the Data worksheet and insert a column. Type Series Name in cell C6. Click cell C7 in the Data worksheet and in
    9·1 answer
  • Three types of query​
    13·1 answer
  • 1.<br> _g<br> clue: fret; become worried<br> 2.<br> Fret become worried
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!