Dies ist eine alte Version des Dokuments!


LU07.A09 - Basic caluclator simple

  • Work type: Individual
  • Means of aid: only teaching materials, no websearch, no use of ai.
  • Timeframe: 40 Minutes
  • Expected result: A browser based calulator which can sum up 2 digits in the easiest way.
  • You can take any script an adjust it to your needs.

This assignment compraises the programming of a tiny caculator for basic calculation operations, meaning two diggit have to be added together. To do the assignment we need two blocks of diggits-buttons, an operation-button for „+“ and finally an ENTER-Button to execute the operation respectively to receive the result.

  • A01: Create in Webstorm in your directory 07_methods a html file and name it correctly LU07.S09.
  • A02: Copy the structure of the sfc (single file component) from a solution of your choice (in that way we don't have to type it manually –> easier and faster)
  • A03: Make sure to have
    • the assignmen number in <h1> and
    • the description in <h3>-format
  • A04: Safe it.
  • B01: Create the buttons 1 to 4 (that shall suffice for our purpose)
  • B02: When clicking on one of them the content will be saved in the variable diggit1
  • C01: A basic calculation 3 + 3 = 6 compraises several variables:
    • diggit1 = 0,
    • operator = ''
    • diggit2 = 0,
    • result
  • D01: Create the second set of buttons 1 to 4 to set the second diggit. (4 of them shall suffice for our purpose)
  • D02: When clicking on one of them the content will be saved in the variable diggit2
  • E01: To execute our addition-operation we finally need a button ENTER.
  • E02: This enter calls a method calcResult(operator).
  • E03: Thus the addition is done in the method, correspondingly to the providet operator.
  • E04: As a result, after pressing the enter button, the result should be displayed in the screen.
English German
diggit Ziffer
to suffice ausreichen
respectively beziehungungsweise
to compraise umfassen
several einige, etliche

Volkan Demir

  • en/modul/m291/learningunits/lu07/aufgaben/09.1747653402.txt.gz
  • Zuletzt geändert: 2025/05/19 13:16
  • von vdemir