Skip to content

Instantly share code, notes, and snippets.

@avermeulen
Forked from Unalo/Electricity-app.md
Last active January 18, 2022 13:05
Show Gist options
  • Save avermeulen/fc906ad5087f27e664ccecae2ed3d476 to your computer and use it in GitHub Desktop.
Save avermeulen/fc906ad5087f27e664ccecae2ed3d476 to your computer and use it in GitHub Desktop.

Elastic Electricity App

Create a web app, to help your local Municipality to track electricity usage per household. Each month the Municipality gives each household's 50 units each for free. Households can topup if they need extra electricity.

As you use appliances, your units will drop accordingly.

If the units per household is equal or below 30, add a class warning into your current units.

In your app you must have the following.

  • Allow user to top up a meter's balance. (update with where)

  • Capture the electricity usage for a given day. ()

  • Show electricity usage, by appliance. Select the appliance from a dropdown an and the total usage for that appliance.

  • show all the meters with a balance higher than 30

  • show all the meters with a balance less than 30

  • Show a list of all the streets

  • Show the number of meters in a given street.

  • Show the total usage of all the meters in a street

  • Show the total usage for all the households. (group by + )

  • Show the total usage for a given street (5 Houses makes a street)

  • Calculate the lowest usage per house in a street. (group by + sum + order by)

  • Calculate the highest usage per street (group by + sum + order by)

Used appliances

Use drop-down or Checkboxes to display your appliances

name rate
Stove 4.5 units
Tv 2.0 units
Heater 1.5 units
Fridge 4.0 units
Kettle 1.8 units

Database setup

Household

id address meter_number street_id (fk) balance

Street

id name

Appliances

id name rate

Factory Functions

Function name Description
getCurrentUnits return the current units for a household
buyElectricity buy electricity for a household - use id as meter number
findHighestElectricityUsed Find the highest electricity used
findLowestElectricityUsed Find the lowest electricity used
findAvarageElectricityUsed Find average electricity used
useTeriff allow a house to use electricity - use appliances
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment