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
Savatey [412]
3 years ago
15

create a function named dispAry. This function has 2 arguments, the first one is an integer array and second one is a integer to

indicate the size of the array. There will be no return value. In the function body the code should loop through the array that was passed and display its contents to the screen. Lastly write the code that calls the function and passes the salesCount array and the size of the array.
Computers and Technology
1 answer:
11Alexandr11 [23.1K]3 years ago
3 0

Answer:

The java program for the given scenario is as follows.

import java.util.Scanner;

import java.lang.*;

public class Main

{

   //variable declared static and initialized

   static int size=10;

   //array declared static  

   static int[] salesCount = new int[size];

   //method to display array

   static void dispAry(int[] arr, int len)

   {

       for(int j=0; j<len; j++)

       {

           System.out.println(arr[j]);

       }

   }

public static void main(String[] args) {

//array initialized in for loop

   for(int j=0; j<size; j++)

   {

       salesCount[j]=j*2;

   }  

    //method called to display array

    dispAry(salesCount, size);

}

}  

OUTPUT

0

2

4

6

8

10

12

14

16

18

Explanation:

1. A static integer variable, size, is declared and initialized to 10.

2. A static integer array, salesCount, is declared. This array is initialized inside main().

3. A static method, dispAry(), is defined which takes two parameters: an array and an integer variable indicating size of that array.

4. This method only displays the contents of the array.

5. Inside main() method, the array, salesCount, is initialized and passed as a parameter to the method, dispAry(), along with the integer variable, size.

6. The program can be tested for any value of variable, size, which indicates length of the array.

7. The values in the array are double the index of each element; each index is multiplied by 2 and assigned to the element at that particular index.

8. The program can be tested for any numerical values in the array.

9. Since two methods are required, program is written in java language.

10. Each element of the array are printed on a new line using the method println().

11. All the elements of the array can be printed on the same line, separated by space, using method print().

12. In java, all coding is written inside the class. Only variables can be declared at class level, inside class and outside methods. All the logic is to be placed inside methods.

You might be interested in
Analyse how the reduction in size and the profitability of computer have influence their usage​
Olin [163]

HOPE ITS HELP

IN THE PICTURE

6 0
2 years ago
Nina aspires to be a digital media specialist. What should Nana be familiar with in order to pursue this career?
brilliants [131]

computer science? maybe im not sure?

4 0
3 years ago
Read 2 more answers
What is the CPI of the central processing unit cpu of a computer
vlada-n [284]
Electronic component on a computer's
motherboard that interprets and carries
out the basic instructions that operate
the computer; also called processor.
5 0
3 years ago
Set of general format used to write program in any programming language?​
Novosadov [1.4K]

Answer:

hope you find it right

Explanation:

The process of writing computer instructions in a programming language is known as Coding.

A computer program is usually written by a computer programmer in a programming language. From the program in its human-readable form of source code, a compiler can derive machine code—a form consisting of instructions that the computer can directly execute.

That line of code is written in the Python programming language. Put simply, a programming (or coding) language is a set of syntax rules that define how code should be written and formatted. Thousands of different programming languages make it possible for us to create computer software, apps and websites.

In programming, code (noun) is a term used for both the statements written in a particular programming language - the source code , and a term for the source code after it has been processed by a compiler and made ready to run in the computer - the object code .

5 0
3 years ago
List the step should take to complete a specific maintenance procedure
mezya [45]
<span><span>Have a pre-plan. Before you begin the large job, have the maintenance planner sit down with all of the personnel who were members of the work team the last time the job was done, or at least as many of them as are available. The planner should write out the steps the way they are remembered. This plan—sketchy though it may be—will form the outline of the upcoming job.</span><span>Photograph the job. The importance of this step is paramount. Even a well-written job plan can be misread or misunderstood. A photograph, however, speaks for itself. If you have the equipment and personnel, videotaping the procedure is even better. The supervisor is not a good choice for this role, because he/she needs to be supervising. If the reliability engineer is not available, perhaps the scheduler or the clerk can pitch in. Another idea is to enlist the aid of an employee who has been assigned to restricted duty.</span><span>Write it down. The maintenance planner should be the one to write down the action step-by-step, beginning with the safe lockout of the machine. This individual should assume that he/she is writing the procedure for someone who is a total stranger to the plant and the machines—and that the written procedure will ensure that this imaginary person can successfully complete the job. The planner should be looking not only at what currently is being done, but also for ways to improve on the procedure (including ways the job can go more smoothly in the future). He/she also should be sure to record the number of man hours associated with each step, from kitting the job right on down to cleanup.</span><span>Write out a complete parts list. This list should be as comprehensive as possible, down to the numbers and grades of the nuts, bolts and washers that are needed. Lead times for special-order or fabricated parts should be noted.</span><span><span>Write out a complete supplies, tools and experts list. </span>If special jigs or stands are made for the job, they should be noted on the SMP, including where they are stored. Have there been shortages of special welding rods or bottled gas? Jacks, cranes and special tools also should be noted. What about consultants or factory reps? If they were present last time, chances are they will be needed next time. Does an operator need to be present? Will it be desirable to have predictive maintenance personnel available to take readings for baselines after the job is completed?</span><span><span>Include drawings and diagrams. </span>Any tool, document or image that can help the technician as he/she is performing the job should be available.</span></span>
8 0
3 years ago
Read 2 more answers
Other questions:
  • [PROGRAMMING] A ____ signal indicates that a specific amount of time should pass before an action starts.
    13·1 answer
  • To save the changes to the layout of a table, click the Save button on the _____.
    13·1 answer
  • Convert the Binary Number to a Decimal Number
    13·1 answer
  • 1. A formula =A1+B2 is in cell D8. If you copy that formula to cell D9, what is the new formula in cell D9?
    7·1 answer
  • Explain 3 ways you can be an upstander when seeing cyberbullying.
    13·2 answers
  • Which command backs up the single database called 'websites' to the file 'websites_backup.sql'?
    10·1 answer
  • Can someone who is good at 9th class IT (cbsce) can help me in my homework​
    14·1 answer
  • A computer follows step-wise instructions to complete any task which is known as?
    5·1 answer
  • HTML code to display square bullets in an unordered list​
    7·1 answer
  • Meryl works in the audio-video department
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!