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

Kursinhalt

Introduction to JavaScript

Introduction to JavaScript

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

book
Task - Coffee Shop Sales

Aufgabe

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

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 14
toggle bottom row

book
Task - Coffee Shop Sales

Aufgabe

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

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 14
Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
Wir sind enttäuscht, dass etwas schief gelaufen ist. Was ist passiert?
some-alt