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: chapter-02-simple-calculations.md
+23-23Lines changed: 23 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -118,7 +118,7 @@ Here are some examples of data types:
118
118
- type **int number**: 1, 2, 3, 4, 5, …
119
119
- type **double number**: 0.5, 3.14, -1.5, …
120
120
- type **a letter from the alphabet** (symbol): 'a', 'b', 'c', …
121
-
- type **text** (string): "Здрасти", "Hi", "Beer", …
121
+
- type **text** (string): "Hello", "Hi", "Beer", …
122
122
- type **day of the week**: Monday, Tuesday, …
123
123
124
124
## Reading floating-point numbers from the console
@@ -303,7 +303,7 @@ NaN
303
303
304
304
## Concatenating text and numbers
305
305
306
-
The operator **`+`** besides for summing up numbers, is also used for joining text (concatenation of two strings one after another). In programming, joining text with text or with number is called "concatenation". Here is how we can concatenate a text with a number with the operator **`+`**:
306
+
The operator **`+`** besides for summing up numbers, is also used for joining text (concatenation of two strings one after another). In programming, joining text with other text or with number is called "concatenation". Here is how we can concatenate a text with a number with the operator **`+`**:
307
307
308
308
```Java
309
309
String firstName ="Maria";
@@ -332,18 +332,18 @@ System.out.println(sum); // The sum is: 4
332
332
```
333
333
334
334
335
-
## Numerical Expressions
335
+
## Numerical expressions
336
336
337
-
In programming we can calculate **numerical expressions**, for example:
337
+
In programming, we can calculate **numerical expressions**, for example:
338
338
339
339
```Java
340
340
int expr = (3+5) * (4 – 2);
341
341
```
342
-
The standard rule for priorities of arithmetic operations is applied: **multiplying and dividing are always done before adding and subtracting**. In case of an **expression in brackets it is calculated first**, but we already know all of that from school math.
342
+
The standard rule for the precedence of arithmetic operations is applied: **multiplying and dividing are always done before adding and subtracting**. In the case of an **expression in brackets, it is calculated first**, but we already know all of that from math.
343
343
344
-
### Example: Calculating Trapezoid Area
344
+
### Example: Calculating trapezoid area
345
345
346
-
Let’s write a program that inputs the lengths of the two bases of a trapezoid and its height (one floating-point number per line) and calculates the area of the trapezoid by the standard math formula.
346
+
Write a program that reads as input from the console the lengths of the two bases of a trapezoid and its height (one floating-point number per line) and calculates the area of the trapezoid by the standard math formula.
347
347
348
348
```Java
349
349
Scanner scanner =newScanner(System.in);
@@ -355,22 +355,22 @@ double area = (b1 + b2) * h / 2.0;
355
355
System.out.println("Trapezoid area = "+ area);
356
356
```
357
357
358
-
If we start the program and enter values for the sides: 3, 4 and 5, we will obtain the following result:
358
+
If we start the program and enter values for sides: 3, 4, and 5, we will obtain the following result:
359
359
```
360
360
3
361
361
4
362
362
5
363
363
Trapezoid area = 17.5
364
364
```
365
365
366
-
#### Testing in the Judge System
366
+
#### Testing in the Judge system
367
367
368
368
Test your solution here: [https://judge.softuni.bg/Contests/Practice/Index/649#4](https://judge.softuni.bg/Contests/Practice/Index/649#4).
369
369
370
370
371
-
### Example: Circle Area and Perimeter
371
+
### Example: Circle area and perimeter
372
372
373
-
Let’s write a program which when enter a **radius r** of a circle**calculates the area and the perimeter** of the circle / round.
373
+
Write a program that reads as input from the console a **radius r** of a circle, and **calculates its area and perimeter**.
In this tast we must take into account, that if from the bigger `x`we subtract the smaller `x`, we will obtain the length of the rectangle. Identically, if from the bigger`y`we subtract the smaller `y` we will obtain the height of the rectangle. What is left is to multiply both sides. Here is an example of an implementation of the described logic:
404
+
In this tasк, we must take into account that we can obtain the length of the rectangle if we subtract the smaller `x` from the bigger `x`. Identically, if we subtract the smaller`y`from bigger `y`, we can obtain the rectangle height. Then we multiply both sides. Here is an example of an implementation of the described logic:
0 commit comments