Java program to declares integer array

Assignment Help JAVA Programming
Reference no: EM1345571

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

1. void displayOddPositions ()
This method displays the array elements in the odd positions only, namely, 2, 4, 6.

2. void displayReverse ()
This function displays the array elements in reverse order so the last item appears first and vice versa.

3. void multiplyByFactor (int factor)
This method multiplies all elements in the array by a given factor.

4. void addArray(int[] givenArray)
This method is used to add an array to the current data field intArray. First, check that the givenArray is the same length as the data field array. If they are the same length, then add each element in the givenArray to the corresponding element in intArray.

5. Write the main method to test and show the functionality of the above methods.

Reference no: EM1345571

Previous Q& A

  Example on project selection

Do I have to do a cash flow and How? What should I recommend for John ? Can you help me make logical assumptions and justifications about what he should do - What would you recommend John do? Make logical assumptions and justify all of these before..

  Compute current stock price

Otobai Motor Corporation is currently paying a dividend of $1.40 each year. The dividends are expected to grow at a rate of 18% for next 3-years and then a constant rate of 5 percent thereafter forever.

  Explaining leverage data from across enterprise

Many companies have executed ____________ to enable managers and knowledge workers to leverage data from across enterprise.

  What is the weight of the drop

What is the weight of the displaced amount of water when the boulder is placed inside the tank (measured in N)? The tank had an original volume of water of 5000 L. while the boulder got placed inside the tank, the volume of water rose to 5010.165 ..

  Find risk premium on the market

Risk Free rate 4 percent and the expected return on the market portfolio is 12%. Using the capital asset model:

  What is the severity of this change

What is the requested change and what is the severity of this change - what is the severity of this change

  What will be the final temperature of the mixture

An archer pulls her bow string back 0.40m by exerting a force that increases uniformly from zero to 25 N. How much work does the archer do in pulling back the bow.

  Describe the overall planning and budgeting process

I need information in regards to Carolina medical center in North Carolina and considering & budgeting and describing on the topics below.

  Explaining records are stored and accessed on storage medium

Which of the given correctly explains a way in which data records are stored and accessed on storage medium?

  Military - verterans and private sector health systems

Please explain some major differences in health policy between the Military Health System, the Veterans Health Administration, and the private sector.

Reviews

Write a Review

 

Similar Q& A

  Please write the code in java

Please write the code in java for  Recursion,  Sorting and Searching

  Rock-paper-scissors :- java problem

Design decision marks are based on how you implemented our programs/classes.

  Design a course registration system

Create an application which represents a simplified course registration system using ArrayLists and HashMaps.

  Java problem - g queue

A queue is an ordered collection of items in which the removal of items is restricted to the FIFO ( rst in rst out) principle.

  Socket programming in java: tcp

In this project we will develop a Web server in two steps. In the end, you will have built a multi-threaded Web server that is capable of processing multiple simultaneous service requests in parallel.

  World data app

Prepare WorldDataApp project. It implements the NameIndex portion, including creating it in SetupProgram, and searching, viewing and updating it in UserApp program.

  Determine if strings are equal

Complete the recursive method match in the code below which will determine whether or not two strings match.

  Cascading style sheet to a website

Compare and contrast the process of adding JavaScript and a Cascading Style Sheet to a Website. Determine if they can be used simultaneously in a page.

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Print the contents of the array

Prepare a second loop that prints the contents of the array

  Implement the lexical and syntactic analysis

Implement the lexical and syntactic analysis of Minifun programming language.

  Enterprise java beans (ejb) in software development

Enterprise Java Beans (EJB) in software development, EJB technology, EJB application, Stateless Session Beans (SLSB), Stateful Session Beans (SFSB), Message Driven Bean (MDB), Entity Bean

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