Hey,this code passed,but It didn't do what I want. Could you give me ways or advice to fix this and make it better?


#1

var user=prompt("Are you actually going to a programming bootcamp, yes, no, or maybe?").toUpperCase()

switch(answer){

case 'Yes':
   if(user==="yes"){
var money=prompt("You need around 17,000, do you have that amount of money available?yes or no").toUpperCase();

}
else{
console.log("Ok. Well how about you save a little more then,okay?")
}

if(money=="yes"){

var time=prompt("Well, it's also a long process, sometimes three to four months. Do you have the time to commit to something like this?")
}
else
{
console.log("Okay, well....don't quit your dayjob.")
}
if(money==="yes" && time==="yes"){
console.log("Youre good to go. Enjoy!")
}
else {
console.log("Both of those need to be in the right place, so maybe it's not the right time.")
}

break;
case 'No':
console.log("Ok, it's whatever,but make sure you're increasing your skills with other")
break;

case 'Maybe':
  var howAboutMoney=prompt("Well, let me see if I can help. Do you have enough money?yes or no")
  if(undecided==="yes"){
      console.log("Ok, it is expensive, so you will need around 17,000.Having that is a good start.");
  }
  else{
      console.log("You would need to save that much. That's usually a huge deciding factor.");
  }

var howAboutTime=prompt("You'll need to devote time, probably around 3 months, so do you have that amount of time you're willing to dedicate?yes or no")
if(howAboutTime==="yes"){
    console.log("ok, then, it might be a good match because it really does take a lot of concentration.")
}
else {
    console.log("Ok, then dont do it!You absolutely need to be dedicated.")

}

if(howAboutTime==="yes" || howAboutMoney==="yes"){
    console.log("Do it. It's worth it.And waiting too long might pass up a good opportunity.")

}
else{
console.log("I would say don't do it. You need a lot of money and a lot of dedication.")
}

    break;

default:
    console.log("You're not typing in any of the choices; maybe it's because you don't know what a bootcamp is? It's basically an accelerated way to learn how to code.")}

#2

@lemme2001,
What you have written is a confused setup,
maybe you should try to put this in a =flowchart=
= http://www.microsofttraining.net/b/blog/visio-training/list-of-common-visio-shapes/

A corrected code ...but still incomplete... but can be run

var user, answer, money, time;
var howAboutMoney, undecided, howAboutTime;
console.log("\n\n||   Bootcamp   YES =or= NO   ||\n");
var user=prompt(
    "Are you actually going to a programming bootcamp, \n"+
    "yes, no, or maybe?").toLowerCase();
//variable user was always UPPERCASE
answer = user;
switch(answer){
 case 'yes':
   if(user==="yes"){
      var money=prompt(
        "You need around 17,000, \n"+
        "do you have that amount of money available?"+
        "yes or no").toLowerCase();

   }
   else{
      console.log(
          "Ok. Well how about you save a little more then,okay?");
      money="save";
   }
   if(money=="yes"){
       time=prompt(
           "Well, it's also a long process, "+
           "sometimes three to four months. \n"+
           "Do you have the time to commit to something like this?");
   }
   else {
       console.log("Okay, well....don't quit your dayjob.");
   }
   //time will be undefined !!!
   if(money==="yes" && time==="yes"){
        console.log("Youre good to go. Enjoy!");
   }
   else {
        console.log(
            "Both =money= & =time= need to be in the right place, \n"+
            "so maybe it's not the right time.");
   }
   break;
 case 'no':
   console.log(
           "Ok, it's whatever,but make sure you're \n"+
           "increasing your skills with other");
   break;
 case 'maybe':
  howAboutMoney=prompt(
      "Well, let me see if I can help. \n"+
      "Do you have enough money?\tyes or no");
  //undecided ?????      
  if (undecided==="yes") {
      console.log(
          "Ok, it is expensive, \n"+
          "so you will need around 17,000.\n"+
          "Having that is a good start.");
  }
  else {
      console.log(
          "You would need to save that much. \n"+
          "That's usually a huge deciding factor.");
  }

  howAboutTime=prompt(
      "You'll need to devote time, probably around 3 months, \n"+
      "so do you have that amount of time \n"+
      "you're willing to dedicate?yes or no").toLowerCase();
  if(howAboutTime==="yes"){
     console.log(
         "ok, then, it might be a good match because \n"+
         "it really does take a lot of concentration.");
  }
  else {
    console.log(
        "Ok, then dont do it!\n"+
        "You absolutely need to be dedicated.");
  }
  if (howAboutTime==="yes" || howAboutMoney==="yes") {
    console.log(
        "Do it. It's worth it.\n"+
        "And waiting too long might pass up a good opportunity.");
  }
  else{
    console.log(
        "I would say don't do it. \n"+
        "You need a lot of money and a lot of dedication.");
  }
  break;

 default:
    console.log(
        "You're not typing in any of the choices; \n"+
        "maybe it's because you don't know what a bootcamp is? \n"+
        "It's basically an accelerated way to learn how to code.");
 }