Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab 7 Java Declare an array reference variable arrayInt for an array of integers. Create the array of size 100, and assign it to arrayInt.

Lab 7 Java

Declare an array reference variable arrayInt for an array of integers.

Create the array of size 100, and assign it to arrayInt.

Write a method to populate the array with Random numbers between 1 to 25.

Signature of the method is: populateArray( int[] ) which returns nothing.

Call this method from main with arrayInt--> populateArray(arrayInt).

Write a method to print an array. Signature of the method is:

printArray( int[] ) which returns nothing. Print maximum of

ten(10) numbers on a line (see sample output below).

Call this method from main with arrayInt--> printArray(arrayInt).

Write a method that finds the average of the array elements.

Signature of the method is: findAverage( int[] ) which returns the

average to the calling program.Call this method from main with

arrayInt--> findAverage(arrayInt).

import java.util.Random;

public class RandomArrayAverage { public static void populateArray(int arr[]){ Random random = new Random(); for(int i = 0;i

public static void printArray(int arr[]){ for(int i = 1;i<=arr.length;i++){ System.out.print(arr[i-1] + "\t"); if(i%10 == 0){ System.out.println(); } } System.out.println(); }

public static double findAverage(int arr[]){ double avg = 0; for(int i = 0;i

public static void main(String args[]){ int arrayInt[] = new int[100]; populateArray(arrayInt); printArray(arrayInt); System.out.println("Average = "+ findAverage(arrayInt)); } }

I NEED HELP ON THE STEPS BELOW FOR THE ABOVE PROGRAM

For the lab, complete the 3 steps:

1) Rewrite the problem statement. Draw the IPO diagram - Input, Processing and Output box. The rectangle box which contains the processing, arrows pointing in for each input value and arrows going out for output.

https://www.tutorialspoint.com/software_engineering/software_analysis_design_tools.htm (Links to an external site.)Links to an external site.

2) Draw the flow-chart or write down the pseudocode.

3) Write down the method signatures. Know the difference between method signatures and method header.

4) Write down the main method.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual C# .NET

Authors: Ying Bai

1st Edition

0470467274, 978-0470467275

More Books

Students also viewed these Databases questions

Question

Which team solution is more likely to be pursued and why?

Answered: 1 week ago