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

  Implementing model to check the vulnerability

Construct a simple threat model which explains the risk this represents: attacker(s), vulnerability, assets, attack vector, and the likelihood of occurrence, likely impact, and the plausible mitigations.

  Classify traditional grade school algorithms

Classify traditional grade school algorithms

  How to write a class named dayofyear that gets an integer

How to write a class named DayOfYear that gets an integer Day 2 would be January 2 Day 32 would be February 1 Day 365 would be December 31

  Generate a context diagram of the system

Generate a context diagram of the system

  Determining occurance as incident or disaster

Categorize the following occurrences as an incident or disaster. If an occurrence is a disaster, find whether or not business continuity plans would be called into play.

  Creating the application program

Develop an application program which declares two Book objects and sets and displays their values.

  What is home wireless network and security

What is home wireless network and security Methodology- Review topics covered in lecture hours, from textbook, reference books plus online research, to behaviour a comprehensive study about wireless network security implementation at home.

  Evaluates and contrast tcp and ud

Describe the need for the Transport Layer. Recognize the role of the Transport Layer as it provides the end to end transfer of data between applications.

  Study and analyze the principles of inheritance

Study and analyze the principles of inheritance

  The ways to depict constraint graph

The ways to depict constraint graph? illustrate how splitting a domain can be used to solve this problem.

  How many address lines are needed to access memory

How many address lines are needed to access memory.

  What is advantage of payroll scheme approach for the project

What is advantage of payroll scheme approach for the project? What do you think is the most suitable Life Cycle Approach?

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