Skip to content

Commit

Permalink
fixed the quotes: „“ -> “”
Browse files Browse the repository at this point in the history
  • Loading branch information
nakov committed Feb 4, 2019
1 parent 812681a commit 3c6319d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ By entering two numbers in the first two fields and pressing the button \[**Calc

## Creating a New C\# Project

In Visual Studio we create **a new C\# project of type Windows Forms Application**:
In Visual Studio we create **a new C\# project of type Windows Forms Application**:

![](/assets/chapter-1-images/07.Numbers-sum-02.png)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Write a C\# program, that reads a first name, last name, age and city from the c

## Hints and Guidelines

We add to the existing Visual Studio solution one more console C\# project with name “Concatenate-Data”. We **write the code** which reads the input from the console:
We add to the existing Visual Studio solution one more console C\# project with name “Concatenate-Data”. We **write the code** which reads the input from the console:

![](/assets/chapter-2-images/04.Concatenate-data-01.png)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Graphical Application: _\*_ Catch the Button!

Create a fun graphical application **catch the button**: a form consisting of one button. Upon moving the mouse cursor onto the button, it moves to a random position. This way it creates the impression that "**the button runs form the mouse and it is hard to catch**". When the button gets „caught“, a congratulations message is shown.
Create a fun graphical application **catch the button**: a form consisting of one button. Upon moving the mouse cursor onto the button, it moves to a random position. This way it creates the impression that "**the button runs form the mouse and it is hard to catch**". When the button gets “caught”, a congratulations message is shown.

![](/assets/chapter-2-images/14.Catch-the-button-01.png)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The input is read from the console and **contains exactly 2 lines**:

**Print** on the console **1 line**. The **sum** must be **formatted** up to the **two symbols after the decimal point**:
* If **money is enough**:
* **"Yes! He will live a carefree life and will have {N} dollars left.** – where **N** is the money that will remain.
* **"Yes! He will live a carefree life and will have {N} dollars left."** – where **N** is the money that will remain.
* If **money is NOT enough**:
* **"He will need {М} dollars to survive."** – where **M** is the sum that **is NOT enough**.

Expand Down Expand Up @@ -71,7 +71,7 @@ Using a **`for` loop**, we will iterate through all years. We **start from 1800*

## Checking if Heritage is Enough and Printing the Output

Finally we need to print out the results by checking **if the `heritage`** is enough to live without working or not. If the **`heritage`** is a **positive number**, we print: **`Yes! He will live a carefree life and will have {N} dollars left.`**, and if it is a **negative number**: **`He will need {М} dollars to survive.`**. Do not forget to format the sum up to the second symbol after the decimal point.
Finally we need to print out the results by checking **if the `heritage`** is enough to live without working or not. If the **`heritage`** is a **positive number**, we print: **`Yes! He will live a carefree life and will have {N} dollars left.`**, and if it is a **negative number**: **`He will need {М} dollars to survive.`**. Do not forget to format the sum up to the second symbol after the decimal point.

**Hint**: Consider using the **`Math.Abs(…)`** function when printing the output, if the heritage is not enough.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Finally we need to print the obtained results, taking into account the formattin

![](/assets/chapter-5-2-images/02.Smart-lilly-05.png)

In this case we choose to use the **conditional operator (`?:`)** (also called ternary operator), because the record is shorter. Its syntax is as follows: **`operand1 ? operand2 : operand3`**. First operand need to be **boolean type** (i.e. to return **`true/false`**). If **`operand1`** returns **`true`**, **`operand2`** will be executed, and if it returns **`false`****`operand3`** will be executed. In our case we check if the **money saved** by Lilly is enough for a washing machine. If it is more than or equal to the price of a washing machine, the check **`savedMoney >= priceOfWashingMachine`** will return **`true`** and will print **Yes! …**, and if it is less – the result will be **`false`** and “**No! …**” will be printed. Of course, instead of conditional operand, we can use **`if`** checks.
In this case we choose to use the **conditional operator (`?:`)** (also called ternary operator), because the record is shorter. Its syntax is as follows: **`operand1 ? operand2 : operand3`**. First operand need to be **boolean type** (i.e. to return **`true/false`**). If **`operand1`** returns **`true`**, **`operand2`** will be executed, and if it returns **`false`****`operand3`** will be executed. In our case we check if the **money saved** by Lilly is enough for a washing machine. If it is more than or equal to the price of a washing machine, the check **`savedMoney >= priceOfWashingMachine`** will return **`true`** and will print **Yes! …**, and if it is less – the result will be **`false`** and “**No! …**” will be printed. Of course, instead of conditional operand, we can use **`if`** checks.

More about the conditional operator: [https://www.dotnetperls.com/ternary](https://www.dotnetperls.com/ternary), [https://msdn.microsoft.com/en-us/library/ty67wk28.aspx](https://msdn.microsoft.com/en-us/library/ty67wk28.aspx).

Expand Down

0 comments on commit 3c6319d

Please sign in to comment.