Java program to declare an integer array and initializing it

Assignment Help Computer Engineering
Reference no: EM1321481

Write down a complete Java program that declares an integer array, intArray, and initialize it to {1, 2, 3, 4, 5, 6, and 7}. The program must have the following methods:

1) void displayOddPositions ()

This method displays array elements in the odd positions only, named as, 2, 4, 6.

2) void displayReverse ()

This function shows the array elements in the reverse order so the last item emerges first and vice versa.

3) void multiplyByFactor (int factor)

This method multiplies all the elements within the array by a given factor.

4) void addArray(int[] givenArray)

This method is utilized to add an array to the current data field intArray. First, check that the givenArray is same length as the data field array. If they are the same length, then add each element within the givenArray to the corresponding element in intArray.

5) Write down the main method in order to test and display the functionality of the above methods.

Reference no: EM1321481

Questions Cloud

Questions based on the test for population mean : The Dean of Students believes that the costs are greater this semester. What is the test value for this hypothesis?
Most insignificant office that was the invention of man : John Adams wrote his wife that his office is the "most insignificant office that was the invention of man."
Knowledge of age score account for in competence scores : How much variation does knowledge of Age Score account for in Competence Scores?
Probability of two mutually exclusive events : Probability of two mutually exclusive events intersecting Can be any value between 0 to 1, Must always be equal to 1.
Java program to declare an integer array and initializing it : Write down a complete Java program that declares an integer array, intArray, and initialize it to {1, 2, 3, 4, 5, 6, and 7}. The program must have the following methods:1) void displayOddPositions (). This method displays array elements in the odd..
Assume that the central bank of an economy : Assume that the central bank of an economy contracts the money supply.
Calculate the test statistic value for population mean : A sample of 81 business managers on the West Coast had an average breakfast cost of $7.65. 13. At a = 0.05, what is the test value?
Components of the hawthorne study : Describe how the components of the Hawthorne study are incorporated in current human resource functions? What was the main idea behind this study?
What two variables have the strongest positive strength : What two variables have the strongest positive strength of relationship?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd