Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(In Java)Project 1: Reading and writing primitives In this project, you will read and write numbers from and to a binary file, first using output

(In Java)Project 1: Reading and writing primitives

In this project, you will read and write numbers from and to a binary file, first using output and input streams, then using a random-access file

Step 1: Using an ObjectOutputStream:

  • Delete any existing file(s) left over from prior runs.
  • Open, then write 10 randomly-generated numbers with values between 1 and 10 onto the file, then close the file.
  • Open the file using an ObjectInputStream and read the numbers into an array of the appropriate data type.
  • Write a method which takes as a parameter an array of numbers of the data type you are using. This method should sort the array in ascending order using a Selection, Insertion, or Bubble sort algorithm, again your choice. Invoke this method on the array of numbers (putting them in ascending order).

Do not use any sort method provided by Java (e.g., Arrays.sort()

  • Once sorted, display the 10 numbers on the console in sorted order.

Step 2: Do the same thing using a Random Access file.

  • In this step, do not close and then reopen the file. Instead, just reset the file pointer back to the beginning of the file after writing the 10 random numbers.

Submit a listing of your program and a PrintScreen showing the output of both steps above.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 22nd International Conference Dexa 2011 Toulouse France August/September 2011 Proceedings Part 1 Lncs 6860

Authors: Abdelkader Hameurlain ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2011th Edition

3642230873, 978-3642230875

More Books

Students also viewed these Databases questions

Question

Q Why are Delta-star-Transformers used for lighting loads?

Answered: 1 week ago