Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Twenty students were asked to rate on a scale of 1 to 5 the quality of the food in the student cafeteria, with 1

      

Twenty students were asked to rate on a scale of 1 to 5 the quality of the food in the student cafeteria, with 1 being "awful" and 5 being "excellent." The 20 responses are stored in "numbers.txt" file. Read the responses from "numbers.txt" file, determine the frequency of each rating and output it to the text file "output.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". Use a PrintWriter to create a file called "output.txt". Each integer should be written using method printf. Use FileNotFoundException and NoSuchElementException Exceptions. Sample input and output are shown in the below table. numbers.txt 31253322332143144533 output.txt Rating Frequency 1 3 48 32 2345 5

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essentials Of Services Marketing

Authors: Jochen Wirtz

4th Edition

1292425199, 9781292425191

More Books

Students also viewed these Programming questions