Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 51 additions & 2 deletions ifStatement.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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):
Expand All @@ -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):

Expand All @@ -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):
Expand Down Expand Up @@ -122,3 +170,4 @@ Steps:
- Use the toFixed() method to format the totalCost to 2 decimal places.
*************************************************************************************************/
// TODO: ADD YOUR CODE BELOW

2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<title>Conditionals</title>
</head>
<body>
<script src="./ifStatement.js"></script>
<script src="switchStatement.js"></script>
<!-- <script src="./switchStatement.js"></script> -->
</body>
</html>
85 changes: 85 additions & 0 deletions switchStatement.js
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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;
}