a. Write a function read that reads the electricity information (Meter No, ĶillowattHours, Current Reading, and Previous Reading) from the user input and stores them in the different arrays. Update your main function to call the function read.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

code in c++

Write a C+ program that helps the electricity company to manage users’ electricity
information. You need to define 5 1D arrays to save users' info, as follows:
CurrentReading PreviousReading ElectricityTotal(AED)
MeterNo kWh
64560 | 665
15677 | 234
32675 567
123
345
To be calculated
124
123
To be calculated
125
298
To be calculated
where
int MeterNo[3] represents the meter number.
double KillowattHours[3] represents the meter reading in kWh.
double ÇurrentReading[3] represents the current meter reading.
double PrevieusBeading[3] represents the previous meter reading.
double ElectricityTotal[3] represents the total meter reading.
Write a function read that reads the electricity information (Meter No, KillowattHours,
Current Reading, and Previous Reading) from the user input and stores them in the
different arrays. Update your main function to call the function read.
a.
Function prototype:
void read(int meterNo[], double killowattHours[], double
currentReading[], double previousReading, int size)
b. Write a function totals that calculates the total price in AED per meter and saves
them into the ElectricityTotal array, where Customer pay 8.29 fils per kWh. You
may use this equation to calculate the total:
Total = (currentReading-previousReading)* (fils per kWh)
Update the main function to call the function totals.
Function prototype:
void totals(double currentReading[], double previousReading[],
double ElectricityTotal[], int size)
c. Write a function sort that sorts users' information in descending order based on the
total value, as follows: (No need to print the info on the screen)
Transcribed Image Text:Write a C+ program that helps the electricity company to manage users’ electricity information. You need to define 5 1D arrays to save users' info, as follows: CurrentReading PreviousReading ElectricityTotal(AED) MeterNo kWh 64560 | 665 15677 | 234 32675 567 123 345 To be calculated 124 123 To be calculated 125 298 To be calculated where int MeterNo[3] represents the meter number. double KillowattHours[3] represents the meter reading in kWh. double ÇurrentReading[3] represents the current meter reading. double PrevieusBeading[3] represents the previous meter reading. double ElectricityTotal[3] represents the total meter reading. Write a function read that reads the electricity information (Meter No, KillowattHours, Current Reading, and Previous Reading) from the user input and stores them in the different arrays. Update your main function to call the function read. a. Function prototype: void read(int meterNo[], double killowattHours[], double currentReading[], double previousReading, int size) b. Write a function totals that calculates the total price in AED per meter and saves them into the ElectricityTotal array, where Customer pay 8.29 fils per kWh. You may use this equation to calculate the total: Total = (currentReading-previousReading)* (fils per kWh) Update the main function to call the function totals. Function prototype: void totals(double currentReading[], double previousReading[], double ElectricityTotal[], int size) c. Write a function sort that sorts users' information in descending order based on the total value, as follows: (No need to print the info on the screen)
Write a C+ program that helps the electricity company to manage users’ electricity
information. You need to define 5 1D arrays to save users' info, as follows:
CurrentReading PreviousReading ElectricityTotal(AED)
MeterNo kWh
64560 | 665
15677 | 234
32675 567
123
345
To be calculated
124
123
To be calculated
125
298
To be calculated
where
int MeterNo[3] represents the meter number.
double KillowattHours[3] represents the meter reading in kWh.
double ÇurrentReading[3] represents the current meter reading.
double PrevieusBeading[3] represents the previous meter reading.
double ElectricityTotal[3] represents the total meter reading.
Write a function read that reads the electricity information (Meter No, KillowattHours,
Current Reading, and Previous Reading) from the user input and stores them in the
different arrays. Update your main function to call the function read.
a.
Function prototype:
void read(int meterNo[], double killowattHours[], double
currentReading[], double previousReading, int size)
b. Write a function totals that calculates the total price in AED per meter and saves
them into the ElectricityTotal array, where Customer pay 8.29 fils per kWh. You
may use this equation to calculate the total:
Total = (currentReading-previousReading)* (fils per kWh)
Update the main function to call the function totals.
Function prototype:
void totals(double currentReading[], double previousReading[],
double ElectricityTotal[], int size)
c. Write a function sort that sorts users' information in descending order based on the
total value, as follows: (No need to print the info on the screen)
Transcribed Image Text:Write a C+ program that helps the electricity company to manage users’ electricity information. You need to define 5 1D arrays to save users' info, as follows: CurrentReading PreviousReading ElectricityTotal(AED) MeterNo kWh 64560 | 665 15677 | 234 32675 567 123 345 To be calculated 124 123 To be calculated 125 298 To be calculated where int MeterNo[3] represents the meter number. double KillowattHours[3] represents the meter reading in kWh. double ÇurrentReading[3] represents the current meter reading. double PrevieusBeading[3] represents the previous meter reading. double ElectricityTotal[3] represents the total meter reading. Write a function read that reads the electricity information (Meter No, KillowattHours, Current Reading, and Previous Reading) from the user input and stores them in the different arrays. Update your main function to call the function read. a. Function prototype: void read(int meterNo[], double killowattHours[], double currentReading[], double previousReading, int size) b. Write a function totals that calculates the total price in AED per meter and saves them into the ElectricityTotal array, where Customer pay 8.29 fils per kWh. You may use this equation to calculate the total: Total = (currentReading-previousReading)* (fils per kWh) Update the main function to call the function totals. Function prototype: void totals(double currentReading[], double previousReading[], double ElectricityTotal[], int size) c. Write a function sort that sorts users' information in descending order based on the total value, as follows: (No need to print the info on the screen)
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education