Provide java code to create and initialize an array

Assignment Help JAVA Programming
Reference no: EM13782648

1. Provide Java code to create and initialize an array of integers (Java primitive int), floats or any other Java primitive type of your choice.
You pick the array name and length.

Demonstrate how you would determine the length of your array. Show this through a code example you create where you use the length member.

2. Write a Java application that allows a user to enter numbers into an array and then process them. Enter the number of elements and the value of each element;

Your application will process the data entered and will display the results:

1. Display the elements of the array, max 10 per line
2. Find and display the min value and the index of this min;
3. Display the odd elements;
4. Sorts and displays the numbers from highest to lowest using Arrays.sort() method from java.util.Arrays class and some extracode.

It is recommended to design and implement the methods:

getMin - find the minimum element of the array;
getIndexOfMin - find the index of the maximum element (first if the are many);
displayOdd - find the and display the odd elements;
displayArray - display the elements of the array;

Example:

How many values you want to input:15
Enter number 0 :21
Enter number 1 :22
Enter number 2 :23
Enter number 3 :24
Enter number 4 :25
Enter number 5 :26
Enter number 6 :27
Enter number 7 :1
Enter number 8 :2
Enter number 9 :3
Enter number 10 :4
Enter number 11 :5
Enter number 12 :6
Enter number 13 :7
Enter number 14 :8
Thanks! Here is your array:
21, 22, 23, 24, 25, 26, 27, 1, 2, 3,
4, 5, 6, 7, 8
Min value entered was 1 and has the index: 7
Odd values entered:
21,23, 25,27,1,3,5,7
Descendig Sorted Array is:
27, 26, 25, 24, 23, 22, 21, 8, 7, 6
5, 4, 3, 2, 1

Reference no: EM13782648

Questions Cloud

Artical on relevant research findings : When you are done introducing the first line of thought, create a new paragraph to discuss studies which present another line of thought or opposing view.
Policies that this ceo could put in place to curb : Identify two policies that this CEO could put in place to curb the potential for abuse of the internet at work, with one policy that addresses low-level employees and one policy that is targeted for the board of directors
Maintain a healthy immune system : What do you do to try to maintain a healthy immune system? Why is it important to have a healthy immune system? How do you feel about vaccines? Do you think the benefits outweigh the risks? Would you recommend that parents follow vaccine recommenda..
Emphasis on empirical observation of particular living : You can see this difference in their intellectual preferences: Plato stressed the importance of mathematics, with its emphasis on intellectual investigation of pure ideas and relationships; Aristotle emphasized biology, with its emphasis on empiri..
Provide java code to create and initialize an array : Provide Java code to create and initialize an array of integers (Java primitive int), floats or any other Java primitive type of your choice. You pick the array name and length.
Perform work versus your internal project team : Describe which portion of the project - candidate for outsourcing - Discuss what the pros and cons are for having an outside vendor perform work versus your internal project team.
Details regarding the expectations : Business requirements document (BRD) that provides additional details regarding the expectations (such as user, system, and functional) that must be met for achieving goals of the project
Benefits of a diverse workforce : Benefits of a Diverse Workforce.Communication is of utmost importance in diverse teams.
Relevant facts about the project duration : In addition summarize any relevant facts about the project duration, number or type of resources, critical task sequencing, or how duration estimates were arrived at, and any financial implications (for example, budget or cost reports of the proje..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Build the gui layout of the gamecreate a class called

build the gui layout of the gamecreate a class called pipegameapp.java which will be the main game user interface. the

  Draw a uml diagram of each of the shapes

Draw a UML diagram of each of the Shapes, Rectangle and Square classes using the code that has been provided. Complete this using the examples that have been provide in the lecture slides.

  Implement a third component of the compiler

To detect duplicate declarations using the same identifier, you call the method retrieveOneLevel. This method returns a pointer to the identifier entry if the identifier was declared before in the current scope and null otherwise.

  The application with all the specifications should be

the application with all the specifications should be developed based on a graphical user interface.1. implement proper

  Features of any programming language is recursion

One of the most useful features of any programming language is recursion and control structures, decisions and loops. Recursion and loop structures allow programs to repeat actions without duplicating code.

  Write a program that will prompt the user for a file name

Write a program that will prompt the user for a file name and open that file for reading. Print out all the information in the file, numbering each new line of text.

  Create a driver class with a main method

Create a driver class with a main method that creates a course, adds several students, prints a roll, and prints the overall course test average

  Write a java program that declares an array alpha of 50

Write a Java program that declares an array alpha of 50 elements of type double. Initialize the array so that the first 25 elements are equal to the square of the index variable, and the last 25 elements are equal to three times the index variable. O..

  Prompts the user to enter 4 numbers for a salesperson

Write a program (SalespersonCommission.java) that prompts the user to enter 4 numbers for a salesperson's items sold for last week and displays that salesperson's earnings.

  Part - a1nbsp to compile and run a java source file

part - a1.nbsp to compile and run a java source file hello.java that contains a main method which of the following are

  Implement a method with three arguments

Implement a method with three arguments: a graph, a starting vertex number, and an ending vertex number. The method determines whether there is a directed path from the starting vertex to the ending vertex.

  Create the class airplane

Your missions is to create the class Airplane. Each Airplane object should store the following information (fields):

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