0% found this document useful (0 votes)
52 views1 page

Java IO Assignment

This document contains instructions for two programs. The first program prompts a user for survey responses, writes each response to a file called "numbers.txt" using a Formatter, and then reads the responses from that file using a Scanner and writes the output to "output.txt". The second program takes a four-digit number as input, uses a PrintStream to write every possible seven-letter word combination corresponding to that number's digits to a file, avoiding combinations with 0 or 1.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views1 page

Java IO Assignment

This document contains instructions for two programs. The first program prompts a user for survey responses, writes each response to a file called "numbers.txt" using a Formatter, and then reads the responses from that file using a Scanner and writes the output to "output.txt". The second program takes a four-digit number as input, uses a PrintStream to write every possible seven-letter word combination corresponding to that number's digits to a file, avoiding combinations with 0 or 1.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 1

1.Suppose we wish to process survey results that are stored in a file. This exercise requires 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 write a program to read the survey responses from
numbers.txt . The responses should be read from the file by using a Scanner . Use method nextInt to
input one integer at a time from the file. The program should continue to read responses until it
reaches the end of the file. The results should be output to the text file "output.txt" .

2.Write a program that, given a four-digit number, uses a PrintStream object to write to a file
every possible seven-letter word combination corresponding to that number. There are 81
such combinations. Avoid phone numbers with the digits 0 and 1.

You might also like