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

  How to detect the correct ip address and run it locally

When you compile the two modules, with disabling the package statement, it runs on one single machine, that's running the server

  Demonstrates conditions under which the compareto() method

Write an application that demonstrates conditions under which the compareTo() method retrun a positive number, a negative number, and a zero when used to compare two Strings, Save the file as CompareStringValues.java. Lab Assignment

  Discuss how contrast and conformity contribute to a quality

Discuss how contrast and conformity contribute to a quality web page

  Write a java program to compute salary

Write a Java program which computes the Salary for a given number of employees. The program prompts user to enter n the number of employees.

  Creates an array of six divsales objects

Write a program that creates an array of six DivSales objects. The program should ask the user to enter the sales for four quarters for each division.

  Write java program to reads ten values from user

Write the java program which reads 10 values from user and store them in 1 daimantion array. your program will ask the user wich operation he wants to perform:

  Number of space characters in a string

Write a loop that counts the number of space characters in a string - You need to implement a program to find the number of spaces.

  Write a program to convert kilograms into pounds

Write a program that prompts the user to enter the mass of a person in kilograms and outputs the equivalent weight in pounds. Output both the mass and the weight rounded to two decimal places.

  Develop a java program that simulates the queues in a bank

Develop a java program that simulates the queues in a bank. Implement the event-driven simulation of a bank. A queue of arrival events will represent the line of customers in the bank.

  You have in your program an arraylist which contains

you have in your program an arraylist that contains employee salaries double type in arbitrary order. you need to

  Promgraming 1 1 there are many different concepts

1. 1 there are many different concepts associated with oop object-oriented programming like class

  Calculate and display the total retail value of all products

Your application must calculate and display the total retail value of all products sold after all five pairs of inputs are completed - Write a Java application that prompts the user for pairs of inputs of a product number

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