How eco-friendly are you?

ecoFriendlyIt would not be hot news for you to hear that throughout your everyday life, whatever you do, you are having an impact on the environment. Words like pollution, global warming, carbon dioxide, recycling, energy saving, waste reduction are no mystery to you.

For this challenge you are going to design a quiz that people can take to find out how green or eco-friendly they are. The quiz will consist of eight questions and will be used to give the end-user a score.

Here are the eight questions for the quiz.


  1. How do you come to school?
    • By Car (-50pts)
    • By Bus (-10pts)
    • On Foot (+100pts)
    • Cycling (+100pts)
       
  2. Did you travel by plane in the last 12 months?
    • No (+100pts)
    • Yes once (-25pts)
    • Yes twice (-50pts)
    • At least 3 times (-100pts)
       
  3. Do you use your recycling bins at home?
    • Never (-50pts)
    • Rarely (+10pts)
    • Often (+50pts)
    • Yes every day (+100pts)
       
  4. When you go shopping do you?
    • Bring your own reusable carrier bags (+20pts)
    • Ask for plastic bags (-20pts)
       
  5. At home do you use Energy saving bulbs?
    • Yes (+30pts)
    • No (-30pts)
       
  6. When you clean your teeth, do you let the water run?
    • Yes (-30pts)
    • Sometimes (-10pts)
    • No, never (+20pts)
       
  7. Is your house equipped with solar panels?
    • Yes (+100pts)
    • No (0pt)
       
  8. When it’s getting a bit colder at the end of the summer do you?
    • Put an extra layer on (e.g. jumper, extra blanket) (+50pts)
    • Turn the heater on? (-50pts)
       

At the end of the quiz, the user will be told what is their score and what category they belong to amongst these four categories:

Score Category
Negative score (<0) Amber
Between 0 and 100 Light Green
Between 101 and 200 Emerald Green
Above 200 Deep Green

Let’s get coding


We have started the code for you but only completed the first question. Your task consists of:

  1. Completing the code to ask all seven questions,
  2. Giving the user their final score and the category they belong to (Amber, Light Green, Emerald Green or Deep Green) based on their final score.


unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 4.2 / 5. Vote count: 29

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!

Tagged with: