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

  Implement a method with three arguments

Implement a method with three arguments: a graph, a starting vertex number, and an ending vertex number. The method determines whether there is a directed path from the starting vertex to the ending vertex.

  Write a program to register students for a college

Students have names, addresses and courses. Implement the interface class RegisterStudent. RegisterStudent has one method, public boolean register, which returns the boolean value of true or false if the student is successfully registered for the ..

  Prevent clear communication

Conversational implicature always prevents clear communication - Describe a situation where communication between you and a co-worker

  Pass in the number of gallons on board

public float usefulLoad() // this is the grossWeight - emptyWeight public float usefulLoadWithFuel( in gallons ) // this is the useful load - gallons x 6. The programmer user will pass in the number of gallons on board.

  Write a java class that reads through a text file

You will write a Java class that reads through a text file of drawing commands and draws the appropriate shapes onto JFrames

  Application that calculates and displays the total payable

Write a java application that calculates and displays the total payable after applying discount on online grocery orders for N customers. The N should be set as a constant (final) in your application and choose a value between 7 and 9.

  Javas drawing capabilities

This week, we will be learning to use some of Java's drawing capabilities. The Graphics class provides methods for drawing many different shapes, using different colors, and for drawing strings using different fonts.

  Discuss how contrast and conformity contribute to a quality

Discuss how contrast and conformity contribute to a quality web page

  Java class library with thousands of predefined classes

The Java Application Programming Interface is a Java class library with thousands of predefined classes

  What are mobile oss you have personally used explain the

write a 200- to 300-word short-answer response to the following bull what are mobile oss you have personally used?

  Convert the while loop in the following code segment

Convert the while loop in the following code segment to a do-while loop

  The ai player will not be asking

The AI player will not be asking the user for any input. This means that placeShips() and fire() should not ask the user for locations. The AI player should choose locations of ships and automatically place them

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