You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Content/Chapter-1-first-steps-in-programming/exercises-graphical-and-web-apps/exercises-graphical-and-web-apps.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ Now we are about to build one simple **web application** and one simple **graphi
4
4
5
5
## Console, Graphical and Web Applications
6
6
7
-
With **console applications**, as you can figure out yourselves, **all operations** for reading input and printing output are **done through the console**. **The input data is inserted** in the console, which is then read by the application, also in it, and the **output data is printed** on the console after or during the runtime of the program.
7
+
With **console applications**, as you can figure out yourselves, **all operations** for reading input and printing output are **done through the console**. **The input data is entered** in the console, which is then read by the application, also in it, and the **output data is printed** on the console after or during the runtime of the program.
8
8
9
9
While a console application **uses the text console**, web applications **use web-based user interface**. To **execute them**, two things are needed – **a web server** and **a web browser**, as **the browser** plays the main role in **the visualization of the data and the interaction with the user**. Web applications are much more pleasant for the user, they visually look better, and a mouse and touch screen can be used \(for tablets and smartphones\), but programming stands behind all of that. And this is why **we have to learn to program** and we have already made our first very little steps towards that.
Copy file name to clipboardExpand all lines: Content/Chapter-3-2-simple-conditions-exam-problems/exam-problems/pipes-in-pool/pipes-in-pool.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@ After we have **the value of the quantity** of water that has flown through the
46
46
47
47
We do that with a simple **`if-else`** statement, where the condition will be whether **the quantity of water is less than the volume of the pool**. If the statement returns **`true`**, we have to print **one** line that contains **the ratio** between the quantity of **water that has flown through the pipes** and **the volume of the pool**, as well as the **ratio of the quantity of the water** from **each pipe** to the **volume of the pool**.
48
48
49
-
The ratio has to be in **percentage**, that is why all the calculations so far will be **multiplied by 100**. The values will be inserted with**placeholders**, and as there is a condition **the result in percentage** to be formatted to **two digits** after **the decimal** point **without rounding**, we will use the method **`Math.Truncate(…)`**.
49
+
The ratio has to be in **percentage**, that is why all the calculations so far will be **multiplied by 100**. The values will be printed using**placeholders**, and as there is a condition **the result in percentage** to be formatted to **two digits** after **the decimal** point **without rounding**, we will use the method **`Math.Truncate(…)`**.
Copy file name to clipboardExpand all lines: Content/Chapter-7-1-complex-loops/web-app/web-apps-with-complex-loops.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -44,14 +44,14 @@ Now we have to prepare the fruits for drawing in the view. Add the following cod
44
44
45
45

46
46
47
-
The above code defines the fields for **number of rows, number of columns**, **fruit table**\(playing field\), **points** accumulated by the player and information whether the game is active or **ended**\(field `gameOver`\). The playing field has 9 columns in 3 rows and contains for each field a text stating what is inside it: `apple`**, **`banana`**, **`orange`**, **`kiwi`**, **`empty`** or **`dynamite`.
47
+
The above code defines the fields for **number of rows, number of columns**, **fruit table** (playing field), **points** accumulated by the player and information whether the game is active or **ended** (field `gameOver`). The playing field has 9 columns in 3 rows and contains for each field a text stating what is inside it: `apple`**, **`banana`**, **`orange`**, **`kiwi`**, **`empty`** or **`dynamite`.
48
48
The main action `Index ()` prepares the game field by recording in the `ViewBag` the structure of the game elements and invoking the view that draws them into the game page of the web browser as HTML.
49
49
50
50
## Generate Random Fruits
51
51
52
-
We need to generate random fruits. To do this, we need to write a `GenerateRandomFruits()` method with the code from the image below. This code records in the matrix `fruits` names of different images and thus builds the playing field. Each cell of the table records one of the following values: `apple`**, **`banana`**, **`orange`**, **`kiwi`**, **`empty`** or **`dynamite`. Next, to draw the corresponding image in the view, the text of the table will be merged with `.png` and this will give the name of the picture file that has to be inserted into the HTML page as part of the playing field. Filling in the playing field \(9 columns with 3 rows\) happens in the view `Index.cshtml` with two nested `for` loops \(for row and column\).
52
+
We need to generate random fruits. To do this, we need to write a `GenerateRandomFruits()` method with the code from the image below. This code records in the matrix `fruits` names of different images and thus builds the playing field. Each cell of the table records one of the following values: `apple`**, **`banana`**, **`orange`**, **`kiwi`**, **`empty`** or **`dynamite`. Next, to draw the corresponding image in the view, the text of the table will be joined with the suffix “`.png`” and this will give the name of the picture file that has to be inserted into the HTML page as part of the playing field. Filling in the playing field (9 columns with 3 rows) happens in the view `Index.cshtml` with two nested `for` loops (for row and column).
53
53
54
-
In order to generate random fruit for each cell, a **random number** is generated between 0 and 8 \(see the class `Random` in .NET\). If the number is 0 or 1, we place `apple`, if it is between 2 and 3, we place `banana` and so on. If the number is 8, we place `dynamite`. Obviously, the fruits appear twice as often as the dynamite. Here's the code:
54
+
In order to generate random fruit for each cell, a **random number** is generated between 0 and 8 (see the class `Random` in .NET). If the number is 0 or 1, we place `apple`, if it is between 2 and 3, we place `banana` and so on. If the number is 8, we place `dynamite`. Obviously, the fruits appear twice as often as the dynamite. Here's the code:
55
55
56
56

57
57
@@ -69,7 +69,7 @@ Now we add the **game images** \(they are part of the project files for this pro
69
69
70
70
Drawing Fruits in `Index.cshtml`:
71
71
72
-
In order to **draw the playing field** with the fruits, we need to rotate **two nested loops**\(for rows and columns\). Each row consists of 9 images, each of which contains an `apple`, `banana` or other fruit, or empty `empty`, or `dynamite`. Images are drawn by printing an HTML tag to insert a picture of the type`<img src = "/images/apple.png" />`. Nine pictures are stacked one after the other on each row, followed by a new line with a `<br>`. This is repeated three times for the three lines. Finally, the player's points are printed. Here is what **the code** for drawing the playing field and points looks like:
72
+
In order to **draw the playing field** with the fruits, we need to rotate **two nested loops**\(for rows and columns\). Each row consists of 9 images, each of which contains an `apple`, `banana` or other fruit, or empty `empty`, or `dynamite`. Images are drawn by printing an HTML tag to insert a picture:`<img src = "/images/apple.png" />`. Nine pictures are stacked one after the other on each row, followed by a new line with a `<br>`. This is repeated three times for the three lines. Finally, the player's points are printed. Here is what **the code** for drawing the playing field and points looks like:
0 commit comments