Your program will read from a file called partyresponsestxt


Your program will read from a file called partyResponses.txt and count the number of people who have accepted and declined the Halloween party invitation. Hard code this file name into your program.

First, check that the file exists. If the file does not exist, tell the user nicely that the file doesn't exist, and quit the program.

If the file exists, your program is going to traverse the contents of the file. It will obtain a series of names and their yes or no response to whether they are going to go to the fun Halloween party. The format of input file is an unknown number of lines with each line containing two tokens: a first name and the word "yes" or "no".

For example:
Raven yes
Ichabod no

You won't know how many lines the input file contains but you can assume that every line will follow this format. You can program your read statements to input two tokens per line. You can also assume that "yes" and "no" will be all lowercase.

As your program traverses through the input file, it should keep track of all the yes answers and all the no answers. Before the program ends, it should print the number of people coming to the party and the number of people who have declined.

A sample input file can be found in Blackboard. This is not the file I will use to grade but it follows the same format.

A sample run: (your output doesn't have to be exactly the same as long as you indicate the number of people coming and the number of people not coming.)

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Your program will read from a file called partyresponsestxt
Reference No:- TGS02392339

Now Priced at $15 (50% Discount)

Recommended (97%)

Rated (4.9/5)