Question
Create a new BlueJ Project called: SalesReadProject Copy the sales.txt file from Blackboard into the SalesReadProject Folder. Create a new Class called SalesReadWrite. This is
Create a new BlueJ Project called: SalesReadProject
Copy the sales.txt file from Blackboard into the SalesReadProject Folder.
Create a new Class called SalesReadWrite. This is your main() program.
The SalesReadWrite main() will do the following:
Prompt the user using Scanner to Enter name of sales file to read: .
Read the name of the file entered on keyboard by user.
Open the file (name provided from keyboard, you saved in filename variable) to READ from it using File and Scanner.
In a loop (what type of loop will you choose) Read all the numbers from the file while calculating:
the smallest sale in the entire file.
the largest sale in the entire file.
the total number of sales in file.
NOTE: you will need a variable to keep track of each of these.
When the loop has terminated because it reached the end of the file:
CLOSE the file.
Print TO TERMINAL:
Opening SalesRpt.txt to write output...
Open the SalesRpt.txt file to WRITE to it using PrintWriter.
Print the following TO FILE (SalesRpt.txt):
Number of sales in file: XX
Smallest sale in file: XX.XX
Largest sale in file: XX.XX
After printing To File.CLOSE the file.
Print TO TERMINAL:
Print Done writing to SalesRpt.txt to Terminal.
Print Open up SalesRpt.txt to view output. to Terminal
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started