Untitled

 avatar
unknown
plain_text
4 months ago
5.6 kB
3
Indexable
var name;
var weather;
var mainActivity;
var budget = 1500;

onEvent("nameInput", "change", function() {
  name = getText("nameInput"); 
});

onEvent("weatherInput", "click", function() {
  weather = getText("weatherInput"); 
});

onEvent("activites", "click", function() {
  mainActivity = getText("activites"); 
});

onEvent("budgetInput", "change", function() {
  budget = getNumber("budgetInput"); 
});

onEvent("resultDisplay", "click", function() {
  updateScreen();
});

function updateScreen() {
  if (weather == "Cold") {
    if (mainActivity == "Relaxation") {
      if (budget >= 3000) {
        setText("recBox", "Hello! "+ name + " A great travel spot would be "+ "Switzerland: Stay at a cozy mountain resort in the Alps with spa treatments and skiing.");
      } else {
        setText("recBox", "Hello! "+ name + " A great travel spot would be "+"Norway: Stay at a winter lodge with views of the Northern Lights and fjords.");
      }
    } else {
      if (mainActivity == "Sightseeing") {
        if (budget >= 1500) {
          setText("recBox", "Hello! "+ name + " A great travel spot would be "+ "Lapland, Finland : Visit Santa Claus Village, go snowmobiling, and explore the stunning winter landscapes.");
        } else {
          setText("recBox", "Hello! "+ name + " A great travel spot would be "+"Edinburgh, Scotland (Budget: $500–$1500): Explore medieval castles, stroll through old towns, and discover the rich history of Scotland.");
        }
      } else {
        if (mainActivity == "Exploring Culture") {
          if (budget >= 1500) {
            setText("recBox", "Hello! "+ name + " A great travel spot would be "+"St. Petersburg, Russia: Immerse yourself in art, history, and culture, from the Hermitage Museum to the Russian ballet.");
          } else {
            setText("recBox", "Quebec City, Canada: Explore French colonial architecture, museums, and unique festivals.");
          }
        } else {
          if (budget >= 1500) {
            setText("recBox", "Hello! "+ name + " A great travel spot would be "+"Banff National Park, Canada: Hike and enjoy winter sports surrounded by beautiful snow-capped mountains.");
          } else {
            setText("recBox", "Hello! "+ name + " A great travel spot would be "+"Iceland: Explore glaciers, volcanoes, and waterfalls while staying in remote lodges.");
          }
        }
      }
    }
  } else if (weather == "Warm") {
    if (mainActivity == "Relaxation") {
      if (budget >= 3000) {
        setText("recBox", "Hello! "+ name + " A great travel spot would be "+"Maldives: Stay in an over-water bungalow and enjoy private beaches and crystal-clear water.");
      } else {
        setText("recBox", "Hello! "+ name + " A great travel spot would be "+"Bali, Indonesia: Relax in a luxury resort with beach access, yoga retreats, and wellness spas.");
      }
    } else if (mainActivity == "Sightseeing") {
      if (budget >= 1500) {
        setText("recBox", "Hello! "+ name + " A great travel spot would be "+"Rome, Italy: Visit ancient landmarks like the Colosseum, the Pantheon, and Vatican City.");
      } else {
        setText("recBox", "Hello! "+ name + " A great travel spot would be "+"London, UK: Enjoy iconic sights like Big Ben, the Tower of London, and Buckingham Palace.");
      }
    } else if (mainActivity == "Exploring Culture") {
      if (budget >= 1500) {
        setText("recBox", "Hello! "+ name + " A great travel spot would be "+"Kyoto, Japan: Immerse yourself in traditional Japanese culture, visiting temples, tea houses, and attending tea ceremonies.");
      } else {
        setText("recBox", "Hello! "+ name + " A great travel spot would be "+"Mexico City, Mexico: Explore rich cultural experiences like ancient ruins (Teotihuacan), Frida Kahlo’s house, and world-class museums.");
      }
    } else {
      setText("recBox", "Hello! "+ name + " A great travel spot would be "+"Patagonia, Argentina/Chile: Trek through beautiful national parks like Torres del Paine, with glaciers and rugged mountains.");
    }
  } else {
    if (mainActivity == "Relaxation") {
      if (budget >= 3000) {
        setText("recBox", "Hello! "+ name + " A great travel spot would be "+"Dubai, UAE: Stay at ultra-luxurious resorts with private beaches, spas, and world-class shopping.");
      } else {
        setText("recBox", "Hello! "+ name + " A great travel spot would be "+"Mauritius: Spend your days on tropical beaches, enjoying all-inclusive resorts with luxury spas.");
      }
    } else if (mainActivity == "Sightseeing") {
      if (budget >= 1500) {
        setText("recBox", "Hello! "+ name + " A great travel spot would be "+"Cairo, Egypt: Visit the Pyramids of Giza, the Sphinx, and the Egyptian Museum.");
      } else {
        setText("recBox", "Hello! "+ name + " A great travel spot would be "+"Jerusalem, Israel: Visit historic and religious landmarks like the Western Wall, the Dome of the Rock, and the Church of the Holy Sepulchre.");
      }
    } else if (mainActivity == "Exploring Culture") {
      if (budget >= 1500) {
        setText("recBox", "Hello!"+ name + " A great travel spot would be "+"Petra, Jordan: Explore the ancient city carved into the rock, including the Treasury and the Monastery.");
      } else {
        setText("recBox", "Hello! "+ name + " A great travel spot would be "+"Delhi, India: Visit vibrant markets, ancient temples, and iconic landmarks like the Taj Mahal.");
      }
    } else {
      setText("recBox", "Hello! "+ name + " A great travel spot would be "+"Australia Outback: Explore the rugged landscapes of Uluru and Kings Canyon.");
    }
  }
}
Editor is loading...
Leave a Comment