Skip to content
← Back to Community
i get the diner outcome but it says i am still failing
Profile icon
Nevels

/*
You and your friends are on vacation, and the group has to come to a decision about
how to decide where to eat every night, given certain conditions.

If it is raining, or windy, or snowing, you will stay at your house and make dinner, but only
if you have enough vegetables, because Becky is a vegetarian. If there aren't enough vegetables
then you will go to the diner around the corner.

If it is either sunny or overcast, then you will go to a local seafood restaurant. Unless
Susan is with you. Susan hates seafood. Thanks, Susan. We'll just have to eat at a pizza place.

Starting you off with the current conditions today.
*/
const weatherCondition = "windy";
const temperature = "warm";
const weHaveVegetables = false;
const susanIsComing = true;
let whereWeWillEat = ""; // Final value determined by your logic

switch (weatherCondition) {
case "raining":
case "windy": // Fill this in
case "snowing": // Fill this in
if (weatherCondition === "windy","raining","snowing" && weHaveVegetables === true) {
console.log("house")

} else { console.log("diner") } break; case "sunny": case "overcast": if(weatherCondition === "sunny","overcast" && susanIsComing === true) { console.log("seafood restaurant") } else {

console.log("pizza restaurant")
}
}

/*
Possible values are:
1. "house"
2. "diner"
3. "seafood restaurant"
4. "pizza restaurant"
*/
console.log(whereWeWillEat);

Voters
Profile icon
Nevels
Comments
hotnewtop
Profile icon
TimothyBrock

We're Cookin' Up Fresh Seafood! Pungent Dog Seafood Grille and Bar in Boston, MA spends significant time in Fresh New England Seafood arranged customarily enquiry I don't figure I could eat a chicken from this site and realize where it's from, or even a steak, a turkey, or vegetables. They all taste great to me, however, there's nothing particular with regards to them.

Profile icon
DynamicSquid

hmm... case statements seems like an odd choice. I'd just go with if statements

Profile icon
Nevels

the assignment has us doing case statements
@DynamicSquid

Profile icon
DynamicSquid

@Nevels try reviewing case statements before you move on, like this doesn't make any sense:

case "snowing": // it's already snowing, but you're checking to see if it's windy? if (weatherCondition === "windy","raining","snowing" && weHaveVegetables === true) { console.log("house") }

it's a good start though. just read the instructions very carefully, and don't forget to put breaks

Profile icon
Nevels

thank you will do @DynamicSquid

Profile icon
DynamicSquid

@Nevels yup np