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
sveticcg [70]
3 years ago
10

Create a package named one_dimensional_array and write a class that completes the following "OneDimensionalArrays" class. You wi

ll complete the class by filling in code wherever you see the comment:
Engineering
1 answer:
yan [13]3 years ago
7 0

Answer:

The filled in codes are

1) private static int[] arr;

2)  int arr[] = new int[size_of_array];

        int increment = 100;

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

       arr[i] = increment * i;

       }

      return arr;

3) for (int i = 0; i < myArray.length; i++) {

      System.out.println(myArray[i]);

4)  OneDimensionalArrays result = new OneDimensionalArrays();

    result.createIntegers(num);

    result.printArray(arr);

Explanation:

Create a package named one_dimensional_array and write a class that completes the following "OneDimensionalArrays" class. You will complete the class by filling in code wherever you see the comment:

//******* FILL IN CODE *********

import java.util.Scanner;

public class OneDimensionalArrays {

   

   int[] createIntegers(int size_of_array)

   {

      //*******  FILL IN CODE *********

      // Your code will create an array of ints as large as specified in size_of_array

      // Fill the array in with the values: 0, 100, 200, 300, ....

      // Return the array that you just created

   }

   void printArray(int[] myArray)

   {

      //*******  FILL IN CODE *********

       // Print out your array with one number per line.  Get the size of the

       // array from the "myArray" parameter (no hard coding the size)

   }

   public static void main(String[] args) {

       Scanner keyboard = new Scanner(System.in);

       

       System.out.println("Enter size of array to create: ");

       int num = keyboard.nextInt();

       //*******  FILL IN CODE *********

       // Construct an instance of the OneDimensionalArrays class

       // Using this object instance, call createIntegers to create

       // an array of integers.  Don't forget to save the results

       // Then call the printArray method to print out the contents

       // of your array.

       }

}

Completed Code when filled in looks this way below:

import java.util.Scanner;

public class OneDimensionalArrays {

  private static int[] arr;

  int[] createIntegers(int size_of_array) {

       int arr[] = new int[size_of_array];

       int increment = 100;

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

             arr[i] = increment * i;    

       }

       return arr;

   }

   void printArray(int[] myArray) {

       for (int i = 0; i < myArray.length; i++) {

           System.out.println(myArray[i]);          

       }

   }

   public static void main(String[] args) {

       Scanner keyboard = new Scanner(System.in);

       System.out.println("Enter size of array to create: ");

       int num = keyboard.nextInt();

       OneDimensionalArrays result = new OneDimensionalArrays();

       result.createIntegers(num);

       result.printArray(arr);

   }

}

You might be interested in
A container filled with a sample of an ideal gas at the pressure of 150 Kpa. The gas is compressed isothermally to one-third of
lyudmila [28]

Answer: c) 450 kPa

Explanation:

Boyle's Law: This law states that pressure is inversely proportional to the volume of the gas at constant temperature and number of moles.

P\propto \frac{1}{V}     (At constant temperature and number of moles)

P_1V_1=P_2V_2  

where,

P_1 = initial pressure of gas  = 150 kPa

P_2 = final pressure of gas  = ?

V_1 = initial volume of gas   = v L

V_2 = final volume of gas  = \frac{v}{3}L

150\times v=P_2\times \frac{v}{3}  

P_2=450kPa

Therefore, the new pressure of the gas will be 450 kPa.

7 0
4 years ago
Find a negative feedback controller with at least two tunable gains that (1) results in zero steady state error when the input i
IceJOKER [234]

Answer:

Gc(s) = \frac{0.1s + 0.28727}{s}

Explanation:

comparing the standard approximation with the plot attached we can tune the PI gains so that the desired response is obtained. this is because the time requirement of the setting is met while the %OS requirement is not achieved instead a 12% OS is seen from the plot.

attached is the detailed solution and the plot in Matlab

8 0
4 years ago
A heat engine that rejects waste heat to a sink at 520 R has a thermal efficiency of 35 percent and a second- law efficiency of
xeze [42]

Answer:

The source temperature is 1248 R.

Explanation:

Second law efficiency of the engine is the ratio of actual efficiency to the maximum possible efficiency that is reversible efficiency.

Given:  

Temperature of the heat sink is 520 R.

Second law efficiency is 60%.

Actual thermal efficiency is 35%.

Calculation:  

Step1

Reversible efficiency is calculated as follows:

\eta_{II}=\frac{\eta_{a}}{\eta_{rev}}

0.6=\frac{0.35}{\eta_{rev}}

\eta_{rev}=0.5834

Step2

Source temperature is calculated as follows:

\eta_{rev}=1-\frac{T_{L}}{T}

\eta_{rev}=1-\frac{520}{T}

0.5834=1-\frac{520}{T}

T = 1248 R.

The heat engine is shown below:

Thus, the source temperature is 1248 R.

6 0
3 years ago
Create a series of eight successive displacements that would program a robot to move in an octagonal path that is as close as yo
Komok [63]

Answer:

bts biot bts biot jungkukkk

jungkukkkbiot

Explanation:

bts biot bts biot jungkukkk

jungkukkkbiot

5 0
3 years ago
Bending is defined as? A. the application of a load tending to distort a member in one direction. B. the application of opposing
amm1812
Hi how are you today
4 0
3 years ago
Other questions:
  • Check the answer that best describes the relationship between f(x) and x. (For example if f(x) is Θ(x) check that as your answer
    12·1 answer
  • Suppose you were a heating engineer and you wished to consider a house as a dynamic system. Without a heater, the average temper
    6·1 answer
  • How many GT2RS cars were made in 2019
    7·2 answers
  • 7. A single-pole GFCI breaker is rated at
    9·1 answer
  • What is the name of the part that supports the headlight assembly?
    15·1 answer
  • Which type of memory is programmed at the factory? RAM ROM Cache or Virtual memory
    15·1 answer
  • Some_____
    10·1 answer
  • Technician A says that a defective crankshaft position sensor can cause a no spark condition technician B says that a faulty ign
    8·1 answer
  • What do Engineering Systems achieve?
    8·1 answer
  • s) Use Cramer’s rule to solve the system below, and state the condition at which solution exists. ax+by = 1 cx+dy =−1
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!