From cbc258b81dd945fb763dd9879fdb7e87aff778dc Mon Sep 17 00:00:00 2001 From: Cholpon Date: Tue, 3 Sep 2024 20:04:26 +0200 Subject: [PATCH] worked on this together --- src/index.js | 65 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index a0bbbb7..0f7e8fb 100644 --- a/src/index.js +++ b/src/index.js @@ -4,10 +4,14 @@ Create a variable that stores the name of your cafe. Print out a greeting such as "Welcome to Technigo Cafe! What would you like to order today?" Where Technigo Cafe is replaced by the name of your cafe that is stored in the variable. */ -const cafeName = "Technigo Cafe"; -console.log(`Welcome to ${cafeName}! What would you like to order today?`); + +// HINT: Don't use var, stick to let and const. + +const cafeName = "Fika Cafe"; +alert(`Welcome to ${cafeName}! What would you like to order today?`); /* + 2) Create a variable that stores the price of a coffee. Create a variable that stores how many coffees the customer wants. @@ -15,12 +19,32 @@ Print out the total price such as "There you go, that'll be 10 euros" Where 10 is replaced by the calculation of the total price. */ +const coffeePrice = 3.5; // Price of one coffee in euros + +// Prompt the user for the number of coffees +const numberOfCoffees = prompt("How many coffees would you like?"); + +// Calculate the total price +const totalPrice = coffeePrice * numberOfCoffees; + +// Display the total price +alert("There you go, that'll be " + totalPrice + " euros"); + /* 3) Create a variable that stores a boolean. Print out "You said this coffee is the best, that was actually true" Where true is replaced by your varible -*/ + */ + +const coffeeIsBest = prompt("Do you think this coffee is the best? (yes/no)"); + +if (coffeeIsBest === "yes") { + alert("You said this coffee is the best, that was actually true"); +} else { + alert("You said this coffee is not the best, that's interesting"); +} + /* 4) @@ -31,6 +55,17 @@ Assign it a new value. Print it out. => This should give you the new value. */ +let cafeGuests = 10; +// alert("We have ${cafeGuests} guests."); + +alert(`we have ${cafeGuests} guests`); + +cafeGuests = 15; +// alert("We have ${cafeGuests} guests."); + +alert(`now we have ${cafeGuests} guests`); + + /* 5) Create a variable called maxGuests, that shows us how many guests are allowed in the cafe. @@ -40,17 +75,41 @@ assign it a new value. Print it out. => This should give you an error because it shouldn't be able to be changed. */ + +const maxGuests = 20; +alert(`we can have only ${maxGuests} guests`); + +//maxGuests = 30; +//alert(`we can have only ${maxGuests} guests`); + /* 6) Create a variable that stores a string. Print out that string in only UPPERCASE letters. */ +const guestName = prompt("what is your name?"); + +const upperguestName = guestName.toUpperCase() + +// console.log(GuestName.toUpperCase); +// // will give you "JENNIE" + + +alert(`Hello ${upperguestName} welcome!`); + /* 7) Print out the same string in only lowercase letters. */ + +const lowerguestName = guestName.toLowerCase() +alert(`Hello ${lowerguestName} welcome!`); + + + + /* 8) **BONUS** Print out the string "Today we have a special summer deal!".