Question: Please help. Access starter source file Billsummary . java and data file energy . txt . The file framework is started for you but the
Please help. Access starter source file Billsummary java and data file energy txt The file
framework is started for you but the file loop, array processing, calculations, and output are
yet to go
Write a program that summarizes the energy bill for this home. You are provided a data file
containing the month, year, and energy usage for a given month for a threeyear period. The
information is randomized. Some example data in the file:
:
Use the method created above to calculate the energy cost for a given month. Then,
summarize the average energy cost per month for that threeyear period. Your output could
looks something like:
Be sure to format the resulting dollar amounts to two decimal places.
import java.io;
import java.util.Scanner;
public class BillSummary
static final String FILENAME "energy.txt;
public static void mainString args
Start file processing
try
String filename FILENAME;
File dataFileRef new Filefilename;
Check for file existence. If not found, display error and crash
if dataFileRef.exists
System.out.printlnFile not found";
System.exit;
Scanner inputFile new ScannerdataFileRef;
File processing loop.
catch IOException e If file error, display message and crash
System.out.printlnFile error";
System.exit;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
