Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Task - Coffee Shop Sales | Getting Started
Introduction to JavaScript
course content

Contenu du cours

Introduction to JavaScript

Introduction to JavaScript

1. Getting Started
2. Manipulating Data
3. Conditional Statements

book
Task - Coffee Shop Sales

Tâche

Swipe to start coding

You are helping a coffee shop calculate their sales.

The shop sells coffee for an average of $5 per cup, and customers sometimes pay extra, requiring change to be given.

Your task is to:

  • Include a multi-line comment at the top of your code which describes the program with the following text:
text
  • Write a console.log statement to display the total earnings after selling 7 coffees to a customer (each costs $5). The output must be in the format: Total earnings: X;
  • Write a console.log statement to display how much change a customer should receive after paying $50 for the 7 coffees. (Use the format: Customer change: X);

Example Output:

python

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 14
toggle bottom row

book
Task - Coffee Shop Sales

Tâche

Swipe to start coding

You are helping a coffee shop calculate their sales.

The shop sells coffee for an average of $5 per cup, and customers sometimes pay extra, requiring change to be given.

Your task is to:

  • Include a multi-line comment at the top of your code which describes the program with the following text:
text
  • Write a console.log statement to display the total earnings after selling 7 coffees to a customer (each costs $5). The output must be in the format: Total earnings: X;
  • Write a console.log statement to display how much change a customer should receive after paying $50 for the 7 coffees. (Use the format: Customer change: X);

Example Output:

python

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 14
Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Nous sommes désolés de vous informer que quelque chose s'est mal passé. Qu'est-il arrivé ?
some-alt