Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 6 : Figure 1 below is the record format for the electricity consumption database. For simplicity, monetary values here have been represented as double,
Question :
Figure below is the record format for the electricity consumption database. For
simplicity, monetary values here have been represented as double, while the
account number, customer name and tariff type are in UTF format:
Figure
For electricity tariff types, the following value rates are used:
You are given the following data Figure :
Figure
and the following class Figure :
Figure
Write a main method that performs the following tasks:
a Create a ElectricCharge array that contains the data in Figure
b Writes using DataOutputStream the contents of that ElectricCharge array to a
file called charges.dat according to the record format in Figure
c Reads back using DatalnputStream the stored ElectricCharge contents in
charges.dat and writes them to the screen as shown in Figure
Figure
The main method should declare that it throws IOException.
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