diff --git a/ifStatement.js b/ifStatement.js index a1c9316..5efe5ad 100644 --- a/ifStatement.js +++ b/ifStatement.js @@ -13,7 +13,14 @@ Note: You can change the value of the age variable to test different cases. If the person's age is less than the minimum driving age, nothing will be printed. ************************************************************************************************/ // TODO: ADD YOUR CODE BELOW - +// let userage=21 +// age=18 +// if (userage>age) {console.log("the person is old enough to drive.") + +// } +// else{ +// console.log("not lu to drive") +// } /************************************************************************************************ Task 2 (if..else Statement): Create a program that checks if a person is an admin, using just if...else statement. @@ -32,7 +39,16 @@ Steps: - If both conditions are true, print the message Hello ${username}, and you have permission to access the restricted area. - If either of the conditions is false, print the message Hello ${userName}, I'm sorry but it seems you're not authorized to access the restricted area. ***********************************************************/ -// TODO: ADD YOUR CODE BELOW +// // TODO: ADD YOUR CODE BELOW +// let userName="gg"; let rol="admin"; +// let enteruserName=prompt('enter usname') +// if (userName==enteruserName&&rol=="admin") { +// console.log (`hello ${userName}`) +// } +// else { +// console.log( "I'm sorry but it seems you're not authorized to access the restricted area." ); + +// } /************************************************************************************************ Task 3 (if..else Statement): @@ -48,6 +64,21 @@ Steps: ************************************************************************************************/ // TODO: ADD YOUR CODE BELOW + +// let usernumbert =prompt('enter num') + +// let persdnumber=parseInt(usernumbert); +// if (persdnumber>0) {console.log("positive") + +// } +// else if (persdnumber<0) { + +// console.log("nig") +// } +// else{ console.log("zero") + +// } + /************************************************************************************************* Task 4 (if..else Statement): @@ -59,6 +90,23 @@ Steps: - If the user is younger than 18, the program should calculate how many years are left until they turn 18 and print the message "You will be eligible to vote in X years", where X is the number of years left. ************************************************************************************************/ // TODO: ADD YOUR CODE BELOW +// let ageuser=prompt("enter age") + +// if (ageuser >= 18 ) +// { +// let isregister=confirm("are u reg to vote") +// if (isregister) { +// console.log("ou still have time to register to vote."); +// }else{ +// console.log("Great! You are all set to vote."); +// } + + +// } + + + + /************************************************************************************************* Task 5 (if..else Statement): @@ -122,3 +170,4 @@ Steps: - Use the toFixed() method to format the totalCost to 2 decimal places. *************************************************************************************************/ // TODO: ADD YOUR CODE BELOW + diff --git a/index.html b/index.html index 23aecb3..6f13e47 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ Conditionals - + diff --git a/switchStatement.js b/switchStatement.js index b403ed9..5af1635 100644 --- a/switchStatement.js +++ b/switchStatement.js @@ -17,6 +17,73 @@ Steps: Note: Check the file called "Clothing_Recommendations.md" to find the list of weather forecasts and their corresponding clothing recommendations ************************************************************************************************/ // TODO: ADD YOUR CODE BELOW +let sign = prompt( + "Please enter zodiac sign and find out what the future holds:" +).toLowerCase(); + +switch (sign) { + case "gemini": + console.log( + "u have a bad luck and u mom die") + break; + case "cancer": + console.log( + "You literally have pancreatic cancer." + ); + break; + case "aries": + console.log( + "u lost alot mony cause u loser ^^." + ); + break; + case "taurus": + console.log( + "You may die." + ); + break; + case "scorpio": + console.log("u bestfriend die "); + + break; + case "virgo": + console.log( + "Your pet gets smash over by a car." + ); + break; + case "libra": + console.log( + "Bad day and suffer from misery and frustration and lose passion." + ); + break; + case "leo": + console.log( + "balabla i don't believe in it." + ); + break; + case "sagittarius": + console.log( + "blalblal bad luck forever." + ); + break; + case "capricorn": + console.log( + "u happy foerver" + ); + break; + case "aquarius": + console.log( + " lol." + ); + break; + case "pisces": + console.log( + "good luck and be fine." + ); + break; + default: + console.log("GET OUT OFF HERE, we do not have a horoscope for that sign."); +} + /************************************************************************************************ Task 6 (Switch Statement): @@ -36,3 +103,21 @@ Example: - Recommendations: Wear sunscreen, a hat, and sunglasses. ************************************************************************************************/ // TODO: ADD YOUR CODE BELOW +let weather=prompt( "What's the weather forecast for today? ") +switch(weather){ + case "sunny": + console.log("Choose lightweight cotton, linen, rayon, chambray, or silk fabrics for breathability and comfort.") + break; + case "Rainy": + console.log("Choose waterproof or water-resistant fabrics like polyester, nylon, or Gore-Tex for maximum protectio") + break; + case "Cloudy": + console.log("Layer with lightweight knits, fleece, or flannel for easy adjustment to changing temperatures.") + break + case"Snowy": + console.log("nsulating fabrics like fleece, down, or synthetic insulation for warmth." ); + + break; +} + +