Make java class that creates an array of integers

Assignment Help Computer Engineering
Reference no: EM1330361

Java Programming - Array Sort

Description

Write a Java class that creates an array of integers, fills it with values, prints the unsorted values, sorts the values into ascending order, and finally prints the sorted values.
Write a class named ArraySort that has no instance variables, and the following public static methods
public static void main(String[] args) - this main method performs the following steps:
? Prompts for the size of the array to be created (limit it to between 3 and 10).
? Creates a Scanner to read the int value for the array size, reads it, and verifies it is within the correct range.
? Dynamically creates a local integer array of the requested size.
? Calls the fillArray method to read values into the array (passing its local array as the parameter).
? Calls the printArray method to print the unsorted values.
? Calls the sortArray method to sort the array values into ascending order.
? Calls the printArray method to print the sorted values
public static void fillArray(int[] array) - this method fills the parameter array with values. It creates a local Scanner object, loops once for each array element, prompts for a value, reads an integer value using the Scanner, and assigns it to the array element.
public static void printArray(int[] array) - this method prints all the values in the parameter array.
public static void sortArray(int[] array) - this method sorts the values in the parameter array into ascending order. You must write the Java code to do the actual sorting of the array values (see example logic below).
Sample Output
Enter the size of the array (3 to 10):
3
Enter 3 values
Enter value for element 0:
15
Enter value for element 1:
10
Enter value for element 2:
5
The unsorted values...
15
10
5
The sorted values...
5
10
15
Done - press enter key to end program
Test Data
Use the following test data, plus an example of your own:
1000, -200, 500, 150, 600, 800, 150, 50, -25

Reference no: EM1330361

Questions Cloud

Calculations in log space using natural logarithms : A coworker is considering the use of a log linear (power) model using weight to find the cost of a manufacturing effort.
Define electronic commerce on the united states legal system : Explain Electronic Commerce on the United States Legal System and what is the impact of electronic commerce on the entire United States legal system
Realistic implementation timeline for action item on plan : A realistic implementation timeline for each action item on your plan.
About inequalities : Despite legislation and policy there are persistent inequalities in the UK.
Make java class that creates an array of integers : Write down a Java class that creates an array of integers, fills it with values, prints the unsorted values, sorts the values into ascending order, and finally prints the sorted values.
Estimating the manufacturing hours for an airframe : Estimating the manufacturing hours for an airframe based on the airframe weight. The airframe you are estimating weighs 850 pounds.
Study guide which will help students to further research : It is a study guide which will help students to further research the topic.
Explain increasing role of m-commerce : Explain Increasing role of M-Commerce and Intro to Electronic Commerce and Define and Describe the underlying technology
Impact of declining resources for the hrm functions : Declining Resources in Government: Impact to HRM Functions - What are the impact of declining resources for the Human Resource Management functions in government?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Program that computes the total cost of four years

Write down another Java program that computes the total cost of four years worth of tuition starting ten years from now.

  Hardware support to memory management

Study any two multicore processor architecture and discuss the following features briefly

  Program to select numbers of three finalists

You have three identical prizes to give away and a pool of 10 finalists. The finalists are allocated numbers of 1 to 10. Write down a program to randomly select the numbers of 3 finalists to receive a prize.

  The cost of maintenance over a lifetime of a system

What are some of the things management can do to ensure efficient and effective maintenance.

  What are the feelings positive or negative

IT administrators in small companies must often execute several functions at the same time like network administrator, database administrator, user consultant and others. Compared to their situation, their colleagues in larger companies can get mo..

  Identify the main elements of the us criminal

recognize the key elements of the US criminal justice system and explain how they relate to the job of the computer forensic investigator? Support the opinion or any arguments you may make.

  Network and the different types of networks available

This is an insurance agency that has over 100,000 customers nationwide. They now have about 5,000 employees and 2,000 of them are agents in the field with their own offices. This agency primarily sells life, auto and home policies.

  Predicate color and action paint using situation calculus

Predicate color and action paint using situation calculus

  Analyzing the companys problem

Utilizing the standard content of a system request as your guide, prepare a list of the questions that Harry requires to have answered about this project.

  Private base class function declared public in derived class

Private base class function declared public in derived class

  More detail to be shown as a process is exploded

In data flow diagrams (DFDs), a process symbol can be referred to as a black box, becase the inputs, outputs, and general funcions of the process are known, but the underlying details and logic of the system are hidden.

  Determine highest distance

Determine highest distance

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