Explain the concept of files and streams

Assignment Help JAVA Programming
Reference no: EM13942435

742 Chapter 14 Files and Streams

14.12 (Telephone-Number Word Generator) Standard telephone keypads contain the digits area through through nine. The numbers two through nine each have three letters associated with them (Fig. 14.43). Many people find it difficult to memorize phone numbers. so they use the correspon¬dence between digits and letters to develop seven-letter words that correspond to their phone mute bers. For example, a person whose telephone number is 686-2377 might use the correspondence indicated in Fig. 14.43 to develop the seven,letter word "NUMBERS." Every seven-letter word car-responds to exactly one seven-digit telephone number. A restaurant wishing to increase its takeout business could surely do so with the number 825-3688 (i.e., "TAKEOUT").

Every seven-letter phone number corresponds to many different seven-letter words. Unforte. nately, most of these words represent unrecognizable juxtapositions of letters. It is possible, how¬ever, that the owner of a barbershop would be pleased to know that the shop's telephone number, 424-7288, corresponds to "HAIRCUT." The owner of a liquor store would, no doubt. be delighted to find that the store's number. 233-7226, corresponds to "BEERCAN." A veterinarian with the phone number 738-2273 would be pleased to know that the number corresponds to the letters "PETCARE." An automotive dealership would be pleased to know that the dealership num¬ber, 639-2277, corresponds to "NEWCARS."
Write a program that, given a seven-digit number, uses a PrintStream object to write to a file every possible seven-letter word combination corresponding to that number. There are 2.187 (3') such combinations. Avoid phone numbers with the digits 0 and

at 13 (Student Poll) Figure 7.8 contains an array of survey responses that is hard coded into ill program. Suppose we wish to process survey results that are stored in a file. This exercise minim two separate programs. First, create an application that prompts the user for survey responses and outputs each response to a file. Use a Formatter to create a file called numbers.txt. Each integer should be written using method format. Then modify the program in Fig. 7.8 to read the survey responses from numbers . txt. The responses should be read from the file by using a Scanner. Meth¬od nextint should be used to input one integer at a time from the file. The program should con tinue to read responses until it reaches the end of file. The results should be output to the text file "output .txt".

Modify Exercise 1 1 . 18 to allow the user to save a drawing into a file or load a priordrawin& from a file using object serialization. Add buttons Load (to read objects from a file), Save (to write objects to a file) and Generate Shapes (to display a random set of shapes on the screen). Use an ObjectOutputStream to write to the file and an ObjectinputStream to read from the file, Write the array of MyShape objects using method writeObject (class ObjectOutputSt ream), and read the array

310_kk.png

Reference no: EM13942435

Questions Cloud

Details of at least two organisations using erp systems : Your explanation should include definitions and details of at least two organisations using ERP systems and the benefits they achieved.
Use of sdlc and agile development approaches : Compare the use of SDLC and agile development approaches. Justify your choice of your selected approach to systems development.
Topic-king abdullah scholarship program : Specific Purpose: To inform to the audience about king Abdullah scholarship programand what are the goals of it.
Explore and summarize the cereals.xls dataset : For each of the 16 variables in the dataset, state whether the variable is categorical (qualitative) or numerical (quantitative).For categorical variables, state whether the variable is nominal or ordinal.
Explain the concept of files and streams : Every seven-letter phone number corresponds to many different seven-letter words. Unforte. nately, most of these words represent unrecognizable juxtapositions of letters.
Analyse what meant by moral values in mid-victorian britain : 'Victorian moral values were shared by all.' Analyse what was meant by 'moral values' in mid-Victorian Britain, with particular reference to the lives of the working classes.
Analyse the contributions of the early greeks : Legal Theory 1000 word Essay Answer one of the following three questions 1. Analyse the contributions of the early Greeks, the Romans and the early Christians to the concept of natural law and natural rights.
Why is a logical linear sequence useful : Why is it logical to write test items or assessments before producing instructional strategies? Why is a logical linear sequence useful, even though in practice instructional design components may be more concurrent
The chapter and reflecting on the information : 1. After reading the chapter and reflecting on the information, what are three influential factors from your childhood environment that helped to shape who you are today? What are three important biological or genetic traits that helped to shape who ..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Program to replace a number with the new one

It will return a value of 42 at the point of call, because the first value of 21 in x gets overwritten by the new value 42

  Add a button that will read the text fields

Create a GUI with two text fields for inputting the dimensions of a rectangle. Identify these two text fields as Length and Width with labels. Add a button that will read the text fields and cause the GUI to display the area and perimeter of the r..

  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 java code to read integers from an input file

write java code to read integers from an input file and write only the odd numbers to an output file. the two file names will be provided on the command line as the input file followed by the output file.

  Write a java method delete(key1, key2) to delete

1. Write a Java method delete(key1, key2) to delete all records with keys between key1 and key2 (inclusive) from a binary search tree.

  This project mainly focuses on explaining your

this project focuses on demonstrating your understanding of java collections. before attempting this project be sure

  Elements in a two-dimensional array

Write a value-returning method that returns the number of columns with n elements in a two-dimensional array of chars, where n is a parameter of the method. Include code to test your method.

  Minimal spanning tree decreasing edge

minimal spanning tree decreasing edge dismissalreverse-delete algorithm. develop an implementation that computes the

  Graphics program that draws 12 strings

Write a graphics program that draws 12 strings, one each for the 12 standard colors, besides Color.WHITE, each in its own color. Provide a class ColorNameViewer and a class ColorNameComponent.

  Design and implement an applet that plays a simple game

Design and implement an Applet that plays a simple game to help teach a child to read. The game displays a picture on the left hand side of the Applet and a word on the right hand side. Below the pictures are two buttons for the child to click--on..

  Describe an application that can deadlock

Describe an application that can deadlock, or starve a thread.

  Statement that creates and initializes a static variable

Write a statement that creates and initializes a static variable named salesTax to 7.59. Write a statement that creates a constant variable named TAX_RATE. The tax rate is 8.25%

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