Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For the unit 3 assignment, you must develop a program that reads the file I cream.dat. This file is supplied in the Files for Unit

For the unit 3 assignment, you must develop a program that reads the file I cream.dat. This file is supplied in the Files for Unit 3 Assignment directory in Unit 3. You must use TextIO methods to read the file. As you read the file, count the number of ice cream cones that were sold. (This is the same as the number of lines that you read from the file.) Also count the number of Strawberry comes that were sold.
At the end of the program, print out the total number of cones, the number of Strawberry cones, and the percentage of cones that were Strawberry.
Note: To do this program, you have to know when to stop reading the file. TextIO has a function named TextIO.eof to check whether the entire file has been read. The value of this function is true if the entire file has been read. The value is false if there is more data in the file. You want to continue reading from the file as long as TextIO.eof() is false.
Note: suppose that flavor is a variable of type String and you want to test whether its value is Strawberry. To do this, test whether flavor.equals(Strawberry). (Do not use == to test for equality of strings.)
Each line of the file icecream.dat is an ice cream flavor such as Vanilla or Strawberry. A line represents the sale of one ice cream cone of the given flavor.
You must complete your program, test, bug, and execute it. You must submit your java code file. The output of your program must be captured by either copying the content in the output window and pasting it into a text document that you submit along with your java code file, or by capturing the image of the screen which contains the output of your java program. image text in transcribed
image text in transcribed
Submission phase F1 77 88 9 0 Q W ER R T U O P A SDF G HJ K L

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

Logic In Databases International Workshop Lid 96 San Miniato Italy July 1 2 1996 Proceedings Lncs 1154

Authors: Dino Pedreschi ,Carlo Zaniolo

1st Edition

3540618147, 978-3540618140

More Books

Students also viewed these Databases questions

Question

=+appointed government officials or someone else?

Answered: 1 week ago