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
90 changes: 90 additions & 0 deletions ifStatement.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ Note:
************************************************************************************************/
// TODO: ADD YOUR CODE BELOW

// let userAge = 15;
// let minimumDrivingAge = 18;
// if (userAge >= minimumDrivingAge) {
// console.log("youCanDrivingNow");
// }else {console.log("بعدك طفل اهلك يدرون بيك هنا");}

/************************************************************************************************
Task 2 (if..else Statement):
Create a program that checks if a person is an admin, using just if...else statement.
Expand All @@ -34,6 +40,15 @@ Steps:
***********************************************************/
// TODO: ADD YOUR CODE BELOW

// let userName = "hassan";
// let role = "admin";
// let enteredUsername = prompt("ادخل اسمك");
// if (enteredUsername == userName && role == "admin") {
// console.log( `${userName}هلا بيك`);
// }else{console.log("لا جذب انت مو المسؤول");}



/************************************************************************************************
Task 3 (if..else Statement):
Write a program that checks if a number is positive, negative or zero, using if...else statement.
Expand All @@ -48,6 +63,20 @@ Steps:
************************************************************************************************/
// TODO: ADD YOUR CODE BELOW

// let enterNumber = prompt("enter your number");
// let number = parseInt(enterNumber);
// if (enterNumber < 0){
// console.log("the number is negative");
// }

// if (enterNumber > 0){
// console.log("the number is positive");
// }

// if (enterNumber === 0){
// console.log("the number is zero");
// }

/*************************************************************************************************
Task 4 (if..else Statement):

Expand All @@ -59,6 +88,20 @@ 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 minimumAge = 18;
// let enterAge = prompt("enter your age");
// let yearsLeft =minimumAge - enterAge;
// if (enterAge >= minimumAge) {

// if (confirm("سجلت اسمك")) {
// console.log("جيد يلا روح صوت")
// }else {
// console.log(" يهو وصلك لهنا سجل اسمك")

// }
// }else {
// console.log(`${yearsLeft}يصير عمرك 18 بعد `);
// }

/*************************************************************************************************
Task 5 (if..else Statement):
Expand Down Expand Up @@ -122,3 +165,50 @@ Steps:
- Use the toFixed() method to format the totalCost to 2 decimal places.
*************************************************************************************************/
// TODO: ADD YOUR CODE BELOW

let sizePizza = prompt("select pizza size").toLowerCase();

let price;

if (sizePizza == "small") {
price = 10;

}
if (sizePizza == "medium") {
price = 15;

}
if (sizePizza == "large") {
price = 20;

} if (!sizePizza) {
console.log("Please write what size do you want!");
}

let enterTopping = prompt("enter topping, separated by commas").toLowerCase();
let topping = enterTopping.split(",");

let toppingCost;
if (topping.length <= 2) {
toppingCost = topping.length * 2;
} else {
toppingCost = topping.length * 2 * 0.9;
}

let drink = prompt("do you want drink with 'yes' or 'no'").toLowerCase();
let drinkCost;

if (drink == "yes") {
drinkCost = 2;
} else if (drink == "no") {
drinkCost = 0;
}

let totalCost;
totalCost = drinkCost + toppingCost + price;

if (topping.length <= 3 && drink == "yes") {
totalCost = totalCost - 2 * 0.1;
}

console.log(`The total cost $${totalCost.toFixed()}`);
77 changes: 77 additions & 0 deletions switchStatement.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,49 @@ 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 enterZodiac = prompt("enter your zodiac");
switch (enterZodiac) {
case "Aries" :
console.log("Horoscope: You're feeling bold and energetic today, Aries! Take advantage of this burst of energy and tackle any challenges that come your way. Your determination and confidence will help you achieve your goals.");
break ;
case "Taurus" :
console.log("Horoscope: It's a good day to focus on your financial matters, Taurus. Take a look at your budget and make any necessary adjustments. Avoid impulsive spending and save for the future.");
break ;
case "Gemini" :
console.log("Horoscope: Your social calendar is likely to be full today, Gemini. You're in the mood for socializing and networking. Make new connections and engage in stimulating conversations. Keep an open mind.");
break ;
case "Cancer" :
console.log("Horoscope: It's time to take care of yourself, Cancer. Pay attention to your emotional well-being and prioritize self-care. Take a break from your usual routine and indulge in some self-nurturing activities.");
break ;
case "Leo" :
console.log("Horoscope: Your creativity is on fire today, Leo. Express yourself through your artistic pursuits and let your inner child come out to play. Your confidence and charisma will attract attention. ");
break ;
case "Virgo" :
console.log("Horoscope: It's a good day for organizing and decluttering, Virgo. Clean up your physical space and tidy up your thoughts. Focus on practical matters and set achievable goals.");
break ;
case "Libra" :
console.log("Horoscope: Your diplomacy and charm are in full force today, Libra. Use your skills to resolve conflicts and bring harmony to your relationships. Seek balance and fairness in all your interactions.");
break ;
case "Scorpio" :
console.log("Horoscope: Your intuition is heightened today, Scorpio. Trust your instincts and delve into your emotions. Explore your subconscious mind and gain insights into your inner workings.");
break ;
case "Sagittarius" :
console.log("Horoscope: You're in the mood for adventure, Sagittarius. Plan a trip or explore new possibilities. Your optimism and enthusiasm will inspire others, and you may learn something new.");
break ;
case "Capricorn" :
console.log("Horoscope: It's time to focus on your career goals, Capricorn. Set clear objectives and work diligently towards achieving them. Your hard work and determination will pay off in the long run.");
break ;
case "Aquarius" :
console.log("Horoscope: Your humanitarian side is in the spotlight today, Aquarius. Engage in activities that promote social causes and make a positive impact. Connect with like-minded individuals and share your innovative ideas.");
break ;
case "Pisces" :
console.log("Horoscope: Your sensitivity and intuition are heightened today, Pisces. Pay attention to your dreams and emotions, as they may hold important messages for you. Take some time for self-reflection and introspection.");
break ;
default :
console.log("Sorry, we do not have a horoscope for that sign.");


}
/************************************************************************************************
Task 6 (Switch Statement):
Create a program that helps you decide what to wear based on the weather forecast for the day.
Expand All @@ -36,3 +78,38 @@ Example:
- Recommendations: Wear sunscreen, a hat, and sunglasses.
************************************************************************************************/
// TODO: ADD YOUR CODE BELOW
let enterWeather = prompt(" enter the forecasted weather");
switch (enterWeather) {
case "Sunny" :
console.log(`1. Choose lightweight cotton, linen, rayon, chambray, or silk fabrics for breathability and comfort.
2. Opt for light colors and loose-fitting styles to reflect heat and allow air circulation.
3. Wear appropriate sun protection, such as a wide-brimmed hat and sunglasses, and apply sunscreen.
4. Stay hydrated and enjoy the sunny weather in comfortable and breathable clothes!`);
break;
case "Rainy" :
console.log(`1. Choose waterproof or water-resistant fabrics like polyester, nylon, or Gore-Tex for maximum protection.
2. Synthetic blends are also a good option for their water-repelling properties.
3. Avoid absorbent fabrics like cotton or silk that can become heavy when wet.
4. Consider treated fabrics that are coated with a water-repellent finish.
5. Pair rain gear with appropriate footwear and rain accessories as needed to stay dry in rainy weather.`);
break;
case "Cloudy" :
console.log(`1. Layer with lightweight knits, fleece, or flannel for easy adjustment to changing temperatures.
2. Choose breathable fabrics like cotton, bamboo, or modal for comfort.
3. Opt for moisture-wicking fabrics like polyester or nylon to stay dry in light drizzle or humidity.
4. Consider fabrics with stretch for flexibility and comfort during activities.
5. Don't forget to have a light jacket or coat made of weather-resistant materials for added protection from wind or light rain.
Being prepared with versatile fabrics and layering options can help you stay comfortable in changing weather conditions during cloudy days!`);
break;
case "Snowy" :
console.log(`1. Insulating fabrics like fleece, down, or synthetic insulation for warmth.
2. Waterproof or water-resistant fabrics like Gore-Tex, nylon, or polyester to stay dry.
3. Moisture-wicking fabrics like polyester or merino wool to keep you dry.
4. Layering fabrics such as thermal knits, fleece, or merino wool for insulation.
5. Windproof fabrics like nylon or softshell materials for protection from wind chill.
Prioritize warmth, insulation, moisture management, and wind protection when dressing for snowy weather, and be sure to layer appropriately to stay warm and dry in snowy conditions!`);
break;
default :
console.log("Sorry, we do not have recommendations for that weather condition.")

}