Suppose that we want to store digitized audio information in a binary file. An audio signal typically does not change much from one sample to the next. In this case, less memory is used if we record the change in the data values instead of the actual data values. We will use this idea in the following program. Write a program StoreSignal that will read positive integers, each of which must be within 127 of the previous integer, from the keyboard (or from a text file, if you prefer). Write the first integer to a binary file. For each subsequent integer, compute the difference between it and the integer before it, cast the difference to a byte, and write the result to the binary file. When a negative integer is encountered, stop writing the file.

What will be an ideal response?


See the code in StoreSignal.java.

Computer Science & Information Technology

You might also like to view...

Which of the following loop statements is guaranteed to iterate the body of the loop at least once?

a) while(control) body; b) do body while(control); c) for (initialize; test; update) body; d) none of the above e) all of the above

Computer Science & Information Technology

Which of the following is NOT true about Facebook events?

A) An event on Facebook is like an item on your personal schedule. B) The best way to find new events is by using the search box in the Facebook Chat window. C) An event can be small and private, like a doctor's appointment, or large and public like a block party. D) You can use events to invite friends to birthday parties, soccer games, or just drinks after class.

Computer Science & Information Technology

The ________ argument has a 255 character limit, just as a Text data type in tables

Fill in the blank(s) with correct word

Computer Science & Information Technology

A(n) ________ is a note or comment placed at the end of a section or a document

Fill in the blank(s) with correct word

Computer Science & Information Technology