subject

Design a class FileArray that has a static method named writeArray. The method should take two arguments: the name of a file and a reference to an int array. The file should be opened as a binary file, the contents of the array should be written to the file, and then the file should be closed. Write a second static method in the class FileArray named readArray. The method should take two arguments: the name of a file and a reference to an int array. The file should be opened, data should be read from the file and written into the array, and then the file should be closed. FileArrayDemoDemonstrate both methods in a class called FileArrayDemo with the main method. Import both java. io.* and java. util.*;Creates a Scanner. Set a flag to false. while flag is falseUnder a try-catch-finally:Under try:Requests, and reads in the size of an int array called inputNumbers. It then creates the array and requests and reads in the values of the array. It also creates an output array of the same size called outputNumbers. Also request and read in the name of an output file of type .dat. It then creates the array and requests and reads in the values of the array. Call writeArray with references to the outputfile name and the array inputNumbers. Call readArray with references to the outputfile name and the array outputNumbers. Test for the various error conditions. Print out the output file. Set flag to trueUnder catch:Catch any InputMismatchException and print the trace (see output). – In this case set the flag to trueCatch and print the trace (see output).Catch and print the trace (see output).Catch any IOException and print the trace (see output).Under finally:Print "Program Completed"Sample Inputs/OutputsPlease enter the number of integers to enter:8.2InputMismatchjava. util. InputMismatchException at java. base/java. util. Scanner. throwFor(Scanner. java:939) at java. base/java. util. Scanner. next(Scanner. java:1594) at java. base/java. util. Scanner. nextInt(Scanner. java:2258) at java. base/java. util. Scanner. nextInt(Scanner. java:2212) at FileArrayDemo. main(FileArrayDemo. java:21)Program Loop CompletedPlease enter the number of integers to enter:-8.lang.: -8 at FileArrayDemo. main(FileArrayDemo. java:22)Program Loop CompletedPlease enter the number of integers to enter:4Please enter the name of the .dat file you want to write to and then read from;xxx. datPlease enter 4 integers:9 -9 12 54The numbers read from the file are:9 -9 12 54Program Loop Completed

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:30
Aconstruction company is creating a powerpoint presentation describing how they calculate costs during each construction step. they plan to email this presentation to clients. the individual clients will be watching the presentation slide show on their own personal computers. what is the most important formatting step the company should take to make the text readable and pleasing to the eye?
Answers: 2
question
Computers and Technology, 22.06.2019 21:30
This graph compares the total cost of attending educational institutions in texas. the graph demonstrates that the cost at private and public technical schools greatly varies.
Answers: 2
question
Computers and Technology, 23.06.2019 03:00
Your business be in google top rank.more the rank more the business leads.for best seo and digital marketing services be confident to contact you can get best seo solutions by assistance experts provide digital marketing, website development, seo expert services and social media internet seo expert services your branding solutions. seo expert services ,best seo expert services,online seo expert services,
Answers: 3
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. sean is a computer programmer. he has programmed an application for toddlers that plays nursery rhymes. however, a logic error has occurred in the program. which problem is a likely consequence of the error? a. the program crashes every time the user wants to play the nursery rhymes. b. the program crosses its buffer boundaries and overwrites an adjacent program. c. the program plays a different nursery rhyme than the one the user intended to play. d. the program shows different structures in its programming language code. e. the program introduces new viruses every time the user plays a nursery rhyme.
Answers: 1
You know the right answer?
Design a class FileArray that has a static method named writeArray. The method should take two argum...
Questions
question
Mathematics, 21.10.2019 20:30
Questions on the website: 13722367