Write a java class that creates an array of integers

Assignment Help JAVA Programming
Reference no: EM13941101

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: EM13941101

Questions Cloud

Determine how much cash was collected from customers : Beginning accounts receivable were $11,000 and ending accounts receivable were $14,000. All sales were on credit and totaled $559,000. Determine how much cash was collected from customers.
Break even point in units : Calculate the break-even points (in $ and units) if the retail price of car wash drops to $3.50 per car due to competition in the future.
Mutual awareness of cultural references : Mutual awareness of cultural references is essential in international business. Levels of formality vary greatly among cultures. In most situations, restraint equals respect.
Prepare the journal entry to record the sale on january : Prepare the journal entry to record the sale on January 1, 2009. Determine how much interest Frenchie will receive if the note is repaid on December 31, 2009.
Write a java class that creates an array of integers : 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.
Current issues faced by the online groceries in europe : Analyse the current issues faced by the online groceries in Europe. What areas of the product delivery, customer service and supply change management are they handling well?
How can lawyers determine whether or not they are competent : How can lawyers determine whether or not they are competent to take on a case? What can/should lawyers do if they believe they are not competent to take on a case?
Calculate cobbs gross profit ratio : The following information pertains to Cobb Corporation's financial results for the past year. Calculate Cobb's gross profit ratio. Calculate Cobb's net profit margin ratio.
Preparing a market cultural report on a country : You are required to prepare a market cultural report on a country of your choosing. You are to provide insights on the culture of the host market,

Reviews

Write a Review

JAVA Programming Questions & Answers

  Implement a class called reversewords

Implement a class called ReverseWords that uses a stack to output a set of elements input by the user in reverse order.

  Java is considered to be safe from buffer overflows

Java is considered to be safe from buffer overflows. Does that make it more appropriate to use as a s development language when security is concerned? Be sure and weight all if the risks involved in product development, not just the security aspec..

  Each purchase contains an invoice number amount of sale

Create a class named Purchase. Each Purchase contains an invoice number, amount of sale, and amount of sales tax. Include set methods for the invoice number and sale amount.

  Review the threading

Threading. A considerable amount of time was spent trying to get threading to work properly. Initial designs included a thread called Turn, which would call a subsequent thread for performing communication actions with the LAMP server. Unable to..

  You need to prepare the java applet

If the typed number is valid, display a product description and price; otherwise, display an appropriate error message. Save the file as JProductFinder.java.

  Create a console-based program and a gui application

Create a console-based program and a GUI application, which justifies the following conditions: The Main() method prompts the user for an integer value and, in turn.

  Concepts of polymorphism

This lab introduces students to the concepts of polymorphism, early binding, late binding, abstract classes, and virtual class functions. This will be done in the context of performing calculations on basic geometrical shapes

  Write a program that starts a player off with a bank of $15

Write a program that starts a player off with a bank of $15.00.

  Calculates the total annual compensation of a salesperson

Write a Java application using NetBeans Integrated Development Environment (IDE) that calculates the total annual compensation of a salesperson. Consider the following factors: A salesperson will earn a fixed salary of $35,750

  Java program that will prompt the user to input a file

Write a Java program that will prompt the user to input a file (document) in order to count the frequency of each word. This program will display the frequency of each word sorted alphabetically or by frequency (depending on the preference of the use..

  Write class encapsulating the concept of weather forecast

Write a class encapsulating the concept of the weather forecast, assuming that it has the given attributes: the temperature and the sky conditions, which could be sunny, snowy, cloudy, or rainy.

  Hypothetical situation

Hypothetical Situation - A company lowers its price of an economy car a small amount   ($15,000 to $14,000) Sales go from 10,000 units to 50,000 units. Another company lowers its price on a luxury car a large amount ($80,000 to $40,000). Its sales go..

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