Skip to content
Open
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
48 changes: 46 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ 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?`);
const cafeName = "Xings Cafe";
alert(`Welcome to ${cafeName}`);
const name = prompt("What's your name?");
const cafe = prompt(`Hello ${name.toUpperCase()}, what would you like to order today?`);

/*
2)
Expand All @@ -14,13 +16,29 @@ Create a variable that stores how many coffees the customer wants.
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.
*/
// price of one coffee in euros
const coffeePrice = 5;
// prompt name for the number of coffees
const nrOfCoffees = prompt("How many coffees would you like?");
// calculate the total price
const totalPrice = coffeePrice * nrOfCoffees;

// display the total price
alert("Here you go, that'll be " + totalPrice + " euros! Have a good day!");

/*
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 goodCaffe = prompt("Do you like the cafe? (yes/no)")

if (goodCaffe === "yes") {
alert("You said this coffee is the best, that was actually true")
} else {
alert("You said this coffee is the best, that is interesting")
};

/*
4)
Expand All @@ -30,6 +48,13 @@ Print it out.
Assign it a new value.
Print it out. => This should give you the new value.
*/
// let value changable
let cafeGuests = 5;
alert(`we have ${cafeGuests} guests today!`);

// assign new value
cafeGuests = 9;
alert(`we have ${cafeGuests} guests today!`);

/*
5)
Expand All @@ -39,17 +64,36 @@ Print it out.
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 = 8;

alert(`The max guests of ${maxGuests} is allowed in the cafe.`);

// maxGuests = 10;

// compare number of guests with max number of guests
const nrOfGuests = prompt("How many guests do we have now?");

if ( nrOfGuests <= maxGuests) {
alert("Welcome in!")
} else {
alert("Sorry! There are too many!");
}


/*
6)
Create a variable that stores a string.
Print out that string in only UPPERCASE letters.
*/
const user = prompt("What's your name?");
alert(`Hello ${user.toUpperCase()}, how are you today?`);

/*
7)
Print out the same string in only lowercase letters.
*/
const username =prompt("What's your name?");
alert(`Hello ${username.toLowerCase()}, how are you today?`);

/*
8) **BONUS**
Expand Down