Cash-back offer from May 7th to 12th, 2024: Get a flat 10% cash-back credited to your account for a minimum transaction of $50.Post Your Questions Today!

Question DetailsNormal
$ 15.00

Your assignment is to write and test a Java program (Project8.java) that will

Question posted by
Online Tutor Profile
request

complete solution correct answer key

Your assignment is to write and test a Java program (Project8.java) that will

1. read from an input text file

2. write to an output text file

3. use an integer array

4. use dialog boxes

Required main function: Here is the main method. Do not change it. import java.util.Scanner; import javax.swing.JOptionPane; import java.io.*; public class Project5 { public static void main (String [] args) throws FileNotFoundException final int LIMIT = 25; int [] numbers = new int [LIMIT]; int count = getInput(numbers); System.out.println (count + " values were read"); print (numbers, count); // prints original list sort (numbers, count); print (numbers, count); // prints sorted list System.out.println ("Program complete"); }

Required methods: You must write the following methods as specified to complete your program. Pay attention to the name, return type and parameters.

1. getFileName (String) : String

This method is called from the other two methods you will write. It has one parameter (a String) and returns a String. The method must do the following:

a. display a dialog box containing the String parameter

b. return the contents the user enters in the dialog box

For example, if the String “Enter input file name” is the parameter, this is displayed.

The method should then return the String entered by the user. Using a dialog box is covered in Lab 7.

2. getInput (int []) : int

This method has one parameter – the array of integers and returns an integer. It must:

a. call the getFileName method passing in the string “Enter input file name”

b. open the input text file with that name

c. read the integers from the file and store them into the array

d. return the count of how many values are read

e. close the file

The array has a limited size so it is important to count the input and make sure that the array does not overflow. A while loop is the solution for this. Here is the logic for this method. Get input file name by calling the getFileName method Open the file and create a Scanner for the file Initialize count to 0 While there are integers to read from the file and the array is not full Read an integer and store it into the array Increment count End while Close the file Return the count

3. print (int [], int) This method has two parameters – the array to print and the count of how many integers are in the array. There is no return value. The method must:

a. call the getFileName method passing in the string “Enter output file name”

b. open the output text file with that name

c. print the integers to the file from the first to the last

d. close the file

4. sort (int [], int) This method has two parameters – the array and the count of how many integers are in the array. There is no return value. The method must sort the array into ascending order using the selection sort algorithm as covered in lecture.

Documentation: Use Javadoc style for all comments.

1. Document the beginning of the file with your name and program number as well as a description of the program.

2. Document each method. Submit your file Project5.java using the link on Blackboard

Available Answer
$ 15.00

[Solved] Your assignment is to write and test a Java program (Project8.java) that will

  • This solution is not purchased yet.
  • Submitted On 21 Jul, 2015 09:38:14
Answer posted by
Online Tutor Profile
solution
import java.util.Scanner; import javax.swing.JOptionPane; import java.io.*; public class Project5 { public static void main(String[] args) throws FileNotFoundException { final int LIMIT = 25; int[] numbers = new int[LIMIT]; int count = getInput(numbers); System.out.println(count + " values were read"); print(numbers, count); // prints original list sort(numbers, count); print(numbers, count); // prints sorted list System.out.println("Program complete"); } /** * Read the integers from the input file and store them into the array * * @param numbers Array of integers to store the...
Buy now to view the complete solution
Other Similar Questions
User Profile
Solut...

Discussion question

Thank you for purchasing. Please find your assignment attached. ...
User Profile
Solut...

week 1 scenarious

Thanks for buying. Please see attached file. Let me know if you've any questions....
User Profile
d3dpk

Drag Exercise (Answer the questions on word file)

I have attached the solution Please have a look Thanks ...
User Profile
NUMBE...

Part 1 To prepare for this Part 1 of your Assignment: Review this week's Learning

Multiple Regression The article for this work is “RETAIL SALES FORECASTIHG WITH APPLICATIOH THE MULTIPLE REGRESSION” by Tetyana Kuzhda, 2012. As the title suggest the author is trying to......

The benefits of buying study notes from CourseMerits

homeworkhelptime
Assurance Of Timely Delivery
We value your patience, and to ensure you always receive your homework help within the promised time, our dedicated team of tutors begins their work as soon as the request arrives.
tutoring
Best Price In The Market
All the services that are available on our page cost only a nominal amount of money. In fact, the prices are lower than the industry standards. You can always expect value for money from us.
tutorsupport
Uninterrupted 24/7 Support
Our customer support wing remains online 24x7 to provide you seamless assistance. Also, when you post a query or a request here, you can expect an immediate response from our side.
closebutton

$ 629.35