Coder Social home page Coder Social logo

compound-operators-practice's Introduction

๐Ÿ‹๐Ÿฝโ€โ™‚๏ธ COMPOUND OPERATORS CARDIO ๐Ÿ‹๐Ÿฝโ€โ™€๏ธ

Let's do some conditional statements and compound operators cardio!

GOAL: On the script.js file you will see 6 challenges that you need to complete for today. These challenges ask you to use some combination of conditional (if/else if/else) statements and compound operators (&&, ||, `!'). Completing all 6 of these practice problems today will help you to lock in this core programming structure that we will utilize throughout the rest of this course!

TASKS FOR TODAY

Open the script.js file to see all of the directions for today. To get user input, you should utilize the prompt() command. An example of this is shown below:

//Ask the user for their name and save the value in the variable name
var name = prompt("What is your name?");
  1. Ask the user to input a temperature. Return the following message based on the input
Temperature Output

100 | Tell them it's too hot to go outside | 80 - 100 | Tell them to bring a water bottle to stay hydrated| 60 - 80 | Tell them to bring a water bottle to stay hydrated| Less than 60 | Tell them to bring a jacket |

  1. The MTA is switching to charging based on how far you travel rather than a flat fare (similar to how DC is). Ask the user to input how many stops they will be traveling and print out the price based on the following guidelines.
Number of Stops Output
0 - 5 $1.50
5 - 15 $2.50
15 - 20 $3.00
20 $3.50
  1. Uncomment the lines under #3 on script.js. If the day of the week is Thursday AND they are younger than 18, tell them that they get free admission to the museum. Otherwise, tell them they need to pay the full price of admission.

  2. You are applying for a scholarship. The scholarship requires that you have above a 3.0 GPA and above a 1100 on the SAT. Write a program that: (a) Asks the user for their GPA (b) Ask the user for their SAT score (c) Prints out (1) "You can apply!" if they meet both requirements, (2) prints out "increase your GPA" if they are just missing the GPA requirement, (3) prints out "increase your SAT score" if they are just missing the SAT requirement, and (4) prints out "increase GPA and SAT" if they are missing both requirements.

  3. Ask the user to put in the current temperature. Ask them also to put in the current weather (e.g. sunny, rainiy, snowing, etc). If it is below 30 degrees or it is snowing, tell them they need to bring warm clothing today. If it is below 50 degrees or it is raining, tell tem to wear a jacket. Otherwise, tell them that it looks like a good day outside.

  4. Ask the user the day of the week and their age (you can use a previous age variable if you prefer). If it is Saturday or Sunday and they are a teenager, tell them they can sleep in. If it is not Saturday or Sunday (i.e. it's a school day) and they are a teenager, tell them to go to school. If they are not a teenager and it is not a weekend, tell them to go to work.

compound-operators-practice's People

Contributors

slance22 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.