From dfdebdb37eb3b57ec98e7919e7e6bfceb9dd2348 Mon Sep 17 00:00:00 2001 From: Svetlin Nakov Date: Mon, 28 Jan 2019 13:52:52 +0200 Subject: [PATCH] =?UTF-8?q?Fixed=20short=20hyphen=20"-"=20to=20long=20hyph?= =?UTF-8?q?en=20"=E2=80=93"=20in=20the=20text=20sentences?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exercises-first-steps-in-coding.md | 4 +-- .../rectangle-area.md | 2 +- .../exercises-graphical-and-web-apps.md | 2 +- .../computer-programs-concepts.md | 8 +++--- .../example-creating-a-console-application.md | 6 ++-- .../overview.md | 12 ++++---- .../exercises-methods/notifications.md | 6 ++-- .../numbers-to-words/numbers-to-words.md | 2 +- .../string-encryption/string-encryption.md | 4 +-- .../methods-overloading.md | 2 +- .../method-with-params.md | 4 +-- .../nested-methods/nested-methods.md | 2 +- .../returning-multiple-values.md | 4 +-- .../what-method-is/what-method-is.md | 2 +- .../code-formatting/code-formatting.md | 6 ++-- .../tricks/tricks.md | 8 +++--- .../1000-days-after-birth.md | 2 +- .../blank-visual-studio-solution.md | 2 +- .../celsius-to-fahrenheit.md | 2 +- .../exercises-simple-calculations.md | 6 ++-- .../radians-to-degrees/radians-to-degrees.md | 2 +- .../rectangle-area/rectangle-area.md | 2 +- .../usd-to-bgn/usd-to-bgn.md | 2 +- .../numerical-expressions.md | 2 +- .../daily-earnings/daily-earnings.md | 4 +-- .../exam-problems/money/money.md | 2 +- .../vegetables-market/vegetables-market.md | 8 +++--- .../overview.md | 2 +- .../area-of-figures/area-of-figures.md | 8 +++--- .../bonus-score/bonus-score.md | 4 +-- .../excellent-grade-or-not.md | 4 +-- .../exercises-simple-conditions-part-2.md | 2 +- .../if-else-conditions/if-else-conditions.md | 2 +- .../pipes-in-pool/pipes-in-pool.md | 4 +-- .../sleepy-tom-cat/sleepy-tom-cat.md | 4 +-- .../overview.md | 4 +-- .../complex-conditions/complex-conditions.md | 2 +- .../complex-logical-conditions.md | 2 +- .../volleyball/problem-cinema.md | 4 +-- .../graphical-app/graphical-app.md | 2 +- .../nested-conditions/nested-conditions.md | 6 ++-- .../exam-problems/hotel-room/hotel-room.md | 6 ++-- .../match-tickets/match-tickets.md | 2 +- .../on-time-for-the-exam.md | 6 ++-- .../exam-problems/operations/operations.md | 4 +-- .../exam-problems/trip/trip.md | 10 +++---- .../example-left-and-right-sum.md | 2 +- .../example-sum-numbers.md | 10 +++---- .../exercises-loops/equal-pairs.md | 4 +-- .../exercises-loops/half-sum-element.md | 2 +- .../exam-problems/division/division.md | 2 +- .../exam-problems/histogram/histogram.md | 8 +++--- .../calc-treated-and-untreated-patients.md | 6 ++-- .../exam-problems/hospital/hospital.md | 6 ++-- .../exam-problems/smart-lily/smart-lily.md | 9 +++--- .../overview.md | 2 +- .../house/house.md | 2 +- .../nested-loops/example-rhombus-of-stars.md | 2 +- .../nested-loops/nested-loops.md | 8 +++--- .../exam-problems/arrow/arrow.md | 4 +-- .../exam-problems/axe/axe.md | 2 +- .../exam-problems/butterfly/butterfly.md | 4 +-- .../exam-problems/stop/stop.md | 4 +-- .../do-while-loop/do-while-loop.md | 4 +-- .../number-pyramid/number-pyramid.md | 2 +- .../number-table/number-table.md | 2 +- .../greatest-common-divisor.md | 2 +- .../infinite-loops/infinite-loops.md | 2 +- .../try-catch/try-catch.md | 8 +++--- .../web-app/web-apps-with-complex-loops.md | 10 +++---- .../digits/digits.md | 2 +- .../magic-combination/magic-combination.md | 4 +-- .../stop-number/stop-number.md | 16 +++++------ .../stupid-password-generator.md | 2 +- .../complex-conditions-problems.md | 4 +-- .../drawing-figures-problems.md | 8 +++--- .../nested-loops-problems.md | 10 +++---- .../simple-conditions-problems.md | 6 ++-- .../simple-loops-problems.md | 6 ++-- .../flowers/flowers.md | 2 +- .../grades/grades.md | 6 ++-- .../five-special-letters.md | 4 +-- .../magic-dates/magic-dates.md | 8 +++--- .../bulls-and-cows/bulls-and-cows.md | 10 +++---- .../expression/expression.md | 8 +++--- .../passion-days/passion-days.md | 24 ++++++++-------- Content/Conclusion/overview.md | 16 +++++------ .../overview/recommended-resources.md | 14 +++++----- .../study-software-engineering-alone.md | 2 +- .../study-software-engineering-in-softuni.md | 10 +++---- .../Preface/about-softuni/about-the-book.md | 6 ++-- .../how-to-become-a-programmer.md | 28 +++++++++---------- README.md | 22 +++++++-------- SUMMARY.md | 2 +- 94 files changed, 256 insertions(+), 257 deletions(-) diff --git a/Content/Chapter-1-first-steps-in-programming/exercises-first-steps-in-coding/exercises-first-steps-in-coding.md b/Content/Chapter-1-first-steps-in-programming/exercises-first-steps-in-coding/exercises-first-steps-in-coding.md index 05e44305c..8c2fe4f0d 100644 --- a/Content/Chapter-1-first-steps-in-programming/exercises-first-steps-in-coding/exercises-first-steps-in-coding.md +++ b/Content/Chapter-1-first-steps-in-programming/exercises-first-steps-in-coding/exercises-first-steps-in-coding.md @@ -1,10 +1,10 @@ # Exercises: First Steps in Coding -Welcome to the **exercises**. Now we are going to write a couple of console applications, by which we are going to make a few more steps into programming. After that we will show how we can program something more complex - programs with graphical user interface. +Welcome to the **exercises**. Now we are going to write a couple of console applications, by which we are going to make a few more steps into programming. After that we will show how we can program something more complex – programs with graphical user interface. ## What We Learned in This Chapter? -First we have learned **what is programming** - **giving commands, written in a computer language**, which the machine understands and is able to execute. We understood what is **a computer program** - it represents a **sequence of commands**, arranged one after another. We got familiar with **the language for programming C\#** on a base level and how **to create simple console applications** with Visual Studio. We followed **the structure of the programming code in the C\# language**, as for example, the fact that commands are mainly given in the section `static void Main(string[] args)` between **the opening and closing curly parentheses**. We saw how to print with `Console.WriteLine(…)` and how to start our program with \[**Ctrl + F5**\]. We learned how to test our code in **SoftUni Judge**. +First we have learned **what is programming** – **giving commands, written in a computer language**, which the machine understands and is able to execute. We understood what is **a computer program** – it represents a **sequence of commands**, arranged one after another. We got familiar with **the language for programming C\#** on a base level and how **to create simple console applications** with Visual Studio. We followed **the structure of the programming code in the C\# language**, as for example, the fact that commands are mainly given in the section `static void Main(string[] args)` between **the opening and closing curly parentheses**. We saw how to print with `Console.WriteLine(…)` and how to start our program with \[**Ctrl + F5**\]. We learned how to test our code in **SoftUni Judge**. ## The Exercises diff --git a/Content/Chapter-1-first-steps-in-programming/exercises-first-steps-in-coding/rectangle-area.md b/Content/Chapter-1-first-steps-in-programming/exercises-first-steps-in-coding/rectangle-area.md index 8be7dd567..8f28d5190 100644 --- a/Content/Chapter-1-first-steps-in-programming/exercises-first-steps-in-coding/rectangle-area.md +++ b/Content/Chapter-1-first-steps-in-programming/exercises-first-steps-in-coding/rectangle-area.md @@ -20,7 +20,7 @@ What remains is to finish the program above, to calculate the area of the rectan ## Test Your Solution -Test your solution with a few examples. You have to receive an output, similar to this one \(we enter 2 and 7 as input and the program prints result 14 - their multiplication\): +Test your solution with a few examples. You have to receive an output, similar to this one \(we enter 2 and 7 as input and the program prints result 14 – their multiplication\): ``` 2 diff --git a/Content/Chapter-1-first-steps-in-programming/exercises-graphical-and-web-apps/exercises-graphical-and-web-apps.md b/Content/Chapter-1-first-steps-in-programming/exercises-graphical-and-web-apps/exercises-graphical-and-web-apps.md index d91927708..13f5455e2 100644 --- a/Content/Chapter-1-first-steps-in-programming/exercises-graphical-and-web-apps/exercises-graphical-and-web-apps.md +++ b/Content/Chapter-1-first-steps-in-programming/exercises-graphical-and-web-apps/exercises-graphical-and-web-apps.md @@ -6,7 +6,7 @@ Now we are about to build one simple **web application** and one simple **graphi 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. -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. +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. Graphical \(GUI\) applications have **a visual user interface**, directly into your computer or mobile device, without a web browser. Graphical applications \(also known as desktop applications\) **contain one or more graphical windows**, in which certain **controllers** are located \(text fields, buttons, pictures, tables and others\), **serving for dialog** with the user in a more intuitive way. Similar to them are the mobile applications in your telephone or your tablet: we use forms, text fields, buttons and other controls and we control them by programming code. This is why we are learning how to write code now: **the code is everywhere in software development**. diff --git a/Content/Chapter-1-first-steps-in-programming/how-to-write-console-app/computer-programs-concepts.md b/Content/Chapter-1-first-steps-in-programming/how-to-write-console-app/computer-programs-concepts.md index 2555a3dad..9505390d7 100644 --- a/Content/Chapter-1-first-steps-in-programming/how-to-write-console-app/computer-programs-concepts.md +++ b/Content/Chapter-1-first-steps-in-programming/how-to-write-console-app/computer-programs-concepts.md @@ -4,11 +4,11 @@ Let's start with the **concepts of computer programming**: computer programs, al ## What It Means "To Program"? -**To program** means to give commands to the computer, for example "_to play a sound_", "_to print something on the screen_" or "_to multiply two numbers_". When the commands are one after another, they are called **a computer program**. The text of computer programs is called **a program code** \(or **a source code**, or even shorter - **code**\). +**To program** means to give commands to the computer, for example "_to play a sound_", "_to print something on the screen_" or "_to multiply two numbers_". When the commands are one after another, they are called **a computer program**. The text of computer programs is called **a program code** \(or **a source code**, or even shorter – **code**\). ## Computer Programs -**Computer programs** represent **a sequence of commands** that are written in a previously chosen **programming language**, like C\#, Java, JavaScript, Python, Ruby, PHP, C, C++, Swift, Go or another. In order to write commands, we have to know **the syntax and the semantics of the language** which we are working with, in our case - **C\#**. This is why we are going to get familiar with the syntax and the semantics of the language C\#, and with programing generally, in the current book, by learning step by step code writing from the simpler to the more complex programming constructions. +**Computer programs** represent **a sequence of commands** that are written in a previously chosen **programming language**, like C\#, Java, JavaScript, Python, Ruby, PHP, C, C++, Swift, Go or another. In order to write commands, we have to know **the syntax and the semantics of the language** which we are working with, in our case – **C\#**. This is why we are going to get familiar with the syntax and the semantics of the language C\#, and with programing generally, in the current book, by learning step by step code writing from the simpler to the more complex programming constructions. ## Algorithms @@ -24,7 +24,7 @@ For convenience when creating programs, for writing programming code, for execut Some programming languages do not use a compiler and are being **interpreted directly** by a specialized software called an "interpreter". **The interpreter** is "**a program for executing programs**", written in some programming language. It executes the commands in the program one after another, as it understands not only a single command and sequences of commands, but also other language constructions \(evaluations, iterations, functions, etc.\). Languages like PHP, Python and JavaScript work with an interpreter and are being executed without being compiled. Due to the absence of previous compilation, in interpreted languages **the errors are being found during runtime**, after the program starts running, not previously. -**An environment for development** \(Integrated Development Environment - **IDE**\) is an union of traditional tools for development of software applications. In the development environment we write code, compile and execute the programs. Development environments integrate in them **a text editor** for writing code, **a programming language**, **a compiler or an interpreter** and **a runtime environment** for executing programs, **a debugger** for tracking the program and seeking out errors, **tools for user interface design** and other tools and add-ons. +**An environment for development** \(Integrated Development Environment – **IDE**\) is an union of traditional tools for development of software applications. In the development environment we write code, compile and execute the programs. Development environments integrate in them **a text editor** for writing code, **a programming language**, **a compiler or an interpreter** and **a runtime environment** for executing programs, **a debugger** for tracking the program and seeking out errors, **tools for user interface design** and other tools and add-ons. **Environments for development** are convenient, because they integrate everything necessary for the development of the program, without the need to exit the environment. If we don't use an environment for development, we will have to write the code in a text editor, to compile it with a command in the console, to run it with another command in the console and to write more additional commands when needed, which is very time consuming. That is why most of the programmers use an IDE in their everyday work. @@ -42,7 +42,7 @@ The majority of software that we use daily, like a music player, a video player, **C\# is a compiled language**, which means that we write commands that are being compiled before they're being executed. Exactly these commands, through a help program \(a compiler\), are being transformed into a file, which can be executed \(executable\). To write a language like **C\#** we need a text editor or a development environment and **.NET Runtime Environment**. -**.NET Runtime Environment** represents a virtual machine, something like a computer in the computer, which can run a compiled C\# code. With the risk of going too deep into details, we have to explain that the language C\# is compiled into an intermediary .NET code and is executed from the .NET environment, which compiles this intermediary code additionally into machine instructions \(machine code\) in order to be executed by the microprocessor. .NET environment contains libraries with classes, **CSC** compiler, **CLR** \(Common Language Runtime - CLR\) and other components, which are required for working with the language C\# and run C\# programs. +**.NET Runtime Environment** represents a virtual machine, something like a computer in the computer, which can run a compiled C\# code. With the risk of going too deep into details, we have to explain that the language C\# is compiled into an intermediary .NET code and is executed from the .NET environment, which compiles this intermediary code additionally into machine instructions \(machine code\) in order to be executed by the microprocessor. .NET environment contains libraries with classes, **CSC** compiler, **CLR** \(Common Language Runtime – CLR\) and other components, which are required for working with the language C\# and run C\# programs. **The .NET environment** is available as a free software with open source code for every modern operating system \(like Windows, Linux and Mac OS X\). It has two variations, **.NET Framework** \(the older one\) and **.NET Core** \(the newer one\), but none of that is essential when it comes to getting into programming. Let us focus on writing programs with the C\# language. diff --git a/Content/Chapter-1-first-steps-in-programming/how-to-write-console-app/example-creating-a-console-application.md b/Content/Chapter-1-first-steps-in-programming/how-to-write-console-app/example-creating-a-console-application.md index 845aee660..d33e28430 100644 --- a/Content/Chapter-1-first-steps-in-programming/how-to-write-console-app/example-creating-a-console-application.md +++ b/Content/Chapter-1-first-steps-in-programming/how-to-write-console-app/example-creating-a-console-application.md @@ -10,8 +10,8 @@ We set **a meaningful name** to our program, for example `HelloCSharp`:![](/asse The source code of the C\# program is written in the section `Main(string[] args)`, between the opening and the closing parentheses `{ }`. This is the main method \(action\), that is being executed with the start of a C\# program. This `Main()` method can be written in two ways: -* `static void Main(string[] args)` - with parameters from the command line \(we are not going into details\) -* `static void Main()` - without parameters from the command line. +* `static void Main(string[] args)` – with parameters from the command line \(we are not going into details\) +* `static void Main()` – without parameters from the command line. Both ways are valid, as **the second one is recommended**, because it is shorter and clearer. By default, though, when creating a console application, Visual Studio uses the first way, which we can edit manually if we want to, and delete the part with the parameters `string[] args`. @@ -70,7 +70,7 @@ In the table with the sent solutions the judge system is going to show one of th ### How to Register in SoftUni Judge? -Use your credentials \(username + password\) for the site softuni.bg. If you don't have a SoftUni registration, create one. It takes only a minute - a standard registration in an Internet site. +Use your credentials \(username + password\) for the site softuni.bg. If you don't have a SoftUni registration, create one. It takes only a minute – a standard registration in an Internet site. ## Testing the Programs That Play Notes diff --git a/Content/Chapter-1-first-steps-in-programming/overview.md b/Content/Chapter-1-first-steps-in-programming/overview.md index 09ee0d93a..ce97ae97e 100644 --- a/Content/Chapter-1-first-steps-in-programming/overview.md +++ b/Content/Chapter-1-first-steps-in-programming/overview.md @@ -1,12 +1,12 @@ # Chapter 1. First Steps in Programming In this chapter, we are going to find out **what programming is** in its core and how to write simple programs and apps. - - We will get familiar with the idea of **programming languages** and development platforms, along with concepts like **compilation** and code **execution**. - - We are going to take a look at the **environments for software development** (IDEs) and how to work with them, in particular with **Visual Studio**. - - We will write and execute our **first program** with the programming language **C#** in **Visual Studio**. - - We will **exercise** with a couple of tasks: we will create **console-based** programs, a graphical application (**GUI**) and a **Web** application. - - We will learn how to check the correctness of the solutions from this book in **the Judge system of SoftUni**. - - We will get to know some of the **typical mistakes**, which are often made during code writing and how to prevent doing them. +- We will get familiar with the idea of **programming languages** and development platforms, along with concepts like **compilation** and code **execution**. +- We are going to take a look at the **environments for software development** (IDEs) and how to work with them, in particular with **Visual Studio**. +- We will write and execute our **first program** with the programming language **C#** in **Visual Studio**. +- We will **exercise** with a couple of tasks: we will create **console-based** programs, a graphical application (**GUI**) and a **Web** application. +- We will learn how to check the correctness of the solutions from this book in **the Judge system of SoftUni**. +- We will get to know some of the **typical mistakes**, which are often made during code writing and how to prevent doing them. ## Video diff --git a/Content/Chapter-10-methods/exercises-methods/notifications.md b/Content/Chapter-10-methods/exercises-methods/notifications.md index bc1acffb0..6886b8068 100644 --- a/Content/Chapter-10-methods/exercises-methods/notifications.md +++ b/Content/Chapter-10-methods/exercises-methods/notifications.md @@ -1,9 +1,9 @@ # Problem: Notifications Write a program, which takes an integer **`n`** and on the next rows prints **`n`** **messages** (for each message read a few lines). Each message starts with **`messageType`**: **`success`**, **`warning`** or **`error`**: - - When **`messageType`** is **`success`** read **`operation`** + **`message`** (each on a new line). - - When **`messageType`** is **`warning`** read only **`message`**. - - When **`messageType`** is **`error`** read **`operation`** + **`message`** + **`errorCode`** (each on a new line). +- When **`messageType`** is **`success`** read **`operation`** + **`message`** (each on a new line). +- When **`messageType`** is **`warning`** read only **`message`**. +- When **`messageType`** is **`error`** read **`operation`** + **`message`** + **`errorCode`** (each on a new line). Print in the console **each read message**, formatted depending on its **`messageType`**. After the headline of the message print as much **`=`**, **as the length** of the said **headline** and print **an empty line** after each message (to understand in detail look at the examples). diff --git a/Content/Chapter-10-methods/exercises-methods/numbers-to-words/numbers-to-words.md b/Content/Chapter-10-methods/exercises-methods/numbers-to-words/numbers-to-words.md index ba298b730..c0638baf7 100644 --- a/Content/Chapter-10-methods/exercises-methods/numbers-to-words/numbers-to-words.md +++ b/Content/Chapter-10-methods/exercises-methods/numbers-to-words/numbers-to-words.md @@ -19,7 +19,7 @@ Write a method **`Letterize(number)`**, which reads an integer and prints it in ## Hints and Guidelines -We can first print **the hundreds** as a text - \(the number / 100\) % 10, after that **the tens** - \(the number / 10\) % 10 and at the end **the ones** - \(the number % 10\). +We can first print **the hundreds** as a text – \(the number / 100\) % 10, after that **the tens** – \(the number / 10\) % 10 and at the end **the ones** – \(the number % 10\). The first special case is when the number is exactly **rounded to 100** \(e.g. 100, 200, 300 etc.\). In this case we print "one-hundred", "two-hundred", "three-hundred" etc. diff --git a/Content/Chapter-10-methods/exercises-methods/string-encryption/string-encryption.md b/Content/Chapter-10-methods/exercises-methods/string-encryption/string-encryption.md index ca94620cb..e2b42e938 100644 --- a/Content/Chapter-10-methods/exercises-methods/string-encryption/string-encryption.md +++ b/Content/Chapter-10-methods/exercises-methods/string-encryption/string-encryption.md @@ -10,10 +10,10 @@ Write a method **`Encrypt(char letter)`**, which encrypts a given letter in the Example: * j → **p16i** - * ASCII code of **j** is **106** → First digit - **1**, last digit - **6**. + * ASCII code of **j** is **106** → First digit – **1**, last digit – **6**. * We concatenate the first and the last digit → **16**. * At **the beginning** of the string, which represents the result, concatenate the symbol, which you get from the sum of the ASCII code + the last digit → 106 + 6 → 112 → **p**. - * At **the end** of the string, which represents the result, concatenate the symbol, which you get from subtracting the ASCII code - the first digit → 106 - 1 → 105 → **i**. + * At **the end** of the string, which represents the result, concatenate the symbol, which you get from subtracting the ASCII code – the first digit → 106 - 1 → 105 → **i**. Using the method shown above, write a program which takes **a sequence of characters**, **encrypts them** and prints the result on one line. diff --git a/Content/Chapter-10-methods/methods-overloading/methods-overloading.md b/Content/Chapter-10-methods/methods-overloading/methods-overloading.md index dd0a131df..583cfa24f 100644 --- a/Content/Chapter-10-methods/methods-overloading/methods-overloading.md +++ b/Content/Chapter-10-methods/methods-overloading/methods-overloading.md @@ -22,7 +22,7 @@ As we mentioned, if you use **the same name for several methods with different s It is important to say that **the return type as a result** of the method **is not a part of its signature**. If the return type was a part of the signature, then the compiler doesn't know which method exactly to invoke. -Let's look at the following example - we have two methods with different return types. Despite that Visual Studio shows that there is a mistake, because both of their signatures are the same. Therefore when trying to invoke a method named **`Print(…)`**, the compiler can't know which of the two methods to run. +Let's look at the following example – we have two methods with different return types. Despite that Visual Studio shows that there is a mistake, because both of their signatures are the same. Therefore when trying to invoke a method named **`Print(…)`**, the compiler can't know which of the two methods to run. ![](/assets/chapter-10-images/17.Method-overloading-02.png) diff --git a/Content/Chapter-10-methods/methods-with-parameters/method-with-params.md b/Content/Chapter-10-methods/methods-with-parameters/method-with-params.md index 58d4c3cac..899c7678d 100644 --- a/Content/Chapter-10-methods/methods-with-parameters/method-with-params.md +++ b/Content/Chapter-10-methods/methods-with-parameters/method-with-params.md @@ -38,7 +38,7 @@ The first step is **creating** a method and giving it a descriptive name, e.g. * ![](/assets/chapter-10-images/06.Print-sign-01.png) -The next step is **implementing** the logic by which the program will check what the sign of the number is. You can see from the examples that there are three cases - the number is larger than, equal to or lower than zero, which means that we'll make three verifications in our method. +The next step is **implementing** the logic by which the program will check what the sign of the number is. You can see from the examples that there are three cases – the number is larger than, equal to or lower than zero, which means that we'll make three verifications in our method. The next step is to read the input number and to invoke the new method from the body of the **`Main`** method. @@ -76,7 +76,7 @@ Before creating a method to print a row with a given beginning and an end, we mu ![](/assets/chapter-10-images/08.Print-triangle-01.png) -From the drawing exercises we can remember, that it is good practice **to divide the figure into several parts**. to make it easier we will divide the triangle into three parts - upper, middle and lower. +From the drawing exercises we can remember, that it is good practice **to divide the figure into several parts**. to make it easier we will divide the triangle into three parts – upper, middle and lower. The next step is to print **the upper half** of the triangle using a loop: diff --git a/Content/Chapter-10-methods/nested-methods/nested-methods.md b/Content/Chapter-10-methods/nested-methods/nested-methods.md index 249dcca06..26adcc1e8 100644 --- a/Content/Chapter-10-methods/nested-methods/nested-methods.md +++ b/Content/Chapter-10-methods/nested-methods/nested-methods.md @@ -14,7 +14,7 @@ Local functions can be declared inside every other method. When the C# compiler With time and practice you will see that when you are writing code, you often need **methods that you only need once**, or the method we need gets very long. We said earlier that when a method contains too many lines of code it becomes hard to read and maintain. -This is where local functions come to help - they help us to **declare a new method in another one** we already have, and it will be used only once. This helps our code to be ordered better and **easier to read**, which helps for faster correction if there is an error in the code and limits the possibility for mistakes when making changes in the program logic. +This is where local functions come to help – they help us to **declare a new method in another one** we already have, and it will be used only once. This helps our code to be ordered better and **easier to read**, which helps for faster correction if there is an error in the code and limits the possibility for mistakes when making changes in the program logic. ## Declaring Local Functions diff --git a/Content/Chapter-10-methods/what-method-is/returning-multiple-values.md b/Content/Chapter-10-methods/what-method-is/returning-multiple-values.md index 66b2b95d0..4f135051d 100644 --- a/Content/Chapter-10-methods/what-method-is/returning-multiple-values.md +++ b/Content/Chapter-10-methods/what-method-is/returning-multiple-values.md @@ -1,6 +1,6 @@ # Methods Returning Multiple Values -There are cases in practice when we need a method to return more than one element as a result. For this to be possible **`ValueTuple`** has been integrated in Visual Studio and C# (onwards from C# 7), and also a literal of type **`ValueTuple`**. The type **`ValueTuple`** represents two values, which allow the temporary containing of **multiple values**. The values are contained in variables (fields - we will earn about them later) of the corresponding types. Although the type **`Tuple`** existed before C# 7, it didn't have good support in the older versions and it's ineffective. That's why in previous versions of C# the elements in one **`Tuple`** were shown as **`Item1`**, **`Item2`** etc. and the names of their variables (the variables in which they are contained) could not be changed. In C# 7 the type (**`ValueTuple`**) is maintained, which allows giving meaningful names to the elements in a **`ValueTuple`**. +There are cases in practice when we need a method to return more than one element as a result. For this to be possible **`ValueTuple`** has been integrated in Visual Studio and C# (onwards from C# 7), and also a literal of type **`ValueTuple`**. The type **`ValueTuple`** represents two values, which allow the temporary containing of **multiple values**. The values are contained in variables (fields – we will earn about them later) of the corresponding types. Although the type **`Tuple`** existed before C# 7, it didn't have good support in the older versions and it's ineffective. That's why in previous versions of C# the elements in one **`Tuple`** were shown as **`Item1`**, **`Item2`** etc. and the names of their variables (the variables in which they are contained) could not be changed. In C# 7 the type (**`ValueTuple`**) is maintained, which allows giving meaningful names to the elements in a **`ValueTuple`**. ## Declaring a ValueTuple @@ -18,7 +18,7 @@ We can see that it contains several **fields with names and values**, which were ## Method Returning Multiple Values -The following method takes as parameters two integers (**`x`** and **`y`**) and **returns two values** - the result of integer division and the remainder: +The following method takes as parameters two integers (**`x`** and **`y`**) and **returns two values** – the result of integer division and the remainder: ```csharp static (int result, int reminder) Divide(int x, int y) diff --git a/Content/Chapter-10-methods/what-method-is/what-method-is.md b/Content/Chapter-10-methods/what-method-is/what-method-is.md index fea18c353..525d16ae3 100644 --- a/Content/Chapter-10-methods/what-method-is/what-method-is.md +++ b/Content/Chapter-10-methods/what-method-is/what-method-is.md @@ -61,7 +61,7 @@ With the next example we will look at the obligatory elements in the declaration * **Parameter list**. It is declared between the parentheses **`(`** and **`)`**, which we write after its name. This is where we list all the **parameters**, which the method will use. There can be **only one** parameter, **multiple** ones or it could be an **empty** list. If there aren't any parameters, we will write only the parentheses **`()`**. In this example we declare the parameter **`double num`**. * **`static`** declaration in the method description. For the moment you can accept that we write **`static`** always when you declare a method, and later when we meet object oriented programming (OOP), you will learn about the difference between **static methods** (shared for the whole class) and **methods of an object**, which work on the data of a certain instance of the class (object). -When declaring methods you must follow the **sequence** of its base elements - first **type of the return value**, then **method name** and in the end **list of parameters**, surrounded by parentheses **`()`**. +When declaring methods you must follow the **sequence** of its base elements – first **type of the return value**, then **method name** and in the end **list of parameters**, surrounded by parentheses **`()`**. After we have declared a method, its **implementation (body)** follows. In the body of the method we write down **the algorithm**, by which it solves a problem, i.e. the body contains the code (program block), which realizes the methods **logic**. In the shown example we are calculating the area of a square, which is **`num * num`**. diff --git a/Content/Chapter-11-tricks-and-hacks/code-formatting/code-formatting.md b/Content/Chapter-11-tricks-and-hacks/code-formatting/code-formatting.md index 75b0d6790..67c23b95b 100644 --- a/Content/Chapter-11-tricks-and-hacks/code-formatting/code-formatting.md +++ b/Content/Chapter-11-tricks-and-hacks/code-formatting/code-formatting.md @@ -2,7 +2,7 @@ The right formatting of our code will make it **easier to read and understand** in case someone else needs to work with it. This is important, because in practice we will need to work in a teem with other people and it of great importance if we write our code in a way that our colleagues can **quickly orient** in it. -There are some defined rules for correct formatting of the code, which are collected in one place and are called **conventions**. The conventions are a group of rules, generally accepted by the programmers using a given language, which are massively used. These conventions help building norms in given languages - what is the best way to write and what are good practices. It is accepted that is a programmer follows them then his code is easy to read and understand. +There are some defined rules for correct formatting of the code, which are collected in one place and are called **conventions**. The conventions are a group of rules, generally accepted by the programmers using a given language, which are massively used. These conventions help building norms in given languages – what is the best way to write and what are good practices. It is accepted that is a programmer follows them then his code is easy to read and understand. The C# language is made by **Microsoft** and they are the people who define the best practices for writing. You should know that even if you don't follow the conventions given by **Microsoft**, your code will work (as long as it is properly written), but it will not be easy to understand. This, of course, is not fatal at base level, but the faster you get used to write quality code the better. @@ -38,7 +38,7 @@ if(someCondition){ Console.WriteLine("Inside the if statement");} ``` -The first thing that we see is **the curly brackets `{}`**. The first (opening) bracket should be **just below the `if` condition**, and the second (closing) bracket - **below the command `Console.WriteLine(…)`, at a new and empty row**. In addition, the command inside the **`if`** construction should be **offset by 4 white spaces (one tab)**. Just after the keyword **`if`** and before the condition you should put **an interval**. +The first thing that we see is **the curly brackets `{}`**. The first (opening) bracket should be **just below the `if` condition**, and the second (closing) bracket – **below the command `Console.WriteLine(…)`, at a new and empty row**. In addition, the command inside the **`if`** construction should be **offset by 4 white spaces (one tab)**. Just after the keyword **`if`** and before the condition you should put **an interval**. The same rule applies for **the `for` loops and all other constructions with curly brackets `{}`**. Here are some more examples: @@ -59,7 +59,7 @@ Console.WriteLine(i); ## Code Formatting Shortcuts in Visual Studio -For your comfort there are **keyboard shortcuts in Visual Studio**, which we will explain later in this chapter, but for now we are interested in 2 specific combinations. One of the combinations is for formatting **the code in the whole document**, and the other one - ofr formatting **a part of the code**. If we want to format **the whole code**we need to predd [**CTRL + K + D**]. In case we need to format only **a part of the code**, we need to **mark this part with the mouse** and press [**CTRL + K + F**]. +For your comfort there are **keyboard shortcuts in Visual Studio**, which we will explain later in this chapter, but for now we are interested in 2 specific combinations. One of the combinations is for formatting **the code in the whole document**, and the other one – ofr formatting **a part of the code**. If we want to format **the whole code**we need to predd [**CTRL + K + D**]. In case we need to format only **a part of the code**, we need to **mark this part with the mouse** and press [**CTRL + K + F**]. Let's use **the wrong example** from earlier: diff --git a/Content/Chapter-11-tricks-and-hacks/tricks/tricks.md b/Content/Chapter-11-tricks-and-hacks/tricks/tricks.md index 9d81390b3..fcc259833 100644 --- a/Content/Chapter-11-tricks-and-hacks/tricks/tricks.md +++ b/Content/Chapter-11-tricks-and-hacks/tricks/tricks.md @@ -10,7 +10,7 @@ Console.WriteLine("{0}", text); // This will print on the console "some text" ``` -In this case we are using a **placeholder** - `{x}`, where **x** is a number \(larger than or equal to 0\), corresponding to the position on which we have placed our variable. Therefore if we insert two variables, we will have one placeholder, which will be `{0}` and it will keep the value of **the first variable** and another one - `{1}`, which will keep the value of на **the second variable**. For example: +In this case we are using a **placeholder** – `{x}`, where **x** is a number \(larger than or equal to 0\), corresponding to the position on which we have placed our variable. Therefore if we insert two variables, we will have one placeholder, which will be `{0}` and it will keep the value of **the first variable** and another one – `{1}`, which will keep the value of на **the second variable**. For example: ```csharp var text = "some text"; @@ -34,7 +34,7 @@ Console.WriteLine(Math.Round(number, 2)); * the first one is **the number we want to round** * the second is the number which determines **to how much decimal places we want to round** \(this should always be an integer\) -If we want to round the number to **2 decimal places** and the third digit is lower than 5, as in the example above, the rounding is down, but if the third digit is equal or bigger than 5 - the rounding is up as in the example below: +If we want to round the number to **2 decimal places** and the third digit is lower than 5, as in the example above, the rounding is down, but if the third digit is equal or bigger than 5 – the rounding is up as in the example below: ```csharp var number = 5.439; @@ -44,9 +44,9 @@ Console.WriteLine(Math.Round(number, 2)); ## Other Rounding Methods -In case we always want to round down instead of `Math.Round(…)` we can use another method - `Math.Floor(…)`, which always rounds down, but also always rounds to an integer. For example if we have the number 5.99 and we use `Math.Floor(5.99)`, we will get the number **5**. +In case we always want to round down instead of `Math.Round(…)` we can use another method – `Math.Floor(…)`, which always rounds down, but also always rounds to an integer. For example if we have the number 5.99 and we use `Math.Floor(5.99)`, we will get the number **5**. -We can also do the exact opposite - to always round up using the method `Math.Ceiling(…)`. Again if we have for example 5.11 and we use `Math.Ceiling(5.11)`, we will get 6. Here are some examples: +We can also do the exact opposite – to always round up using the method `Math.Ceiling(…)`. Again if we have for example 5.11 and we use `Math.Ceiling(5.11)`, we will get 6. Here are some examples: ```csharp var numberToFloor = 5.99; diff --git a/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/1000-days-after-birth/1000-days-after-birth.md b/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/1000-days-after-birth/1000-days-after-birth.md index d2f6cacf4..d37460ee7 100644 --- a/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/1000-days-after-birth/1000-days-after-birth.md +++ b/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/1000-days-after-birth/1000-days-after-birth.md @@ -1,4 +1,4 @@ -# Problem: \*\* Date Calculations - 1000 Days on the Earth +# Problem: \*\* Date Calculations – 1000 Days on the Earth Write a program that enters **a birth date** in format `dd-MM-yyyy` and calculates the date on which **1000 days** are turned since this birth date, and prints it in the same format. diff --git a/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/blank-visual-studio-solution.md b/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/blank-visual-studio-solution.md index e057a22e3..b2b923a68 100644 --- a/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/blank-visual-studio-solution.md +++ b/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/blank-visual-studio-solution.md @@ -2,7 +2,7 @@ We start by creating an empty solution **\(Blank Solution\)** in Visual Studio. The solutions in Visual Studio combine **a group of projects**. This opportunity is **very convenient**, when we want to **work on a few projects** and switch quickly between them or we want to **unite logically a few interconnected projects**. -In the current practical exercise we will use a **Blank Solution with a couple of projects** to organize the solutions of the tasks from the exercises - every task in a separate project and all of them in a common solution. +In the current practical exercise we will use a **Blank Solution with a couple of projects** to organize the solutions of the tasks from the exercises – every task in a separate project and all of them in a common solution. * We start Visual Studio * We create a new **Blank Solution:** \[**File**\] -> \[**New**\] -> \[**Project**\]. diff --git a/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/celsius-to-fahrenheit/celsius-to-fahrenheit.md b/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/celsius-to-fahrenheit/celsius-to-fahrenheit.md index 84451f78c..9bd584a44 100644 --- a/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/celsius-to-fahrenheit/celsius-to-fahrenheit.md +++ b/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/celsius-to-fahrenheit/celsius-to-fahrenheit.md @@ -1,4 +1,4 @@ -# Problem: Console Converter - from °C Degrees to °F Degrees +# Problem: Console Converter – from °C Degrees to °F Degrees Write a program that reads **degrees on Celsius scale** \(°C\) and converts them to **degrees on Fahrenheit scale** \(°F\). Look on the Internet for a proper [formula](http://bfy.tw/3rGh "Търсене в Google") to do the calculations. Round the result to **2 digits after the decimal point**. Here are a few examples: diff --git a/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/exercises-simple-calculations.md b/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/exercises-simple-calculations.md index ae798a9f4..61009dfa9 100644 --- a/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/exercises-simple-calculations.md +++ b/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/exercises-simple-calculations.md @@ -25,9 +25,9 @@ We have a lot of practical work. Solve these exercises to learn how to work with * [Problem: Circle Area and Perimeter](/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/circle-area-and-perimeter/circle-area-and-perimeter.md) * [Problem: Rectangle Area](/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/rectangle-area/rectangle-area.md) * [Problem: Triangle Area](/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/triangle-area/triangle-area.md) -* [Problem: Console Converter - from °C Degrees to °F Degrees](/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/celsius-to-fahrenheit/celsius-to-fahrenheit.md) -* [Problem: Console Converter - from Radians to Degrees](/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/radians-to-degrees/radians-to-degrees.md) -* [Problem: Console Converter - USD to BGN](/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/usd-to-bgn/usd-to-bgn.md) +* [Problem: Console Converter – from °C Degrees to °F Degrees](/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/celsius-to-fahrenheit/celsius-to-fahrenheit.md) +* [Problem: Console Converter – from Radians to Degrees](/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/radians-to-degrees/radians-to-degrees.md) +* [Problem: Console Converter – USD to BGN](/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/usd-to-bgn/usd-to-bgn.md) * [Problem: \* Console Currency Converter](/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/currency-converter/currency-converter.md) * [Problem: \*\* Date Calculations](/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/1000-days-after-birth/1000-days-after-birth.md) diff --git a/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/radians-to-degrees/radians-to-degrees.md b/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/radians-to-degrees/radians-to-degrees.md index fe0da8be8..37b564486 100644 --- a/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/radians-to-degrees/radians-to-degrees.md +++ b/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/radians-to-degrees/radians-to-degrees.md @@ -1,4 +1,4 @@ -# Problem: Console Converter - from Radians to Degrees +# Problem: Console Converter – from Radians to Degrees Write a program, that reads **an angle in **[**radians**](https://bg.wikipedia.org/wiki/Радиан) \(`rad`\) and converts it to **\[degrees\]\(**[https://bg.wikipedia.org/wiki/Градус\_\(ъгъл](https://bg.wikipedia.org/wiki/Градус_%28ъгъл)**\)\)** \(`deg`\). Look for a proper formula on the Internet. The number **π** in C\# programs is available through `Math.PI`. Round the result to the nearest integer using the `Math.Round(…)` method. diff --git a/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/rectangle-area/rectangle-area.md b/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/rectangle-area/rectangle-area.md index 7091a736f..191ad65af 100644 --- a/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/rectangle-area/rectangle-area.md +++ b/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/rectangle-area/rectangle-area.md @@ -1,6 +1,6 @@ # Problem: Rectangle Area -A **rectangle** is defined by the **coordinates** of both of its opposite corners (x1, y1) – (x2, y2). Calculate its **area and perimeter**. **The input** is read from the console. The numbers **x1, y1, x2 and y2** are given one per line. **The output** is printed on the console and it has to contain two lines, each with one number - the area and the perimeter. +A **rectangle** is defined by the **coordinates** of both of its opposite corners (x1, y1) – (x2, y2). Calculate its **area and perimeter**. **The input** is read from the console. The numbers **x1, y1, x2 and y2** are given one per line. **The output** is printed on the console and it has to contain two lines, each with one number – the area and the perimeter. ![](/assets/chapter-2-images/07.Rectangle-area-01.png) diff --git a/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/usd-to-bgn/usd-to-bgn.md b/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/usd-to-bgn/usd-to-bgn.md index 5f12008c3..c175e1010 100644 --- a/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/usd-to-bgn/usd-to-bgn.md +++ b/Content/Chapter-2-1-simple-calculations/exercises-simple-calculations/usd-to-bgn/usd-to-bgn.md @@ -1,4 +1,4 @@ -# Problem: Console Converter - USD to BGN +# Problem: Console Converter – USD to BGN Write a program for **conversion of US dollars** \(USD\) **into Bulgarian levs** \(BGN\). **Round** the result to **2 digits** after the decimal point. Use a fixed rate between a dollar and lev: **1 USD = 1.79549 BGN**. diff --git a/Content/Chapter-2-1-simple-calculations/numerical-expressions/numerical-expressions.md b/Content/Chapter-2-1-simple-calculations/numerical-expressions/numerical-expressions.md index f82eaa3b7..fde9cd842 100644 --- a/Content/Chapter-2-1-simple-calculations/numerical-expressions/numerical-expressions.md +++ b/Content/Chapter-2-1-simple-calculations/numerical-expressions/numerical-expressions.md @@ -47,7 +47,7 @@ Formulas: Console.Write("Enter circle radius. r = "); var r = double.Parse(Console.ReadLine()); Console.WriteLine("Area = " + Math.PI * r * r); - // Math.PI - built in constant for π in C# + // Math.PI – built in constant for π in C# Console.WriteLine("Perimeter = " + 2 * Math.PI * r); ``` diff --git a/Content/Chapter-2-2-simple-calculations-exam-problems/exam-problems/daily-earnings/daily-earnings.md b/Content/Chapter-2-2-simple-calculations-exam-problems/exam-problems/daily-earnings/daily-earnings.md index f13664be5..e7fddcc4b 100644 --- a/Content/Chapter-2-2-simple-calculations-exam-problems/exam-problems/daily-earnings/daily-earnings.md +++ b/Content/Chapter-2-2-simple-calculations-exam-problems/exam-problems/daily-earnings/daily-earnings.md @@ -11,7 +11,7 @@ Ivan is a programmer in an **American company** and he **works** at home **appro ## Output Data -Print **one number** on the console - **the daily earnings in lev**. The result will be **rounded up to the second symbol after the decimal point**. +Print **one number** on the console – **the daily earnings in lev**. The result will be **rounded up to the second symbol after the decimal point**. ## Examples @@ -61,7 +61,7 @@ We could write an expression that calculates the annual income without brackets ### Printing the Result -Finally, we have to print the result on the console. We notice that **the number has to be rounded up to the second symbol after the decimal point**. In order to do that, we can use a **placeholder - an item that will be replaced by a particular value when printing**. In C#, a digit surrounded by curly brackets is used for a **placeholder**. As **in programming counting starts from 0**, the expression **`{0}`** means that it will be replaced by the first given argument. We can format an integer or a floating-point number by using **F** or **f**. That is followed by a whole positive number, which specifies the number of digits after the point (you can read more about formatting here: ([Svetlin Nakov, Veselin Kolev and team: "Programming Basics with C#", page. 155-158](http://www.introprogramming.info/intro-csharp-book/read-online/glava4-vhod-i-izhod-ot-konzolata/#_Toc298863992)): +Finally, we have to print the result on the console. We notice that **the number has to be rounded up to the second symbol after the decimal point**. In order to do that, we can use a **placeholder – an item that will be replaced by a particular value when printing**. In C#, a digit surrounded by curly brackets is used for a **placeholder**. As **in programming counting starts from 0**, the expression **`{0}`** means that it will be replaced by the first given argument. We can format an integer or a floating-point number by using **F** or **f**. That is followed by a whole positive number, which specifies the number of digits after the point (you can read more about formatting here: ([Svetlin Nakov, Veselin Kolev and team: "Programming Basics with C#", page. 155-158](http://www.introprogramming.info/intro-csharp-book/read-online/glava4-vhod-i-izhod-ot-konzolata/#_Toc298863992)): ![](/assets/chapter-2-2-images/05.Daily-earnings-03.png) diff --git a/Content/Chapter-2-2-simple-calculations-exam-problems/exam-problems/money/money.md b/Content/Chapter-2-2-simple-calculations-exam-problems/exam-problems/money/money.md index 1f7b8a282..c892e58a3 100644 --- a/Content/Chapter-2-2-simple-calculations-exam-problems/exam-problems/money/money.md +++ b/Content/Chapter-2-2-simple-calculations-exam-problems/exam-problems/money/money.md @@ -17,7 +17,7 @@ Three numbers are read from the console: * ## Output Data -Print one number on the console - **the result of the exchange of currencies**. Rounding is not necessary. +Print one number on the console – **the result of the exchange of currencies**. Rounding is not necessary. ## Sample Input and Output diff --git a/Content/Chapter-2-2-simple-calculations-exam-problems/exam-problems/vegetables-market/vegetables-market.md b/Content/Chapter-2-2-simple-calculations-exam-problems/exam-problems/vegetables-market/vegetables-market.md index 1b45dfc13..5e69acf87 100644 --- a/Content/Chapter-2-2-simple-calculations-exam-problems/exam-problems/vegetables-market/vegetables-market.md +++ b/Content/Chapter-2-2-simple-calculations-exam-problems/exam-problems/vegetables-market/vegetables-market.md @@ -5,10 +5,10 @@ A gardener is selling his harvest on the vegetables market. He is selling **vege ## Input Data **Four numbers** are read from the console, one per line: -* First line - Price per kilogram for vegetables - a floating-point number. -* Second line - Price per kilogram for fruits - a floating-point number. -* Third line - Total kilograms of vegetables - an integer. -* Fourth line - Total kilograms of fruits - an integer. +* First line: price per kilogram for vegetables – a floating-point number. +* Second line: price per kilogram for fruits – a floating-point number. +* Third line: total kilograms of vegetables – an integer. +* Fourth line: total kilograms of fruits – an integer. **Constraints: All numbers will be within the range from 0.00 to 1000.00** diff --git a/Content/Chapter-2-2-simple-calculations-exam-problems/overview.md b/Content/Chapter-2-2-simple-calculations-exam-problems/overview.md index 7e85e4abd..a12cfbac1 100644 --- a/Content/Chapter-2-2-simple-calculations-exam-problems/overview.md +++ b/Content/Chapter-2-2-simple-calculations-exam-problems/overview.md @@ -1,6 +1,6 @@ # Chapter 2.2. Simple Calculations – Exam Problems -In the previous chapter, we explained how to work with the system console - how to **read numbers** from it and how to **print the output**. We went through the main arithmetical operations and briefly mentioned data types. Now, we are going to practice what we have learned by solving a few **more complex exam problems**. +In the previous chapter, we explained how to work with the system console – how to **read numbers** from it and how to **print the output**. We went through the main arithmetical operations and briefly mentioned data types. Now, we are going to practice what we have learned by solving a few **more complex exam problems**. ## Simple Calculations – Quick Review diff --git a/Content/Chapter-3-1-simple-conditions/exercises-simple-conditions/area-of-figures/area-of-figures.md b/Content/Chapter-3-1-simple-conditions/exercises-simple-conditions/area-of-figures/area-of-figures.md index 11ae3cbbe..e415266ba 100644 --- a/Content/Chapter-3-1-simple-conditions/exercises-simple-conditions/area-of-figures/area-of-figures.md +++ b/Content/Chapter-3-1-simple-conditions/exercises-simple-conditions/area-of-figures/area-of-figures.md @@ -3,10 +3,10 @@ Write a program that **inputs the sizes of a geometric figure** and **calculates its area**. The figures are four types: **square**, **rectangle**, **circle** and **triangle**. The first line of the input reads the type of the figure (`square`, `rectangle`, `circle`, `triangle`). -* If the figure is a **square**, the next row reads one number - the length of its side. -* If the figure is a **rectangle**, on the next two rows we read two numbers - the lengths of its sides. -* If the figure is a **circle**, the next row reads one number - the radius of the circle. -* If the figure is a **triangle**, on the next two rows we read two numbers - the length of the side and the length of its height. +* If the figure is a **square**, the next row reads one number – the length of its side. +* If the figure is a **rectangle**, on the next two rows we read two numbers – the lengths of its sides. +* If the figure is a **circle**, the next row reads one number – the radius of the circle. +* If the figure is a **triangle**, on the next two rows we read two numbers – the length of the side and the length of its height. Round the result up to the **third digit after the decimal point**. diff --git a/Content/Chapter-3-1-simple-conditions/exercises-simple-conditions/bonus-score/bonus-score.md b/Content/Chapter-3-1-simple-conditions/exercises-simple-conditions/bonus-score/bonus-score.md index 3f01d9a27..221a888dc 100644 --- a/Content/Chapter-3-1-simple-conditions/exercises-simple-conditions/bonus-score/bonus-score.md +++ b/Content/Chapter-3-1-simple-conditions/exercises-simple-conditions/bonus-score/bonus-score.md @@ -1,6 +1,6 @@ # Problem: Bonus Score -We have an **integer** - the number of points. **Bonus score** are charged on it, according to the rules described below. Write a program that calculates **bonus score** for this figure and **total points** with bonuses. +We have an **integer** – the number of points. **Bonus score** are charged on it, according to the rules described below. Write a program that calculates **bonus score** for this figure and **total points** with bonuses. - If the number is **up to 100** including, bonus score is 5. - If the number is **larger than 100**, bonus score is **20%** of the number. @@ -20,7 +20,7 @@ We have an **integer** - the number of points. **Bonus score** are charged on it ## Tips and Tricks -We can calculate the main and additional bonus score with a series of **`if-else-if-else`** statements. For **the main bonus score we have 3 cases** (when the entered number is up to 100, between 100 and 1000 and larger than 1000), and for **extra bonus score - 2 more cases** (when the number is even and odd). +We can calculate the main and additional bonus score with a series of **`if-else-if-else`** statements. For **the main bonus score we have 3 cases** (when the entered number is up to 100, between 100 and 1000 and larger than 1000), and for **extra bonus score – 2 more cases** (when the number is even and odd). ![](/assets/chapter-3-images/06.Bonus-score-01.png) diff --git a/Content/Chapter-3-1-simple-conditions/exercises-simple-conditions/excellent-grade-or-not/excellent-grade-or-not.md b/Content/Chapter-3-1-simple-conditions/exercises-simple-conditions/excellent-grade-or-not/excellent-grade-or-not.md index 27563c103..3410a2836 100644 --- a/Content/Chapter-3-1-simple-conditions/exercises-simple-conditions/excellent-grade-or-not/excellent-grade-or-not.md +++ b/Content/Chapter-3-1-simple-conditions/exercises-simple-conditions/excellent-grade-or-not/excellent-grade-or-not.md @@ -15,9 +15,9 @@ The next exercise from this topic is to write a **console program** that **input First we create **a new C# console project** in the **Simple-Conditions** solution. - - We click on the solution in Solution Explorer and choose [**Add**] -> [**New Project**]. + * We click on the solution in Solution Explorer and choose [**Add**] -> [**New Project**]. - - We choose [**Visual C#**] -> [**Windows**] -> [**Console Application**] and specify a name, for example: “Excellent-or-Not”. + * We choose [**Visual C#**] -> [**Windows**] -> [**Console Application**] and specify a name, for example: “Excellent-or-Not”. Now we have to **write the code** of the program. You can get help by using the sample code from the picture: diff --git a/Content/Chapter-3-1-simple-conditions/exercises-simple-conditions/exercises-simple-conditions-part-2.md b/Content/Chapter-3-1-simple-conditions/exercises-simple-conditions/exercises-simple-conditions-part-2.md index 991edfc7a..3f20192de 100644 --- a/Content/Chapter-3-1-simple-conditions/exercises-simple-conditions/exercises-simple-conditions-part-2.md +++ b/Content/Chapter-3-1-simple-conditions/exercises-simple-conditions/exercises-simple-conditions-part-2.md @@ -4,7 +4,7 @@ Now let's **practice** the lessons learned in this chapter about of conditional ## Empty Visual Studio Solution (Blank Solution) -At the start we create a **Blank Solution** in Visual Studio to organize better the task solutions from the exercise - each task will be in a separate project and all projects will be in a common solution. +At the start we create a **Blank Solution** in Visual Studio to organize better the task solutions from the exercise – each task will be in a separate project and all projects will be in a common solution. We run Visual Studio and create a new **Blank Solution:** [**File**] -> [**New**] -> [**Project**]. diff --git a/Content/Chapter-3-1-simple-conditions/if-else-conditions/if-else-conditions.md b/Content/Chapter-3-1-simple-conditions/if-else-conditions/if-else-conditions.md index 1b852ba2f..b654b912f 100644 --- a/Content/Chapter-3-1-simple-conditions/if-else-conditions/if-else-conditions.md +++ b/Content/Chapter-3-1-simple-conditions/if-else-conditions/if-else-conditions.md @@ -1,6 +1,6 @@ # If-Else Conditions -The **`if`** construction may also contain an **`else`** clause to give a specific action in case the boolean expression (which is set at the beginning **`if (boolean expression)`** ) returns a negative result (**`false`**). Built this way, **the conditional statement** is called **`if-else`** and its behavior is as follows: if the result of the condition is **positive** (**`true`**) - we perform some actions, when it is **negative** (**`false`**) - others. The format of the construction is: +The **`if`** construction may also contain an **`else`** clause to give a specific action in case the boolean expression (which is set at the beginning **`if (boolean expression)`** ) returns a negative result (**`false`**). Built this way, **the conditional statement** is called **`if-else`** and its behavior is as follows: if the result of the condition is **positive** (**`true`**) – we perform some actions, when it is **negative** (**`false`**) – others. The format of the construction is: ```csharp if (condition) diff --git a/Content/Chapter-3-2-simple-conditions-exam-problems/exam-problems/pipes-in-pool/pipes-in-pool.md b/Content/Chapter-3-2-simple-conditions-exam-problems/exam-problems/pipes-in-pool/pipes-in-pool.md index cf0035ad2..cd5413503 100644 --- a/Content/Chapter-3-2-simple-conditions-exam-problems/exam-problems/pipes-in-pool/pipes-in-pool.md +++ b/Content/Chapter-3-2-simple-conditions-exam-problems/exam-problems/pipes-in-pool/pipes-in-pool.md @@ -15,7 +15,7 @@ A pool with **volume V** fills up via **two pipes**. **Each pipe has a certain f Print on the console **one of the two possible states**: * To what extent the pool has filled up and how many percent each pipe has contributed with. All percents must be formatted to an integer (without rounding). * "The pool is **[x]**% full. Pipe 1: **[y]**%. Pipe 2: **[z]**%." -* If the pool has overflown - with how many liters it has overflown for the given time - a floating-point number. +* If the pool has overflown – with how many liters it has overflown for the given time – a floating-point number. * "For **[x]** hours the pool overflows with **[y]** liters." **Have in mind** that due to **the rounding to an integer**, there is **data loss** and it is normal **the sum of the percents to be 99%, not 100%**. @@ -50,7 +50,7 @@ The ratio has to be in **percentage**, that is why all the calculations so far w ![](/assets/chapter-3-2-images/02.Pipes-in-pool-03.png) -However, if **the condition** returns **`false`**, that means that **the quantity of water** is **more** than the **volume** of the pool, therefore, it has **overflown**. Again, the output data has to be on **one line**, but this time it should contain only **two values** - the one of the **hours** when the worker was absent, and the **quantity of water**, which is the **difference** between **the incoming water** and **the volume of the pool**. +However, if **the condition** returns **`false`**, that means that **the quantity of water** is **more** than the **volume** of the pool, therefore, it has **overflown**. Again, the output data has to be on **one line**, but this time it should contain only **two values** – the one of the **hours** when the worker was absent, and the **quantity of water**, which is the **difference** between **the incoming water** and **the volume of the pool**. ## Testing in the Judge System diff --git a/Content/Chapter-3-2-simple-conditions-exam-problems/exam-problems/sleepy-tom-cat/sleepy-tom-cat.md b/Content/Chapter-3-2-simple-conditions-exam-problems/exam-problems/sleepy-tom-cat/sleepy-tom-cat.md index 5427ee623..8567cf11d 100644 --- a/Content/Chapter-3-2-simple-conditions-exam-problems/exam-problems/sleepy-tom-cat/sleepy-tom-cat.md +++ b/Content/Chapter-3-2-simple-conditions-exam-problems/exam-problems/sleepy-tom-cat/sleepy-tom-cat.md @@ -10,7 +10,7 @@ Write a program that receives **the number of holidays** and prints whether **To ## Input Data -The input is read from the console and consists of an integer - **the number of holidays** in the range of [**0 … 365**]. +The input is read from the console and consists of an integer – **the number of holidays** in the range of [**0 … 365**]. ## Output Data @@ -62,7 +62,7 @@ Here we have to note that if the total **time for play** of Tom is **less** than ### Checking the Conditions -The time for games is already calculated, which leads us to the **next** step - **comparing** the **time for play** of Tom with the **norm** on which the good sleep of the cat depends. For that we will use an **`if-else`** conditional statement. In the **`if` clause** we will check whether **the time for play is more than 30 000** (the norm). +The time for games is already calculated, which leads us to the **next** step – **comparing** the **time for play** of Tom with the **norm** on which the good sleep of the cat depends. For that we will use an **`if-else`** conditional statement. In the **`if` clause** we will check whether **the time for play is more than 30 000** (the norm). ### Processing the Output Data diff --git a/Content/Chapter-3-2-simple-conditions-exam-problems/overview.md b/Content/Chapter-3-2-simple-conditions-exam-problems/overview.md index ea300dea1..152862cd2 100644 --- a/Content/Chapter-3-2-simple-conditions-exam-problems/overview.md +++ b/Content/Chapter-3-2-simple-conditions-exam-problems/overview.md @@ -16,8 +16,8 @@ else `if`** conditions** consist of: * `if`** clause** -* boolean expression - a variable of boolean type \(`bool`\) or boolean logical expression \(an expression that results in `true/false`\) -* condition body - contains random block of source code +* boolean expression – a variable of boolean type \(`bool`\) or boolean logical expression \(an expression that results in `true/false`\) +* condition body – contains random block of source code * `else`** clause** and its block of source code \(**optional**\) ## Exam Problems diff --git a/Content/Chapter-4-1-complex-conditions/complex-conditions/complex-conditions.md b/Content/Chapter-4-1-complex-conditions/complex-conditions/complex-conditions.md index 5b714e4fe..ae36e4afc 100644 --- a/Content/Chapter-4-1-complex-conditions/complex-conditions/complex-conditions.md +++ b/Content/Chapter-4-1-complex-conditions/complex-conditions/complex-conditions.md @@ -4,7 +4,7 @@ Let's take a look at how we can create more complex logical conditions. We can u ## Logical "AND" -As we saw, in some tasks we have to make **many checks at once**. But what happens when in order to execute some code **more** conditions have to be executed and we **don't want to** make a **negation** (**`else`**) for each one of them? The option with nested **`if` blocks** is valid, but the code would look very **unordered** and for sure - **hard** to read and maintain. +As we saw, in some tasks we have to make **many checks at once**. But what happens when in order to execute some code **more** conditions have to be executed and we **don't want to** make a **negation** (**`else`**) for each one of them? The option with nested **`if` blocks** is valid, but the code would look very **unordered** and for sure – **hard** to read and maintain. The logical "**AND**" (operator **`&&`**) means a few conditions have to be **fulfilled simultaneously**. The following table of truthfulness is applicable: diff --git a/Content/Chapter-4-1-complex-conditions/complex-logical-conditions/complex-logical-conditions.md b/Content/Chapter-4-1-complex-conditions/complex-logical-conditions/complex-logical-conditions.md index 087067a02..db2334ddc 100644 --- a/Content/Chapter-4-1-complex-conditions/complex-logical-conditions/complex-logical-conditions.md +++ b/Content/Chapter-4-1-complex-conditions/complex-logical-conditions/complex-logical-conditions.md @@ -4,7 +4,7 @@ Sometimes the conditions may be **very complex**, so they can require a long boo ## Example: Point on a Rectangle Side -Write a program that checks whether a **point {x, y}** is placed **onto any of the sides of a rectangle {x1, y1} - {x2, y2}**. The input data is read from the console and consists of 6 rows: the decimal numbers **x1**, **y1**, **x2**, **y2**, **x** and **y** (as it is guaranteed that **x1 < x2** and **y1 < y2**). Print "**Border**" (if the point lies on any of the sides) or "**Inside / Outside**" (in the opposite case). +Write a program that checks whether a **point {x, y}** is placed **onto any of the sides of a rectangle {x1, y1} – {x2, y2}**. The input data is read from the console and consists of 6 rows: the decimal numbers **x1**, **y1**, **x2**, **y2**, **x** and **y** (as it is guaranteed that **x1 < x2** and **y1 < y2**). Print "**Border**" (if the point lies on any of the sides) or "**Inside / Outside**" (in the opposite case). ![](/assets/chapter-4-images/06.Point-on-rectangle-border-01.png) diff --git a/Content/Chapter-4-1-complex-conditions/exercises-complex-conditions/volleyball/problem-cinema.md b/Content/Chapter-4-1-complex-conditions/exercises-complex-conditions/volleyball/problem-cinema.md index c83187e33..a5e95d460 100644 --- a/Content/Chapter-4-1-complex-conditions/exercises-complex-conditions/volleyball/problem-cinema.md +++ b/Content/Chapter-4-1-complex-conditions/exercises-complex-conditions/volleyball/problem-cinema.md @@ -4,9 +4,9 @@ In a cinema hall the chairs are ordered in a **rectangle** shape in **r** rows a * **Premiere** – a premiere screening, with price **12.00** levs. * **Normal** – a standard screening, with price **7.50** levs. -* **Discount** – a screening for children and students on a reduced price - **5.00** levs. +* **Discount** – a screening for children and students on a reduced price – **5.00** levs. -Write a program that enters a **type of screening** (string), number of **rows** and number of **columns** in the hall (integer numbers) and calculates **the total income** from tickets from a **full hall**. The result has to be printed in the same format as in the examples below - rounded up to 2 digits after the decimal point. +Write a program that enters a **type of screening** (string), number of **rows** and number of **columns** in the hall (integer numbers) and calculates **the total income** from tickets from a **full hall**. The result has to be printed in the same format as in the examples below – rounded up to 2 digits after the decimal point. ## Sample Input and Output diff --git a/Content/Chapter-4-1-complex-conditions/graphical-app/graphical-app.md b/Content/Chapter-4-1-complex-conditions/graphical-app/graphical-app.md index 219ee2f8e..67eae5771 100644 --- a/Content/Chapter-4-1-complex-conditions/graphical-app/graphical-app.md +++ b/Content/Chapter-4-1-complex-conditions/graphical-app/graphical-app.md @@ -72,7 +72,7 @@ We have to catch the following **events** to write the C# code that will be exec * The event **`Load`** of the form **`FormPointAndRectangle`** (it is called upon starting the application, before the main form is shown on the dispaly). * The event **`Resize`** of the form **`FormPointAndRectangle`** (it is called upon changing the size of the main form). -All of the above mentioned events will execute the same action - **`Draw()`**, which will visualize the rectangle and the point and show whether it's inside, outside or onto one of the sides. The code must look like this: +All of the above mentioned events will execute the same action – **`Draw()`**, which will visualize the rectangle and the point and show whether it's inside, outside or onto one of the sides. The code must look like this: ```csharp private void buttonDraw_Click(object sender, EventArgs e) diff --git a/Content/Chapter-4-1-complex-conditions/nested-conditions/nested-conditions.md b/Content/Chapter-4-1-complex-conditions/nested-conditions/nested-conditions.md index f5ff90ac8..f1bf350e7 100644 --- a/Content/Chapter-4-1-complex-conditions/nested-conditions/nested-conditions.md +++ b/Content/Chapter-4-1-complex-conditions/nested-conditions/nested-conditions.md @@ -21,9 +21,9 @@ Nesting of **more than three conditional statements** inside each other is not c ## Example: Titles According to Age and Sex Depending on **age** (decimal number and **gender** (**m** / **f**), print a personal title: -* “**Mr.**” – a man (gender “**m**”) - 16 or more years old. +* “**Mr.**” – a man (gender “**m**”) – 16 or more years old. * “**Master**” – a boy (gender “**m**”) under 16 years. -* “**Ms.**” – a woman (gender “**f**”) - 16 or more years old. +* “**Ms.**” – a woman (gender “**f**”) – 16 or more years old. * “**Miss**” – a girl (gender “**f**”) under 16 years. ### Sample Input and Output @@ -72,7 +72,7 @@ Calculate the price by the given **city** (string), **product** (string) and **q ### Solution -We **convert** all of the letters into **lower register** using the function **`.ToLower()`**, in order to compare products and cities **no matter** what the letters are - small or capital ones. +We **convert** all of the letters into **lower register** using the function **`.ToLower()`**, in order to compare products and cities **no matter** what the letters are – small or capital ones. ![](/assets/chapter-4-images/02.Small-shop-01.png) diff --git a/Content/Chapter-4-2-complex-conditions-exam-problems/exam-problems/hotel-room/hotel-room.md b/Content/Chapter-4-2-complex-conditions-exam-problems/exam-problems/hotel-room/hotel-room.md index b0c6721b4..4203252d7 100644 --- a/Content/Chapter-4-2-complex-conditions-exam-problems/exam-problems/hotel-room/hotel-room.md +++ b/Content/Chapter-4-2-complex-conditions-exam-problems/exam-problems/hotel-room/hotel-room.md @@ -49,7 +49,7 @@ We will read the input data and do the calculations according to the provided pr ### Processing the Input Data -According to the task requirements we expect to receive two rows of input data - on the first row **the month in which the stay is planned**, and on the second one - **the number of stays**. +According to the task requirements we expect to receive two rows of input data – on the first row **the month in which the stay is planned**, and on the second one – **the number of stays**. Let's process and store the input data in the appropriate parameters: @@ -67,7 +67,7 @@ In general, there are different approaches and ways to apply the above condition ### Calculating Prices for Stay in May and October -Let's start with the first group of months: **May** and **October**. For these two months **the price for stay is the same** for both types of accommodation - in a **studio** or in an **apartment**. Therefore, the only thing that remains is to apply an internal condition regarding the **number of stays**, and recalculate **the relevant price** (if needed). +Let's start with the first group of months: **May** and **October**. For these two months **the price for stay is the same** for both types of accommodation – in a **studio** or in an **apartment**. Therefore, the only thing that remains is to apply an internal condition regarding the **number of stays**, and recalculate **the relevant price** (if needed). ![](/assets/chapter-4-2-images/05.Hotel-room-03.png) @@ -81,7 +81,7 @@ To some extent, the **logic** and **calculations** will be **identical** for the ### Formatting the Output Data -After calculating the relevant prices and the total amount for the stay, now let's prepare the formatted result. Before that, we should store it in our output **parameters** - **`studioInfo`** and **`apartmentInfo`**. +After calculating the relevant prices and the total amount for the stay, now let's prepare the formatted result. Before that, we should store it in our output **parameters** – **`studioInfo`** and **`apartmentInfo`**. ![](/assets/chapter-4-2-images/05.Hotel-room-06.png) diff --git a/Content/Chapter-4-2-complex-conditions-exam-problems/exam-problems/match-tickets/match-tickets.md b/Content/Chapter-4-2-complex-conditions-exam-problems/exam-problems/match-tickets/match-tickets.md index 672b5fb5f..3beddbc65 100644 --- a/Content/Chapter-4-2-complex-conditions-exam-problems/exam-problems/match-tickets/match-tickets.md +++ b/Content/Chapter-4-2-complex-conditions-exam-problems/exam-problems/match-tickets/match-tickets.md @@ -66,7 +66,7 @@ Let's review the requirements once again. We need to perform **two** different b By the first set of calculations we must understand what part of the budget has to be spent on **transportation**. You will notice that the logic for doing these calculations only depends on the **number of people in the group**. Therefore, we will do a logical breakdown according to the number of football fans. -We will use conditional statement - a sequence of **`if-else`** blocks. +We will use conditional statement – a sequence of **`if-else`** blocks. ![](/assets/chapter-4-2-images/04.Match-tickets-03.png) diff --git a/Content/Chapter-4-2-complex-conditions-exam-problems/exam-problems/on-time-for-the-exam/on-time-for-the-exam.md b/Content/Chapter-4-2-complex-conditions-exam-problems/exam-problems/on-time-for-the-exam/on-time-for-the-exam.md index 516d06bb9..7005ce214 100644 --- a/Content/Chapter-4-2-complex-conditions-exam-problems/exam-problems/on-time-for-the-exam/on-time-for-the-exam.md +++ b/Content/Chapter-4-2-complex-conditions-exam-problems/exam-problems/on-time-for-the-exam/on-time-for-the-exam.md @@ -70,7 +70,7 @@ What remains is to calculate the difference between the two times, in order to d Our next step is to do the required **checks and calculations**, and finally we will print the output. Let's separate the code into **two** parts: -- First, let's show when the student arrived - were they **early**, **late** or **on time**. In order to do that, we will use an **`if-else`** statement. +- First, let's show when the student arrived – were they **early**, **late** or **on time**. In order to do that, we will use an **`if-else`** statement. - After that, we will show the **time difference**, if the student arrives in a **different time** compared to the **exam starting time**. In order to spare one additional check (**`else`**), we can, by default, assume that the student was late. @@ -87,7 +87,7 @@ Finally, we need to understand and print **what is the time difference between e We check whether the time difference is **more than** one hour, in order to print hours and minutes in the required **format**, or **less than** one hour, in order to print **only minutes** as a format and description. -We also need to do one more check - whether the time of student's arrival is **before** or **after** the exam start time. +We also need to do one more check – whether the time of student's arrival is **before** or **after** the exam start time. ![](/assets/chapter-4-2-images/01.On-time-for-the-exam-07.png) @@ -97,7 +97,7 @@ Finally, what remains is to print the result in the console. According to the re ![](/assets/chapter-4-2-images/01.On-time-for-the-exam-08.png) -Actually, for the purposes of the task, printing the result **in the console** can be done on a much earlier stage - during the calculations. This, however, is not a very good practice. **Why?** +Actually, for the purposes of the task, printing the result **in the console** can be done on a much earlier stage – during the calculations. This, however, is not a very good practice. **Why?** Let's examine the idea that our code is not 10 rows, but 100 or 1000! One day, printing the result will not be done in the console, but will be written in a **file** or displayed as a **web application**. Then, how many places in the code you will make changes at, due to such a correction? Are you sure you won't miss some places? diff --git a/Content/Chapter-4-2-complex-conditions-exam-problems/exam-problems/operations/operations.md b/Content/Chapter-4-2-complex-conditions-exam-problems/exam-problems/operations/operations.md index 117127c83..720d951b9 100644 --- a/Content/Chapter-4-2-complex-conditions-exam-problems/exam-problems/operations/operations.md +++ b/Content/Chapter-4-2-complex-conditions-exam-problems/exam-problems/operations/operations.md @@ -42,7 +42,7 @@ The problem is not complex, but there are a lot of code rows to write. ### Processing the Input Data -Upon reading the requirements, we understand that we expect **three** rows of input data. The first **two** rows pass **integers** (within the specified range), and the third row - **an arithmetical symbol**. +Upon reading the requirements, we understand that we expect **three** rows of input data. The first **two** rows pass **integers** (within the specified range), and the third row – **an arithmetical symbol**. ![](/assets/chapter-4-2-images/03.Operations-01.png) @@ -58,7 +58,7 @@ Therefore, we can first check if the second number is **`0`** (zero), as well as ![](/assets/chapter-4-2-images/03.Operations-03.jpg) -Let's place the output as a value upon initializing the **`output`** parameter. This way we can apply **only one condition** - whether it is needed to **recalculate** or **replace** this output. +Let's place the output as a value upon initializing the **`output`** parameter. This way we can apply **only one condition** – whether it is needed to **recalculate** or **replace** this output. Based on the approach that we choose, our next condition will be either a simple **`else`** or a single **`if`**. In the body of this condition, using additional conditions regarding the manner of calculating the output based on the passed operator, we can separate the logic based on the **structure** of the expected **output**. diff --git a/Content/Chapter-4-2-complex-conditions-exam-problems/exam-problems/trip/trip.md b/Content/Chapter-4-2-complex-conditions-exam-problems/exam-problems/trip/trip.md index df72b739d..642e9bcb3 100644 --- a/Content/Chapter-4-2-complex-conditions-exam-problems/exam-problems/trip/trip.md +++ b/Content/Chapter-4-2-complex-conditions-exam-problems/exam-problems/trip/trip.md @@ -4,7 +4,7 @@ It is strange, but most people start planning their vacations well in advance. A Write a program that accepts **as input the budget and season**, and **as output** displays programmer's **vacation place** and **the amount of money they will spend**. -**The budget determines the destination, and the season determines what amount of the budget will be spent**. If the season is **summer**, the programmer will go **camping**, if it is **winter - they will stay in a hotel**. If it is in **Europe**, **regardless of the season**, the programmer will stay in a **hotel**. Each **camp** or **hotel**, **according to the destination**, has **its own price**, which corresponds to a particular **percentage of the budget**: +**The budget determines the destination, and the season determines what amount of the budget will be spent**. If the season is **summer**, the programmer will go **camping**, if it is **winter – they will stay in a hotel**. If it is in **Europe**, **regardless of the season**, the programmer will stay in a **hotel**. Each **camp** or **hotel**, **according to the destination**, has **its own price**, which corresponds to a particular **percentage of the budget**: - If **100 BGN or less** – somewhere in **Bulgaria**. - **Summer** – **30%** of the budget. @@ -19,7 +19,7 @@ Write a program that accepts **as input the budget and season**, and **as output The input data will be read from the console and will consist of **two rows**: -- On the **first** row we receive **the budget** - **real number** in the range [**10.00 … 5000.00**]. +- On the **first** row we receive **the budget** – **real number** in the range [**10.00 … 5000.00**]. - On the **second** row – **one** of two possible seasons: "**summer**" or "**winter**". ## Output Data @@ -47,7 +47,7 @@ Typically, as for the other tasks, we can separate the solution into the followi ### Processing the Input Data -While reading carefully the requirements, we understand that we expect **two** rows of input data. The first parameter is a **real number**, for which we need to pick an appropriate variable type. For higher level of calculation accuracy we can pick **`decimal`** as a variable for the budget and - **`string`** for the season. +While reading carefully the requirements, we understand that we expect **two** rows of input data. The first parameter is a **real number**, for which we need to pick an appropriate variable type. For higher level of calculation accuracy we can pick **`decimal`** as a variable for the budget and – **`string`** for the season. ![](/assets/chapter-4-2-images/02.Trip-01.png) @@ -71,7 +71,7 @@ When examining once again the problem requirements, we notice that the main dist Based on the way we arrange the logical scheme (the order in which we will check the border values), we will have more or less conditions in the solution. **Why?** -After that, we need to apply a condition to check the value of the **season**. Based on it, we will determine what percentage of the budget will be spent, as well as where the programmer will stay - in a **hotel** or a **camp**. +After that, we need to apply a condition to check the value of the **season**. Based on it, we will determine what percentage of the budget will be spent, as well as where the programmer will stay – in a **hotel** or a **camp**. ### Calculations @@ -87,7 +87,7 @@ When examining once again the problem requirements, we notice that the main dist Based on the way we arrange the logical scheme (the order in which we will check the border values), we will have more or less conditions in the solution. **Why?** -After that, we need to apply a condition to check the value of the **season**. Based on it, we will determine what percentage of the budget will be spent, as well as where the programmer will stay - in a **hotel** or a **camp**. +After that, we need to apply a condition to check the value of the **season**. Based on it, we will determine what percentage of the budget will be spent, as well as where the programmer will stay – in a **hotel** or a **camp**. ### Printing the Result diff --git a/Content/Chapter-5-1-loops/examples-for-loops/example-left-and-right-sum/example-left-and-right-sum.md b/Content/Chapter-5-1-loops/examples-for-loops/example-left-and-right-sum/example-left-and-right-sum.md index 5f03f7fbd..4c84042bd 100644 --- a/Content/Chapter-5-1-loops/examples-for-loops/example-left-and-right-sum/example-left-and-right-sum.md +++ b/Content/Chapter-5-1-loops/examples-for-loops/example-left-and-right-sum/example-left-and-right-sum.md @@ -10,7 +10,7 @@ Write a program that converts **2 \* n integers** and checks whether **the sum o ## Tips and Tricks -We will first input the number **n**, after that the first **n** numbers (**left** half) and sum them up. We will then proceed with inputting more **n** numbers (**the right** half) and sum them up. We calculate the **difference** between the sums by absolute value: **`Math.Abs(leftSum - rightSum)`**. If the difference is **0**, print **"Yes" + the sum**, otherwise - print **"No" + the difference**. +We will first input the number **n**, after that the first **n** numbers (**left** half) and sum them up. We will then proceed with inputting more **n** numbers (**the right** half) and sum them up. We calculate the **difference** between the sums by absolute value: **`Math.Abs(leftSum - rightSum)`**. If the difference is **0**, print **"Yes" + the sum**, otherwise print **"No" + the difference**. ![](/assets/chapter-5-images/07.Left-and-right-sum-01.png) diff --git a/Content/Chapter-5-1-loops/examples-for-loops/example-sum-numbers/example-sum-numbers.md b/Content/Chapter-5-1-loops/examples-for-loops/example-sum-numbers/example-sum-numbers.md index 4c8fd0e8e..08ed6181b 100644 --- a/Content/Chapter-5-1-loops/examples-for-loops/example-sum-numbers/example-sum-numbers.md +++ b/Content/Chapter-5-1-loops/examples-for-loops/example-sum-numbers/example-sum-numbers.md @@ -19,11 +19,11 @@ Write a program that **inputs `n` integers and sums them up**. ## Tips and Tricks We can solve the problem with summing up numbers in the following way: - - We read the input number **`n`**. - - We initially start with a sum **`sum = 0`**. - - We run a loop from 1 to **`n`**. On each step of the loop, we read the a number **`num`** and add it to the sum **`sum`**. - - Finally, we print the calculated amount **`sum`**. - +- We read the input number **`n`**. +- We initially start with a sum **`sum = 0`**. +- We run a loop from 1 to **`n`**. On each step of the loop, we read the a number **`num`** and add it to the sum **`sum`**. +- Finally, we print the calculated amount **`sum`**. + Below is the source code for the solution: ![](/assets/chapter-5-images/04.Sum-numbers-01.png) diff --git a/Content/Chapter-5-1-loops/exercises-loops/equal-pairs.md b/Content/Chapter-5-1-loops/exercises-loops/equal-pairs.md index 5eac00806..756898272 100644 --- a/Content/Chapter-5-1-loops/exercises-loops/equal-pairs.md +++ b/Content/Chapter-5-1-loops/exercises-loops/equal-pairs.md @@ -2,7 +2,7 @@ There are **2 \* n numbers**. The first and the second number form a **pair**, the third and the fourth number also, and so on. Each pair has a **value** – the sum of its numbers. Write a program that checks **if all pairs have equal value**. -In case the value is the same, print **"Yes, value=…" + the value**, otherwise, print the **maximum difference** between two neighboring pairs in the following format - **"No, maxdiff=…" + the maximum difference**. +In case the value is the same, print **"Yes, value=…" + the value**, otherwise, print the **maximum difference** between two neighboring pairs in the following format: **"No, maxdiff=…" + the maximum difference**. The input consists of the number **n**, followed by **2*n integers**, all of them one per row. @@ -19,7 +19,7 @@ The input consists of the number **n**, followed by **2*n integers**, all of the ## Tips and Tricks -We read the input numbers **in pairs**. For each pair we calculate its **sum**. While reading the input pairs, for each pair except the first one, we must calculate **the difference compared to the previous one**. In order to do that, we need to store as a separate variable the sum of the previous pair. Finally, we find the **largest difference** between two pairs. If it is **0**, print **“Yes”** + the value, otherwise - **“No”** + the difference. +We read the input numbers **in pairs**. For each pair we calculate its **sum**. While reading the input pairs, for each pair except the first one, we must calculate **the difference compared to the previous one**. In order to do that, we need to store as a separate variable the sum of the previous pair. Finally, we find the **largest difference** between two pairs. If it is **0**, print **“Yes”** + the value, otherwise – **“No”** + the difference. ## Testing in the Judge System diff --git a/Content/Chapter-5-1-loops/exercises-loops/half-sum-element.md b/Content/Chapter-5-1-loops/exercises-loops/half-sum-element.md index 3cb90e933..783efba6a 100644 --- a/Content/Chapter-5-1-loops/exercises-loops/half-sum-element.md +++ b/Content/Chapter-5-1-loops/exercises-loops/half-sum-element.md @@ -1,6 +1,6 @@ # Problem: Element Equal to the Sum of the Rest -Write a program that inputs **n integers** and checks whether among them there is a number equal to the sum of all the rest. If there is such an element, print **"Yes" + its value**, otherwise - **"No" + the difference between the largest element and the sum of the rest** (by absolute value). +Write a program that inputs **n integers** and checks whether among them there is a number equal to the sum of all the rest. If there is such an element, print **"Yes" + its value**, otherwise – **"No" + the difference between the largest element and the sum of the rest** (by absolute value). ## Sample Input and Output diff --git a/Content/Chapter-5-2-loops-exam-problems/exam-problems/division/division.md b/Content/Chapter-5-2-loops-exam-problems/exam-problems/division/division.md index 75f038b5f..cca722a07 100644 --- a/Content/Chapter-5-2-loops-exam-problems/exam-problems/division/division.md +++ b/Content/Chapter-5-2-loops-exam-problems/exam-problems/division/division.md @@ -35,7 +35,7 @@ We have **n integers** in the range of [**1 ... 1000**]. Among them, **some perc ## Input Data -On the first line of the input is the integer **n** (1 ≤ **n** ≤ 1000) - count of numbers. On each of the next **n lines** we have **one integer** in the range of [**1 … 1000**] – numbers that needs to be checked for division. +On the first line of the input is the integer **n** (1 ≤ **n** ≤ 1000) – count of numbers. On each of the next **n lines** we have **one integer** in the range of [**1 … 1000**] – numbers that needs to be checked for division. ## Output Data diff --git a/Content/Chapter-5-2-loops-exam-problems/exam-problems/histogram/histogram.md b/Content/Chapter-5-2-loops-exam-problems/exam-problems/histogram/histogram.md index 65c572732..9060af934 100644 --- a/Content/Chapter-5-2-loops-exam-problems/exam-problems/histogram/histogram.md +++ b/Content/Chapter-5-2-loops-exam-problems/exam-problems/histogram/histogram.md @@ -18,7 +18,7 @@ On the first line of the input there is an integer **n** (1 ≤ **n** ≤ 1000) ## Output Data -Print on the console a **histogram that consists of 5 lines**, each of them containing a number within the range of 0% - 100%, formatted up to two digits after the decimal point (for example 25.00%, 66.67%, 57.14%). +Print on the console a **histogram that consists of 5 lines**, each of them containing a number within the range of [0% … 100%], formatted up to two digits after the decimal point (for example 25.00%, 66.67%, 57.14%). ## Sample Input and Output @@ -127,9 +127,9 @@ To make it even clearer, let's take a look at the following example: In this case **`n = 3`**. For the loop we have: - - **`i = 0`** - we read the number 1, which is less than 200 and falls into the first group (**`p1`**), and increase the group count (**`cntP1`**) by 1. - - **`i = 1`** – we read the number 2, which again falls into the first group (**`p1`**) and increase its count (**`cntP1`**) again by 1. - - **`i = 2`** – we read the number 999, which falls into the last group (**`p5`**), because its bigger than 800, and increase the count of the group (**`cntP5`**) with 1. +- **`i = 0`** – we read the number 1, which is less than 200 and falls into the first group (**`p1`**), and increase the group count (**`cntP1`**) by 1. +- **`i = 1`** – we read the number 2, which again falls into the first group (**`p1`**) and increase its count (**`cntP1`**) again by 1. +- **`i = 2`** – we read the number 999, which falls into the last group (**`p5`**), because its bigger than 800, and increase the count of the group (**`cntP5`**) with 1. After reading the numbers in group **`p1`** we have 2 numbers, and in **`p5`** we have 1 number. We have **no numbers** in the other groups. By applying the above formula, we calculate the percentages of each group. If we multiply in the formula by **100**, instead of **100.0** we will receive for group **`p1`** 66%, and for group **`p5`** – 33% (without fractional part). diff --git a/Content/Chapter-5-2-loops-exam-problems/exam-problems/hospital/calc-treated-and-untreated-patients.md b/Content/Chapter-5-2-loops-exam-problems/exam-problems/hospital/calc-treated-and-untreated-patients.md index 741091f36..cb63bac1a 100644 --- a/Content/Chapter-5-2-loops-exam-problems/exam-problems/hospital/calc-treated-and-untreated-patients.md +++ b/Content/Chapter-5-2-loops-exam-problems/exam-problems/hospital/calc-treated-and-untreated-patients.md @@ -2,7 +2,7 @@ ![](/assets/chapter-5-2-images/04.Hospital-02.png) -With the help of a **`for` loop** we iterate through all days in the given period (**`period`**). For each day, we read from the console the number of the patients (**`currentPatients`**). Increasing doctors by requirements can be done **every third day**, **BUT** only if the count of untreated patients is **greater** than the count of treated ones. For this purpose, we check if the day is third one - with the arithmetical operator for division with remainder (**`%`**): **`day % 3 == 0`**. +With the help of a **`for` loop** we iterate through all days in the given period (**`period`**). For each day, we read from the console the number of the patients (**`currentPatients`**). Increasing doctors by requirements can be done **every third day**, **BUT** only if the count of untreated patients is **greater** than the count of treated ones. For this purpose, we check if the day is third one – with the arithmetical operator for division with remainder (**`%`**): **`day % 3 == 0`**. For example: * If the day is **third one**, the remainder of the division by **3** will be **0** (**`3 % 3 = 0`**) and the check **`day % 3 == 0`** will return **`true`**. @@ -12,8 +12,8 @@ For example: If **`day % 3 == 0`** returns **`true`**, the system will check whether the count of untreated patients is greater than the count of treated ones: **`untreatedPatients > treatedPatients`**. If the result is again **`true`**, then the count of doctors will be increased (**`countOfDoctors`**). Then we check if the count of the patients for the day (**`currentPatients`**) is greater than the count of doctors (**`countOfDoctors`**). If the count of the patients is **greater**: - - Increase the value of the variable **`treatedPatients`** by the count of doctors (**`countOfDoctors`**). - - Increase the value of the variable **`untreatеdPatients`** by the count of the remaining patients, which we calculate by subtracting the count of doctors from the count of patients (**`currentPatients - countOfDoctors`**). +- Increase the value of the variable **`treatedPatients`** by the count of doctors (**`countOfDoctors`**). +- Increase the value of the variable **`untreatеdPatients`** by the count of the remaining patients, which we calculate by subtracting the count of doctors from the count of patients (**`currentPatients - countOfDoctors`**). If the count of patients **is not greater**, increase only the variable **`treatedPatients`** with the count of patients for the day (**`currentPatients`**). diff --git a/Content/Chapter-5-2-loops-exam-problems/exam-problems/hospital/hospital.md b/Content/Chapter-5-2-loops-exam-problems/exam-problems/hospital/hospital.md index 549048635..429139898 100644 --- a/Content/Chapter-5-2-loops-exam-problems/exam-problems/hospital/hospital.md +++ b/Content/Chapter-5-2-loops-exam-problems/exam-problems/hospital/hospital.md @@ -72,7 +72,7 @@ The period in which we have to make the calculations is read from the console an ![](/assets/chapter-5-2-images/04.Hospital-02.png) -With the help of a **`for` loop** we iterate through all days in the given period (**`period`**). For each day, we read from the console the number of the patients (**`currentPatients`**). Increasing doctors by requirements can be done **every third day**, **BUT** only if the count of untreated patients is **greater** than the count of treated ones. For this purpose, we check if the day is third one - with the arithmetical operator for division with remainder (**`%`**): **`day % 3 == 0`**. +With the help of a **`for` loop** we iterate through all days in the given period (**`period`**). For each day, we read from the console the number of the patients (**`currentPatients`**). Increasing doctors by requirements can be done **every third day**, **BUT** only if the count of untreated patients is **greater** than the count of treated ones. For this purpose, we check if the day is third one – with the arithmetical operator for division with remainder (**`%`**): **`day % 3 == 0`**. For example: * If the day is **third one**, the remainder of the division by **3** will be **0** (**`3 % 3 = 0`**) and the check **`day % 3 == 0`** will return **`true`**. @@ -82,8 +82,8 @@ For example: If **`day % 3 == 0`** returns **`true`**, the system will check whether the count of untreated patients is greater than the count of treated ones: **`untreatedPatients > treatedPatients`**. If the result is again **`true`**, then the count of doctors will be increased (**`countOfDoctors`**). Then we check if the count of the patients for the day (**`currentPatients`**) is greater than the count of doctors (**`countOfDoctors`**). If the count of the patients is **greater**: - - Increase the value of the variable **`treatedPatients`** by the count of doctors (**`countOfDoctors`**). - - Increase the value of the variable **`untreatеdPatients`** by the count of the remaining patients, which we calculate by subtracting the count of doctors from the count of patients (**`currentPatients - countOfDoctors`**). +- Increase the value of the variable **`treatedPatients`** by the count of doctors (**`countOfDoctors`**). +- Increase the value of the variable **`untreatеdPatients`** by the count of the remaining patients, which we calculate by subtracting the count of doctors from the count of patients (**`currentPatients - countOfDoctors`**). If the count of patients **is not greater**, increase only the variable **`treatedPatients`** with the count of patients for the day (**`currentPatients`**). diff --git a/Content/Chapter-5-2-loops-exam-problems/exam-problems/smart-lily/smart-lily.md b/Content/Chapter-5-2-loops-exam-problems/exam-problems/smart-lily/smart-lily.md index 6ec724c48..69b48a140 100644 --- a/Content/Chapter-5-2-loops-exam-problems/exam-problems/smart-lily/smart-lily.md +++ b/Content/Chapter-5-2-loops-exam-problems/exam-problems/smart-lily/smart-lily.md @@ -5,10 +5,9 @@ Lilly is **N years** old. For each **birthday** she receives a present. For each ## Input Data We read from the console **3 numbers**, each on a separate line: - - - Lilly's **age** – **integer** in the range of [**1 … 77**]. - - **Price of the washing machine** – number in the range of [**1.00 … 10 000.00**]. - - **Unit price of each toy** – **integer** in the range of [**0 … 40**]. +- Lilly's **age** – **integer** in the range of [**1 … 77**]. +- **Price of the washing machine** – number in the range of [**1.00 … 10 000.00**]. +- **Unit price of each toy** – **integer** in the range of [**0 … 40**]. ## Output Data @@ -67,7 +66,7 @@ To solve the problem we will need several helper variables – for the **count o ![](/assets/chapter-5-2-images/02.Smart-lilly-03.png) -With a **`for` loop** we iterate through every Lilly's birthday. When the leading variable is an **even number**, that means that Lilly **has received money** and we add this money to her total savings. At the same time, we **subtract 1 lev** - the money that her brother took. Then we **increase** the value of the variable **`moneyForBirthday`**, i.e. we increase by 10 the sum that she will receive on her next birthday. On the contrary, when the leading variable is an **odd number**, we increase the count of **toys**. We do the parity check by **division with remainder** (**`%`**) **by 2** - when the remainder is 0, the figure is even, and in case of remainder 1 - it is odd. +With a **`for` loop** we iterate through every Lilly's birthday. When the leading variable is an **even number**, that means that Lilly **has received money** and we add this money to her total savings. At the same time, we **subtract 1 lev** – the money that her brother took. Then we **increase** the value of the variable **`moneyForBirthday`**, i.e. we increase by 10 the sum that she will receive on her next birthday. On the contrary, when the leading variable is an **odd number**, we increase the count of **toys**. We do the parity check by **division with remainder** (**`%`**) **by 2** – when the remainder is 0, the figure is even, and in case of remainder 1 – it is odd. We also add the money from the sold toys to Lilly's savings. diff --git a/Content/Chapter-5-2-loops-exam-problems/overview.md b/Content/Chapter-5-2-loops-exam-problems/overview.md index 9d5fe7f13..ba4cf698c 100644 --- a/Content/Chapter-5-2-loops-exam-problems/overview.md +++ b/Content/Chapter-5-2-loops-exam-problems/overview.md @@ -13,7 +13,7 @@ Before we start working, it will be good to review again the `for`** loop** cons * Initialization block in which the variable-counter is declared \(`var i`\) and its initial value is set. * Repeat condition \(`i <= 10`\), executing once, before each iteration of the loop. * Restarting the counter \(`i++`\) – this code is executed after each iteration. -* Body of the loop - contains random block of source code. +* Body of the loop – contains random block of source code. ## Exam Problems diff --git a/Content/Chapter-6-1-nested-loops/drawing-more-complex-figures/house/house.md b/Content/Chapter-6-1-nested-loops/drawing-more-complex-figures/house/house.md index 1c3ab947b..52c3d694d 100644 --- a/Content/Chapter-6-1-nested-loops/drawing-more-complex-figures/house/house.md +++ b/Content/Chapter-6-1-nested-loops/drawing-more-complex-figures/house/house.md @@ -32,7 +32,7 @@ We understand from the problem explanation that the house is with size of **`n` * The height is **`n`** rows. * It is made out of **stars** and **pipes**. -* Each row comprises of 2 **pipes** - one in the beginning and one in the end of the row, and also **stars** between the pipes with string length of **`n - 2`**. +* Each row comprises of 2 **pipes** – one in the beginning and one in the end of the row, and also **stars** between the pipes with string length of **`n - 2`**. ### Reading the Input Data diff --git a/Content/Chapter-6-1-nested-loops/nested-loops/example-rhombus-of-stars.md b/Content/Chapter-6-1-nested-loops/nested-loops/example-rhombus-of-stars.md index ec7f651ef..0a509c48a 100644 --- a/Content/Chapter-6-1-nested-loops/nested-loops/example-rhombus-of-stars.md +++ b/Content/Chapter-6-1-nested-loops/nested-loops/example-rhombus-of-stars.md @@ -12,7 +12,7 @@ Write a program that takes a positive integer **n** and prints **a rhombus made ## Hints and Guidelines -To solve this problem we need to mentally **divide** **the rhombus** into **two parts** - **upper** one, which **also** includes the middle row, and **lower** one. For **the printing** of each part we will use **two** separate loops, as we leave the reader to decide the dependency between **`n`** and the variables of the loops. For the first loop we can use the following guidelines: +To solve this problem we need to mentally **divide** **the rhombus** into **two parts** – **upper** one, which **also** includes the middle row, and **lower** one. For **the printing** of each part we will use **two** separate loops, as we leave the reader to decide the dependency between **`n`** and the variables of the loops. For the first loop we can use the following guidelines: * We print **`n-row`** white spaces. * We print **`*`**. diff --git a/Content/Chapter-6-1-nested-loops/nested-loops/nested-loops.md b/Content/Chapter-6-1-nested-loops/nested-loops/nested-loops.md index bd7efe367..fdddbcbbd 100644 --- a/Content/Chapter-6-1-nested-loops/nested-loops/nested-loops.md +++ b/Content/Chapter-6-1-nested-loops/nested-loops/nested-loops.md @@ -2,10 +2,10 @@ Nested loops is a construction where **in the body of one loop** (outer one) **another loop is run** (inner one). In each iteration of the outer loop, **the whole** inner loop is executed. This happens in the following way: - - When nested loops start executing, **the outer loop starts** first: the controlling variable is **initialized** and after a check for ending the loop the code in its body is executed. - - After that, **the inner loop is executed**. The controlling variables start position is initialized, a check for ending the loop is made and the code in its body is executed. - - When reaching the the set value for **ending the loop**, the program goes back one step up and continues executing the previous (outer) loop. The controlling variable of the outer loop changes with one step, a check is made to see if the condition for ending the loop is met and **a new execution of the nested (inner) loop is started**. - - This is repeated until the variable of the outer loop meets the condition to **end the loop**. +- When nested loops start executing, **the outer loop starts** first: the controlling variable is **initialized** and after a check for ending the loop the code in its body is executed. +- After that, **the inner loop is executed**. The controlling variables start position is initialized, a check for ending the loop is made and the code in its body is executed. +- When reaching the the set value for **ending the loop**, the program goes back one step up and continues executing the previous (outer) loop. The controlling variable of the outer loop changes with one step, a check is made to see if the condition for ending the loop is met and **a new execution of the nested (inner) loop is started**. +- This is repeated until the variable of the outer loop meets the condition to **end the loop**. ## Nested Loops – Examples diff --git a/Content/Chapter-6-2-nested-loops-exam-problems/exam-problems/arrow/arrow.md b/Content/Chapter-6-2-nested-loops-exam-problems/exam-problems/arrow/arrow.md index 62b463fe8..7ea613a0b 100644 --- a/Content/Chapter-6-2-nested-loops-exam-problems/exam-problems/arrow/arrow.md +++ b/Content/Chapter-6-2-nested-loops-exam-problems/exam-problems/arrow/arrow.md @@ -8,7 +8,7 @@ The input is **an odd integer n** within the range [**3 … 79**]. ## Output Data -Print a vertical arrow on the console, in which "**`#`**" (number sign) marks the outline of the arrow, and "**`.`**" - the rest. +Print a vertical arrow on the console, in which "**`#`**" (number sign) marks the outline of the arrow, and "**`.`**" – the rest. ## Sample Input and Output @@ -26,7 +26,7 @@ From the explanation we see that **the input data** will be read from one row on ![](/assets/chapter-6-2-images/04.Arrow-01.png) -We can divide the figure into **3 parts** - upper, middle and lower one. **The upper part** contains two subparts - a first row and a body of the arrow. We can see from the examples that the count of **the outer dots** on the first row and in the body of the arrow is **`(n - 1) / 2`**. We can write this value in **a variable** **`outerDots`**. +We can divide the figure into **3 parts** – upper, middle and lower one. **The upper part** contains two subparts – a first row and a body of the arrow. We can see from the examples that the count of **the outer dots** on the first row and in the body of the arrow is **`(n - 1) / 2`**. We can write this value in **a variable** **`outerDots`**. ![](/assets/chapter-6-2-images/04.Arrow-02.png) diff --git a/Content/Chapter-6-2-nested-loops-exam-problems/exam-problems/axe/axe.md b/Content/Chapter-6-2-nested-loops-exam-problems/exam-problems/axe/axe.md index 4a52c60e7..af2967af8 100644 --- a/Content/Chapter-6-2-nested-loops-exam-problems/exam-problems/axe/axe.md +++ b/Content/Chapter-6-2-nested-loops-exam-problems/exam-problems/axe/axe.md @@ -42,7 +42,7 @@ We can draw **the handle of the axe** by creating a loop, which runs **`n - 2`** ## Printing the Lower Part of the Axe -We need to divide **the lower part** of the figure into two subparts - **head of the axe** and **the last row of the figure**. We will print **the head of the axe** on the console by creating a loop that runs **`n / 2 - 1`** times. At each iteration **the left dashes** and **the right dashes** decrease by 1, and **the middle dashes** increase by 2. +We need to divide **the lower part** of the figure into two subparts – **head of the axe** and **the last row of the figure**. We will print **the head of the axe** on the console by creating a loop that runs **`n / 2 - 1`** times. At each iteration **the left dashes** and **the right dashes** decrease by 1, and **the middle dashes** increase by 2. ![](/assets/chapter-6-2-images/05.Axe-05.png) diff --git a/Content/Chapter-6-2-nested-loops-exam-problems/exam-problems/butterfly/butterfly.md b/Content/Chapter-6-2-nested-loops-exam-problems/exam-problems/butterfly/butterfly.md index f41b036c9..1ef40318a 100644 --- a/Content/Chapter-6-2-nested-loops-exam-problems/exam-problems/butterfly/butterfly.md +++ b/Content/Chapter-6-2-nested-loops-exam-problems/exam-problems/butterfly/butterfly.md @@ -26,7 +26,7 @@ We can see in the explanation that **the input data** will be taken from only on ![](/assets/chapter-6-2-images/02.Butterfly-01.png) -We can divide the figure into 3 parts - upper wing, body and lower wing. In order to draw the upper wing, we need to divide it into parts - beginning **`*`**, middle part **`\ /`** and end **`*`**. After looking at the examples we find out that the beginning is with size **`n - 2`**. +We can divide the figure into 3 parts – upper wing, body and lower wing. In order to draw the upper wing, we need to divide it into parts – beginning **`*`**, middle part **`\ /`** and end **`*`**. After looking at the examples we find out that the beginning is with size **`n - 2`**. ![](/assets/chapter-6-2-images/02.Butterfly-02.png) @@ -34,7 +34,7 @@ We can also see that the upper wing is with size **`n - 2`**, and that's why we ![](/assets/chapter-6-2-images/02.Butterfly-03.png) -We can see in the examples that on an even row we have a beginning **`*`**, a middle part **`\ /`** and an end **`*`**, and on an odd row - beginning **`-`**, middle part **`\ /`** and an end **`-`**. This is why we must add an **`if-else`** condition to check if the row is even or odd and then to draw one of the two types of rows. +We can see in the examples that on an even row we have a beginning **`*`**, a middle part **`\ /`** and an end **`*`**, and on an odd row – beginning **`-`**, middle part **`\ /`** and an end **`-`**. This is why we must add an **`if-else`** condition to check if the row is even or odd and then to draw one of the two types of rows. ![](/assets/chapter-6-2-images/02.Butterfly-04.png) diff --git a/Content/Chapter-6-2-nested-loops-exam-problems/exam-problems/stop/stop.md b/Content/Chapter-6-2-nested-loops-exam-problems/exam-problems/stop/stop.md index 2d67e1afe..327dd6885 100644 --- a/Content/Chapter-6-2-nested-loops-exam-problems/exam-problems/stop/stop.md +++ b/Content/Chapter-6-2-nested-loops-exam-problems/exam-problems/stop/stop.md @@ -26,7 +26,7 @@ We can see from the explanation that **the input data** will be taken from only ![](/assets/chapter-6-2-images/03.Stop-01.png) -We can **divide** the figure into **3 parts** - upper, middle and lower. **The upper part** contains two subparts - first row and rows in which the sign widens. **The first row** is made of a beginning **`.`**, middle part **`_`** and an end **`.`**. After looking at the examples we can say that the beginning is **`n + 1`** columns wide so it is good to write this **value** in a separate **variable**. +We can **divide** the figure into **3 parts** – upper, middle and lower. **The upper part** contains two subparts – first row and rows in which the sign widens. **The first row** is made of a beginning **`.`**, middle part **`_`** and an end **`.`**. After looking at the examples we can say that the beginning is **`n + 1`** columns wide so it is good to write this **value** in a separate **variable**. ![](/assets/chapter-6-2-images/03.Stop-02.png) @@ -54,7 +54,7 @@ In each following iteration **the beginning** and **the end** decrease by 1, and ![](/assets/chapter-6-2-images/03.Stop-07.png) -**The lower part** of the figure, in which the width of the sign **decreases**, can be done by creating another **loop**, which runs **`n`** times. The structure of a row is - a beginning **`.`** + **`\\`**, middle part **`_`** and an end **`//`** + **`.`**. The number of **the dots** in the first iteration should be 0 and in each following one it **increases** by one. Therefore we can say that the size of **the dots in the lower part of the figure** equals **`i`**. +**The lower part** of the figure, in which the width of the sign **decreases**, can be done by creating another **loop**, which runs **`n`** times. The structure of a row is – a beginning **`.`** + **`\\`**, middle part **`_`** and an end **`//`** + **`.`**. The number of **the dots** in the first iteration should be 0 and in each following one it **increases** by one. Therefore we can say that the size of **the dots in the lower part of the figure** equals **`i`**. ![](/assets/chapter-6-2-images/03.Stop-08.png) diff --git a/Content/Chapter-7-1-complex-loops/do-while-loop/do-while-loop.md b/Content/Chapter-7-1-complex-loops/do-while-loop/do-while-loop.md index 1b03e26be..d234588fd 100644 --- a/Content/Chapter-7-1-complex-loops/do-while-loop/do-while-loop.md +++ b/Content/Chapter-7-1-complex-loops/do-while-loop/do-while-loop.md @@ -13,7 +13,7 @@ For natural **n** number, calculate **n! = 1 \* 2 \* 3 \* … \* n**. For exampl Here is how we can specifically calculate factorial: * We create the variable **`n`** to which we assign an integer value taken from the console input. - * We create another variable - a **`fact`** which initial value is 1. We will use it for the calculation and storage of the factorial. + * We create another variable – a **`fact`** which initial value is 1. We will use it for the calculation and storage of the factorial. * For a loop condition, we will use **`n > 1`**, because each time we perform the calculations in the body of the loop, we will decrease the value of **`n`** by 1. * In the body of the loop: * We assign a new value to **`fact`** that is the result of multiplying the current **`fact`** value to the current value of **`n`**. @@ -33,7 +33,7 @@ Sum up the digits of a **positive** integer **n**. For example, if **n = 5634**, We can use the following idea to solve the problem: * We create the variable **`n`**, to which we assign a value equal to the number entered by the user. - * We create a second variable - **`sum`**, which initial value is 0. We will use it for the calculation and storage of the result. + * We create a second variable – **`sum`**, which initial value is 0. We will use it for the calculation and storage of the result. * For a loop condition, we will use **`n > 0`** because after each calculation of the result in the body of the loop, we will remove the last digit of **`n`**. * In the body of the loop: * We assign a new value of **`sum`** that is the result of the sum of the current value of **`sum`** with the last digit of **`n`**. diff --git a/Content/Chapter-7-1-complex-loops/exercises-with-loops/number-pyramid/number-pyramid.md b/Content/Chapter-7-1-complex-loops/exercises-with-loops/number-pyramid/number-pyramid.md index 24247d587..859637977 100644 --- a/Content/Chapter-7-1-complex-loops/exercises-with-loops/number-pyramid/number-pyramid.md +++ b/Content/Chapter-7-1-complex-loops/exercises-with-loops/number-pyramid/number-pyramid.md @@ -17,7 +17,7 @@ We can solve the problem with **two nested loops** (by rows and columns) with pr * We create an **outer** **`for`** loop that will be responsible for the **rows** in the table. We name the variable of the loop **`row`** and set an initial value of 0. For condition, we set **`row < n`**. The size of the step is 1. * In the body of the loop we create an **inner** **`for`** loop that will be responsible for the **columns** in the table. We name the variable of the loop **`col`** and set an initial value of 0. For a condition, we set **`col < row`** (**`row`** = number of digits per line). The size of the step is 1. * In the body of the nested loop: - * We check if **`col > 1`**, if yes - we print space. If we do not do this, but directly print the space, we will have an unnecessary one at the beginning of each line. + * We check if **`col > 1`**, if yes –> we print space. If we do not do this, but directly print the space, we will have an unnecessary one at the beginning of each line. * **We print** the number **`num`** in the current cell of the table and **increase it by 1**. * We are checking for **`num > n`**. If **`num`** is greater than **`n`**, **we interrupt** the running of **the inner loop**. * We print **a blank line** to move to the next one. diff --git a/Content/Chapter-7-1-complex-loops/exercises-with-loops/number-table/number-table.md b/Content/Chapter-7-1-complex-loops/exercises-with-loops/number-table/number-table.md index fb0e320e5..890ad3c44 100644 --- a/Content/Chapter-7-1-complex-loops/exercises-with-loops/number-table/number-table.md +++ b/Content/Chapter-7-1-complex-loops/exercises-with-loops/number-table/number-table.md @@ -17,7 +17,7 @@ We can solve the problem using **two nested loops** and little calculations insi * In **the body of the loop** we create a nested **`for`** loop that will be responsible for the columns in the table. We name the loop variable **`col`** and assign it an initial **value of 0**. As a condition, we set **`col < n`**. The size of the step is 1. * In **the body of the nested loop**: * We create a **`num`** variable to which we assign the result of **the current row + the current column + 1** (+1 as we start the count from 0). - * We check for **`num > n`**. If **`num`** **is greater** than n, we assign a new value to **`num`** which is equal to **two times n - the current value for `num`**. We do this in order not to exceed **`n`** in any of the cells in the table. + * We check for **`num > n`**. If **`num`** **is greater** than n, we assign a new value to **`num`** which is equal to **two times n – the current value for `num`**. We do this in order not to exceed **`n`** in any of the cells in the table. * We print the number from the current table cell. * We print **a blank line** in the outer loop to move to the next row. diff --git a/Content/Chapter-7-1-complex-loops/greatest-common-divisor/greatest-common-divisor.md b/Content/Chapter-7-1-complex-loops/greatest-common-divisor/greatest-common-divisor.md index 9c9170cff..e3335d7cf 100644 --- a/Content/Chapter-7-1-complex-loops/greatest-common-divisor/greatest-common-divisor.md +++ b/Content/Chapter-7-1-complex-loops/greatest-common-divisor/greatest-common-divisor.md @@ -15,7 +15,7 @@ Before proceeding to the next problem, we will get familiar with the definition ## The Euclidean Algorithm -In the next problem we will use one of the first published algorithms for finding the GCD - **Euclid's algorithm**. +In the next problem we will use one of the first published algorithms for finding the GCD – **Euclid's algorithm**. **Until** we reach a remainder of 0: diff --git a/Content/Chapter-7-1-complex-loops/infinite-loops/infinite-loops.md b/Content/Chapter-7-1-complex-loops/infinite-loops/infinite-loops.md index ad80132f7..6acd3d4a0 100644 --- a/Content/Chapter-7-1-complex-loops/infinite-loops/infinite-loops.md +++ b/Content/Chapter-7-1-complex-loops/infinite-loops/infinite-loops.md @@ -74,7 +74,7 @@ Test your solution here: [https://judge.softuni.bg/Contests/Practice/Index/514#9 ## Example: Infinite Loop with Break -Write a program that checks if a particular number **n** is even, and if it is - to print it on the screen. An even number is one that can be divided by 2 without remainder. If an invalid number is entered, the system should ask the user to enter it again and display notification that the input number is not even. +Write a program that checks if a particular number **n** is even, and if it is – to print it on the screen. An even number is one that can be divided by 2 without remainder. If an invalid number is entered, the system should ask the user to enter it again and display notification that the input number is not even. Here is an idea how we can solve the problem: diff --git a/Content/Chapter-7-1-complex-loops/try-catch/try-catch.md b/Content/Chapter-7-1-complex-loops/try-catch/try-catch.md index 783a00a0e..c602ee13e 100644 --- a/Content/Chapter-7-1-complex-loops/try-catch/try-catch.md +++ b/Content/Chapter-7-1-complex-loops/try-catch/try-catch.md @@ -47,10 +47,10 @@ Here is a **sample implementation** of the described idea: The solution should **work in all cases**: whether we are entering integer numbers, invalid numbers (for example, too many digits), or non-numbered text. The above program logic will repeat in an infinite loop the process of **entering a value until a valid even integer is entered**. - - The `int.Parse()` method will **throw an exception** in case of an invalid integer. - - In case of a valid integer, the program will check if it is even. In this case a "_success_" message is shown and the **loop is stopped** using `break`. - - In case of an odd integer, an **error message** is shown and the **loop repeats again**. - - In case of an exception (error during the number parsing), an **error message** is shown and the **loop repeats again**. +- The `int.Parse()` method will **throw an exception** in case of an invalid integer. +- In case of a valid integer, the program will check if it is even. In this case a "_success_" message is shown and the **loop is stopped** using `break`. +- In case of an odd integer, an **error message** is shown and the **loop repeats again**. +- In case of an exception (error during the number parsing), an **error message** is shown and the **loop repeats again**. ### Testing in the Judge System diff --git a/Content/Chapter-7-1-complex-loops/web-app/web-apps-with-complex-loops.md b/Content/Chapter-7-1-complex-loops/web-app/web-apps-with-complex-loops.md index 99d8313dd..a6b43cf6f 100644 --- a/Content/Chapter-7-1-complex-loops/web-app/web-apps-with-complex-loops.md +++ b/Content/Chapter-7-1-complex-loops/web-app/web-apps-with-complex-loops.md @@ -4,7 +4,7 @@ Now we know how to repeat a group of actions using **loops**. Let's do something ## Problem: Web Application "Fruits Game" -**Description**: Develop an **ASP.NET MVC Web Application** - a game in which the player **shoots fruits**, arranged in a table. Successfully hit fruits disappear and the player gets points for each target fruit. When you hit a **dynamite**, the fruits explode and the game ends \(as in Fruit Ninja\). +**Description**: Develop an **ASP.NET MVC Web Application** – a game in which the player **shoots fruits**, arranged in a table. Successfully hit fruits disappear and the player gets points for each target fruit. When you hit a **dynamite**, the fruits explode and the game ends \(as in Fruit Ninja\). Shooting is done by columns, top to bottom or bottom to top, and the location of impact \(the column under fire\) is set by scroll bar. Because of the scroller's inaccuracy, the player is not quite sure which column they are going to shoot. So every shot has a chance not to hit and this makes the game more interesting \(like the sling in Angry Birds\). Our game should look like this: @@ -66,7 +66,7 @@ In order to **draw the playing field** with the fruits, we need to rotate **two ![](/assets/chapter-7-images/15.Fruits-09.png) -Take a look at the yellow characters `@` - they are used to switch between the **C\#** and **HTML** languages and come from the **Razor** syntax for drawing dynamic web pages. +Take a look at the yellow characters `@` – they are used to switch between the **C\#** and **HTML** languages and come from the **Razor** syntax for drawing dynamic web pages. ## Change Text in Layout @@ -90,9 +90,9 @@ For the fruit shooting, we need to add the actions \[**Reset**\] and \[**Fire To The above code defines three actions: -* `Reset()` - starts a new game by generating a new random playing field with fruits and explosives, resetting the player's points and making the game valid **\(**`gameOver = false`**\)**. This action is pretty simple and can be immediately tested using \[**Ctrl + F5**\] before writing the other ones. -* `FireTop (position)` - shoots on row **0** at position `position` \(number 0 to 100\). The shooting is in direction **down** \(+1\) from row `0` \(top\). Shooting itself is more complicated as a logic and will be considered after a while. -* `FireBottom (position)` - shoots on row **2** at position `position` \(number 0 to 100\). The shooting is in direction **up** \(-1\) from row **2** \(bottom\). +* `Reset()` – starts a new game by generating a new random playing field with fruits and explosives, resetting the player's points and making the game valid **\(**`gameOver = false`**\)**. This action is pretty simple and can be immediately tested using \[**Ctrl + F5**\] before writing the other ones. +* `FireTop (position)` – shoots on row **0** at position `position` \(number 0 to 100\). The shooting is in direction **down** \(+1\) from row `0` \(top\). Shooting itself is more complicated as a logic and will be considered after a while. +* `FireBottom (position)` – shoots on row **2** at position `position` \(number 0 to 100\). The shooting is in direction **up** \(-1\) from row **2** \(bottom\). ## Implement the "Fire" Method diff --git a/Content/Chapter-7-2-complex-loops-exam-problems/digits/digits.md b/Content/Chapter-7-2-complex-loops-exam-problems/digits/digits.md index 638fab691..e5367ffba 100644 --- a/Content/Chapter-7-2-complex-loops-exam-problems/digits/digits.md +++ b/Content/Chapter-7-2-complex-loops-exam-problems/digits/digits.md @@ -1,6 +1,6 @@ # Problem: Digits -Write a program that reads from the console 1 integer within the range [**100 … 999**], and then prints it a predefined number of times - modifying it before each print, as follows: +Write a program that reads from the console 1 integer within the range [**100 … 999**], and then prints it a predefined number of times – modifying it before each print, as follows: - If the number is divisible by **5** without reminder, **subtract** from it **its first digit**. - If the number is divisible by **3** without reminder, **subtract** from it **its second digit** - If none of the above mentioned conditions is valid, **add** to it **its third digit**. diff --git a/Content/Chapter-7-2-complex-loops-exam-problems/magic-combination/magic-combination.md b/Content/Chapter-7-2-complex-loops-exam-problems/magic-combination/magic-combination.md index 968eac553..db7038912 100644 --- a/Content/Chapter-7-2-complex-loops-exam-problems/magic-combination/magic-combination.md +++ b/Content/Chapter-7-2-complex-loops-exam-problems/magic-combination/magic-combination.md @@ -38,7 +38,7 @@ Print on the console **all magic numbers**, separated by **space**. In the previous chapter we reviewed other loop constructions. Let's look at the sample solution of the same problem using the **`while`** loop. -First we need to store the **input magical number** in a suitable variable. Then we will initialize 6 variables - one for each of the six digits of **the searched numbers**. +First we need to store the **input magical number** in a suitable variable. Then we will initialize 6 variables – one for each of the six digits of **the searched numbers**. ![](/assets/chapter-7-exam-preparation-images/02.magic-numbers-2.png) @@ -60,7 +60,7 @@ Let's remove the **`if`** check from the innermost loop. Now, let's initialize e ![](/assets/chapter-7-exam-preparation-images/02.magic-numbers-4.png) -As we can see, we can solve a problem using different types of loops. Of course, each task has its most appropriate choice. In order to practice each type of loops - try to solve each of the following problems with all the learned loops. +As we can see, we can solve a problem using different types of loops. Of course, each task has its most appropriate choice. In order to practice each type of loops – try to solve each of the following problems with all the learned loops. ## Testing in the Judge System diff --git a/Content/Chapter-7-2-complex-loops-exam-problems/stop-number/stop-number.md b/Content/Chapter-7-2-complex-loops-exam-problems/stop-number/stop-number.md index e84a4f29e..e77c361fa 100644 --- a/Content/Chapter-7-2-complex-loops-exam-problems/stop-number/stop-number.md +++ b/Content/Chapter-7-2-complex-loops-exam-problems/stop-number/stop-number.md @@ -1,13 +1,13 @@ # Problem: Stop Number -Write a program that prints on the console all numbers from **N** to **M**, that are **divisible by 2** and **3 without reminder **, in **reversed order**. We will read one more "stop" number from the console - **S**. If any of the numbers divisible by 2 and 3 **is equal to the stop number, it should not be printed** and the program should end. **Otherwise print all numbers up to N**, that meet the condition. +Write a program that prints on the console all numbers from **N** to **M**, that are **divisible by 2** and **3 without reminder **, in **reversed order**. We will read one more "stop" number from the console – **S**. If any of the numbers divisible by 2 and 3 **is equal to the stop number, it should not be printed** and the program should end. **Otherwise print all numbers up to N**, that meet the condition. ## Input Data Read from the console 3 numbers, each on a single line: -* **N** - integer number: **0 ≤ N < M**. -* **M** - integer number: **N < M ≤ 10000**. -* **S** - integer number: **N ≤ S ≤ M**. +* **N** – integer number: **0 ≤ N < M**. +* **M** – integer number: **N < M ≤ 10000**. +* **S** – integer number: **N ≤ S ≤ M**. ## Output Data @@ -35,15 +35,15 @@ The problem can be divided into **four** logical parts: * **Checking** the conditions of the problem according to every number in the given range. * **Printing** the numbers. -**First** part is ordinary - we read **three** integer numbers from the console, so we will use **`int`**. +**First** part is ordinary – we read **three** integer numbers from the console, so we will use **`int`**. -We have already seen examples of the **second** part - initialization of the **`for`** loop. It is a bit **tricky** - the explanation mentions that the numbers have to be printed in **reversed order**. This means that the **initial** value of the variable **`i`** will be **bigger**, and from the examples we can see that it is **M**. So the **final** value of **`i`** should be **N**. The fact that we will print the results in reversed order and the values of **`i`**, suggests that the step would be **decreased by 1**. +We have already seen examples of the **second** part – initialization of the **`for`** loop. It is a bit **tricky** – the explanation mentions that the numbers have to be printed in **reversed order**. This means that the **initial** value of the variable **`i`** will be **bigger**, and from the examples we can see that it is **M**. So the **final** value of **`i`** should be **N**. The fact that we will print the results in reversed order and the values of **`i`**, suggests that the step would be **decreased by 1**. ![](/assets/chapter-7-exam-preparation-images/04.stop-number-1.png) -After we have initialized the **`for`** loop, it is time for the **third** part of the problem - **checking** the condition if the given **number is divisible both by 2 and 3 without reminder**. We will do this using one simple **`if`** condition that we will leave to the reader to do by themselves. +After we have initialized the **`for`** loop, it is time for the **third** part of the problem – **checking** the condition if the given **number is divisible both by 2 and 3 without reminder**. We will do this using one simple **`if`** condition that we will leave to the reader to do by themselves. -Another **tricky** part of this problem is that apart from the above check we need to do **another** one - whether the **number is equal to the "stop" number** entered from the console on the third line. To do this check, the previous one has to be passed. For this reason we will add another **`if`** statement that we will **nest in the previous one**. If the condition is **true**, we need to stop the program from printing. We can do this using a **`break`** operator, and it will lead us **out** of the **`for`** loop. +Another **tricky** part of this problem is that apart from the above check we need to do **another** one – whether the **number is equal to the "stop" number** entered from the console on the third line. To do this check, the previous one has to be passed. For this reason we will add another **`if`** statement that we will **nest in the previous one**. If the condition is **true**, we need to stop the program from printing. We can do this using a **`break`** operator, and it will lead us **out** of the **`for`** loop. If the **condition** that checks whether the number is equal with "stop" number returns a **`false`** result, our program should **continue to print**. This covers the **fourth and last** part of our program. diff --git a/Content/Chapter-7-2-complex-loops-exam-problems/stupid-password-generator/stupid-password-generator.md b/Content/Chapter-7-2-complex-loops-exam-problems/stupid-password-generator/stupid-password-generator.md index bd84dbf4b..8f7b30fc4 100644 --- a/Content/Chapter-7-2-complex-loops-exam-problems/stupid-password-generator/stupid-password-generator.md +++ b/Content/Chapter-7-2-complex-loops-exam-problems/stupid-password-generator/stupid-password-generator.md @@ -39,7 +39,7 @@ For **reading** of **input** data we will declare two integer variables **`int`* ![](/assets/chapter-7-exam-preparation-images/01.stupid-password-generator-1.png) -Let's declare and initialize the **variables** that will store the **characters** of the password: for the characters of **digit** type - **`int`** - **`d1`**, **`d2`**, **`d3`**, and for the **letters** - of **`char`** type - **`l1`**, **`l2`**. To make it easier we will skip explicit specification of the type by replacing it with the keyword **`var`**. +Let's declare and initialize the **variables** that will store the **characters** of the password: for the characters of **digit** type – **`int`** – **`d1`**, **`d2`**, **`d3`**, and for the **letters** – of **`char`** type – **`l1`**, **`l2`**. To make it easier we will skip explicit specification of the type by replacing it with the keyword **`var`**. ## Processing the Input Data and Printing Output diff --git a/Content/Chapter-8-1-exam-preparation/complex-conditions-problems/complex-conditions-problems.md b/Content/Chapter-8-1-exam-preparation/complex-conditions-problems/complex-conditions-problems.md index 0c6bb3198..291b6e8f7 100644 --- a/Content/Chapter-8-1-exam-preparation/complex-conditions-problems/complex-conditions-problems.md +++ b/Content/Chapter-8-1-exam-preparation/complex-conditions-problems/complex-conditions-problems.md @@ -10,8 +10,8 @@ There are two numbers **d** (day) and **m** (month) that form **a date**. Write ### Input The input is read from the console and consists of two rows: -- On the first row we read an integer **d** in the range [**1 … 31**] - day. The number of the day does not exceed the number of days in that month (eg. 28 for February). -- On the second row we read an integer **m** in the range [**1 … 12**] - month. Month 1 is January, month 2 is February, …, month 12 is December. The month may contain a leading zero (eg. April may be written as 4 or 04). +- On the first row we read an integer **d** in the range [**1 … 31**] – day. The number of the day does not exceed the number of days in that month (eg. 28 for February). +- On the second row we read an integer **m** in the range [**1 … 12**] – month. Month 1 is January, month 2 is February, …, month 12 is December. The month may contain a leading zero (eg. April may be written as 4 or 04). ### Output diff --git a/Content/Chapter-8-1-exam-preparation/drawing-figures-problems/drawing-figures-problems.md b/Content/Chapter-8-1-exam-preparation/drawing-figures-problems/drawing-figures-problems.md index 6855e8988..134683e11 100644 --- a/Content/Chapter-8-1-exam-preparation/drawing-figures-problems/drawing-figures-problems.md +++ b/Content/Chapter-8-1-exam-preparation/drawing-figures-problems/drawing-figures-problems.md @@ -35,13 +35,13 @@ We will read the number **n** from the console. ### Printing the Top Part of the Diamond -We start painting **the top half** of the diamond. We clearly see that **each row** starts with a **few empty spaces and ***. If we take a closer look, we will notice that **the empty spaces** are always equal to **`n - the number of lines`** (the first row is n-1, the second - n-2, etc.). We will start by drawing the number of **empty spaces**, and the **first asterisk**. Let's not forget to use **`Console.Write(…)`** instead of **`Console.WriteLine(…)`** to stay on **the same line**. At the end of the line we write **`Console.WriteLine(…)`** to go to **a new line**. Notice that we start counting from **1, not from 0**. Next, we will only add a few times **`-*`** to **finish the line**. +We start painting **the top half** of the diamond. We clearly see that **each row** starts with a **few empty spaces and ***. If we take a closer look, we will notice that **the empty spaces** are always equal to **`n` – the number of lines** (the first row is n-1, the second – n-2, etc.). We will start by drawing the number of **empty spaces**, and the **first asterisk**. Let's not forget to use **`Console.Write(…)`** instead of **`Console.WriteLine(…)`** to stay on **the same line**. At the end of the line we write **`Console.WriteLine(…)`** to go to **a new line**. Notice that we start counting from **1, not from 0**. Next, we will only add a few times **`-*`** to **finish the line**. Here is part of the code for the **top of the diamond**: ![](/assets/chapter-8-1-images/09.Perfect-diamond-02.png) -What remains is to **complete each line** with the required number of **`-*`** elements. On each row we have to add **`i - 1`** such **items** (on the first 1-1 -> 0, the second -> 1, etc.) +What remains is to **complete each line** with the required number of **`-*`** elements. On each row we have to add **`i-1`** such **items** (on the first 1-1 -> 0, the second -> 1, etc.) Here is the complete code for drawing **the top of the diamond**: @@ -49,7 +49,7 @@ Here is the complete code for drawing **the top of the diamond**: ### Printing the Bottom Part of the Diamond -To draw the **bottom part** of the diamond, we have to reverse **the upper part**. We will count from **`n - 1`**, because if we start from **`n`**, we will draw the middle row twice. Do not forget to change **the step** from **`++` to `--`**. +To draw the **bottom part** of the diamond, we have to reverse **the upper part**. We will count from **`n-1`**, because if we start from **`n`**, we will draw the middle row twice. Do not forget to change **the step** from **`++` to `--`**. Here is the code for drawing **the bottom part of the diamond**: @@ -104,7 +104,7 @@ We can **start and test the code so far**. Everything without the two asterisks ### Adding Stars in the Center of the Rectangle -Now, **in the body** of the loop let's add the **asterisks**. We'll check if we're on the **middle row**. If we are in the middle, we will draw **the row** together **with the asterisks**, if not - we will draw **a normal row**. The line with the asterisks has **`n - 2` empty spaces** (**`n`** is half the length and we remove the asterisk and the percentage), **two stars** and again **`n - 2` empty spaces**. We leave out of the check the two percent at the beginning and at the end of the row. +Now, **in the body** of the loop let's add the **asterisks**. We'll check if we're on the **middle row**. If we are in the middle, we will draw **the row** together **with the asterisks**, if not – we will draw **a normal row**. The line with the asterisks has **`n-2` empty spaces** (**`n`** is half the length and we remove the asterisk and the percentage), **two stars** and again **`n-2` empty spaces**. We leave out of the check the two percent at the beginning and at the end of the row. ![](/assets/chapter-8-1-images/10.Rectangle-with-stars-04.png) diff --git a/Content/Chapter-8-1-exam-preparation/nested-loops-problems/nested-loops-problems.md b/Content/Chapter-8-1-exam-preparation/nested-loops-problems/nested-loops-problems.md index 63bf11a1d..74500114c 100644 --- a/Content/Chapter-8-1-exam-preparation/nested-loops-problems/nested-loops-problems.md +++ b/Content/Chapter-8-1-exam-preparation/nested-loops-problems/nested-loops-problems.md @@ -33,7 +33,7 @@ We will read the input data from the console. We also create the additional vari ### Implementation with 2 Numbers -We will most easily solve the problem if we logically divide it **in parts**. If we are required to draw all the rows from a number between **`a`** and **`b`**, we will do it using **one loop** that takes all the numbers from **`a`** to **`b`**. Let's think how to do this with **series of two numbers**. The answer is easy - we will use **nested loops**. +We will most easily solve the problem if we logically divide it **in parts**. If we are required to draw all the rows from a number between **`a`** and **`b`**, we will do it using **one loop** that takes all the numbers from **`a`** to **`b`**. Let's think how to do this with **series of two numbers**. The answer is easy – we will use **nested loops**. ![](/assets/chapter-8-1-images/11.Increasing-4-numbers-02.png) @@ -70,8 +70,8 @@ Rectangles are set using the top left and bottom right corner. The following ine Two numbers, one per line, are entered from the console: -- An integer **n** in the range [**1 … 100**] - sets the minimum and maximum coordinates of a peak. -- An integer **m** in the range [**0 … 50 000**] - sets the minimum area of the generated rectangles. +- An integer **n** in the range [**1 … 100**] – sets the minimum and maximum coordinates of a peak. +- An integer **m** in the range [**0 … 50 000**] – sets the minimum area of the generated rectangles. ### Output @@ -99,11 +99,11 @@ It is very important to be able to imagine the problem before we begin to solve ![](/assets/chapter-8-1-images/12.Generating-rectangles-02.png) -With the variables **`left`** and **`right`** we will follow the coordinates **horizontally** and with **`top`** and **`bottom`** - **vertically**. +With the variables **`left`** and **`right`** we will follow the coordinates **horizontally** and with **`top`** and **`bottom`** – **vertically**. ### Calculating the Rectangle Area and Printing the Output -The important thing here is knowing the corresponding coordinates so we can correctly calculate the sides of the rectangle. Now we have to find **the area of the rectangle** and check if it is **greater than** or **equal** to **`m`**. One **side** will be **the difference between `left` and `right`** and **the other one - between `top` and `bottom`**. Since the coordinates may be eventually interchanged, we will use **absolute values**. Again, we add **the counter** in the loop, counting **only the rectangles** we write. It is important to note that the writing order is **`left`**, **`top`**, **`right`**, **`bottom`**, as it is set in the problem's description. +The important thing here is knowing the corresponding coordinates so we can correctly calculate the sides of the rectangle. Now we have to find **the area of the rectangle** and check if it is **greater than** or **equal** to **`m`**. One **side** will be **the difference between `left` and `right`** and **the other one – between `top` and `bottom`**. Since the coordinates may be eventually interchanged, we will use **absolute values**. Again, we add **the counter** in the loop, counting **only the rectangles** we write. It is important to note that the writing order is **`left`**, **`top`**, **`right`**, **`bottom`**, as it is set in the problem's description. ![](/assets/chapter-8-1-images/12.Generating-rectangles-03.png) diff --git a/Content/Chapter-8-1-exam-preparation/simple-conditions-problems/simple-conditions-problems.md b/Content/Chapter-8-1-exam-preparation/simple-conditions-problems/simple-conditions-problems.md index 2900a200a..f5e27602e 100644 --- a/Content/Chapter-8-1-exam-preparation/simple-conditions-problems/simple-conditions-problems.md +++ b/Content/Chapter-8-1-exam-preparation/simple-conditions-problems/simple-conditions-problems.md @@ -10,7 +10,7 @@ ### Input The console reads **3 integer numbers** (one per line): -- On the first line the number "first" is read - **one end of the segment**. +- On the first line the number "first" is read – **one end of the segment**. - On the second line the number "second" is read – **the other end of the segment**. - On the third line the number "point" is read – **the location of the point**. @@ -19,7 +19,7 @@ All input numbers are integers in the range [**-1000 … 1000**]. ### Output Print the result on the console: -- On the first line, print "**in**" or "**out**" - whether the point is inside or outside the segment. +- On the first line, print "**in**" or "**out**" – whether the point is inside or outside the segment. - On the second line, print the distance from the point to the nearest end of the segment. ### Sample Input and Output @@ -81,7 +81,7 @@ All input numbers are integers in the range **[-1000 … 1000]**. ### Output -Print on the console "**in**" or "**out**" - whether the point is **inside** or **outside** the figure (the outline is inside). +Print on the console "**in**" or "**out**" – whether the point is **inside** or **outside** the figure (the outline is inside). ### Sample Input and Output diff --git a/Content/Chapter-8-1-exam-preparation/simple-loops-problems/simple-loops-problems.md b/Content/Chapter-8-1-exam-preparation/simple-loops-problems/simple-loops-problems.md index 4dcb0e739..0c5495d97 100644 --- a/Content/Chapter-8-1-exam-preparation/simple-loops-problems/simple-loops-problems.md +++ b/Content/Chapter-8-1-exam-preparation/simple-loops-problems/simple-loops-problems.md @@ -59,7 +59,7 @@ The input data is read from the console. The first row is an integer **n** (**0 #### Output -On the console we must print one number - **the length** of the longest increasing sequence. +On the console we must print one number – **the length** of the longest increasing sequence. ### Sample Input and Output @@ -73,11 +73,11 @@ To solve this problem, we need to think in a bit **more algorithmic way**. A **s ![](/assets/chapter-8-1-images/08.Increasing-numbers-01.png) -The variable **`n`** is **the count of numbers** we get from the console. In **`countCurrentLongest`** we will keep **the number of elements** in the increasing sequence we are **currently counting**. For example, in the sequence: 5, 6, 1, 2, 3 **`countCurrentLongest`** will be 2 when we reach **the second element** of the counting (5, **6**, 1, 2, 3) and will become 3 when we reach the **last element** (5, 6, 1, 2, **3**), because the increasing row 1, 2, 3 has 3 elements. We will use **`countLongest`** to keep the **longest** increasing sequence. The other variables are **`a`** - the number we are **currently in**, and **`aPrev`** - **the previous number** which we will compare with **`a`** to see if the row is **growing**. +The variable **`n`** is **the count of numbers** we get from the console. In **`countCurrentLongest`** we will keep **the number of elements** in the increasing sequence we are **currently counting**. For example, in the sequence: 5, 6, 1, 2, 3 **`countCurrentLongest`** will be 2 when we reach **the second element** of the counting (5, **6**, 1, 2, 3) and will become 3 when we reach the **last element** (5, 6, 1, 2, **3**), because the increasing row 1, 2, 3 has 3 elements. We will use **`countLongest`** to keep the **longest** increasing sequence. The other variables are **`a`** – the number we are **currently in**, and **`aPrev`** – **the previous number** which we will compare with **`a`** to see if the row is **growing**. ### Determining Increasing Sequence -We begin to run the numbers and check if the present number **`a`** is larger than the previous **`aPrev`** one. If this is true, then the row **is growing** and we need to increase its number by **1**. This is stored in the variable that tracks the length of the sequence we are currently in - **`countCurrentLongest`**. If the number **`a`** is **not greater** than the previous one, it means that **a new sequence** starts and we have to start the count from **1**. Finally, after all the checks are done, **`aPrev`** becomes **the number** we are **currently** using and we start the loop from the beginning with **the next** entered **`a`**. +We begin to run the numbers and check if the present number **`a`** is larger than the previous **`aPrev`** one. If this is true, then the row **is growing** and we need to increase its number by **1**. This is stored in the variable that tracks the length of the sequence we are currently in – **`countCurrentLongest`**. If the number **`a`** is **not greater** than the previous one, it means that **a new sequence** starts and we have to start the count from **1**. Finally, after all the checks are done, **`aPrev`** becomes **the number** we are **currently** using and we start the loop from the beginning with **the next** entered **`a`**. Here is a sample implementation of the algorithm described: diff --git a/Content/Chapter-8-2-exam-preparation-part-2/flowers/flowers.md b/Content/Chapter-8-2-exam-preparation-part-2/flowers/flowers.md index 536628fe2..0f9d64a37 100644 --- a/Content/Chapter-8-2-exam-preparation-part-2/flowers/flowers.md +++ b/Content/Chapter-8-2-exam-preparation-part-2/flowers/flowers.md @@ -22,7 +22,7 @@ The input is read from the **console** and contains **exactly 5 rows**: * The second row contains **the number of purchased roses** – an integer within the range [**0 … 200**]. * The third row contains **the number of purchased tulips** – an integer within the range [**0 … 200**]. * The fourth row indicates **the season** – [**Spring, Summer, Autumn, Winter**]. -* The fifth row specifies **if the day is a holiday** – [**Y - yes / N - no**]. +* The fifth row specifies **if the day is a holiday** – [**Y = yes / N = no**]. ## Output Data diff --git a/Content/Chapter-8-2-exam-preparation-part-2/grades/grades.md b/Content/Chapter-8-2-exam-preparation-part-2/grades/grades.md index f7e8c17d4..2cd53e954 100644 --- a/Content/Chapter-8-2-exam-preparation-part-2/grades/grades.md +++ b/Content/Chapter-8-2-exam-preparation-part-2/grades/grades.md @@ -1,6 +1,6 @@ # Problem: Grades -Write a program that **calculates statistics for grades** in an exam. At the beginning, the program reads the **number of students** who attended the exam and for **each student - their grade**. At the end, the program must **print the percentage of students** that have grades between 2.00 and 2.99, between 3.00 and 3.99, between 4.00 and 4.99, 5.00 or more, as well as the **average grade** of the exam. +Write a program that **calculates statistics for grades** in an exam. At the beginning, the program reads the **number of students** who attended the exam and for **each student – their grade**. At the end, the program must **print the percentage of students** that have grades between 2.00 and 2.99, between 3.00 and 3.99, between 4.00 and 4.99, 5.00 or more, as well as the **average grade** of the exam. ## Input Data @@ -23,7 +23,7 @@ The results must be **formatted up to the second symbol** after the decimal poin | Input | Output | Comments | | --- | --- | --- | -|10
3.00
2.99
5.68
3.01
4
4
6.00
4.50
2.44
5
|Top students: 30.00%
Between 4.00 and 4.99: 30.00%
Between 3.00 and 3.99: 20.00%
Fail: 20.00%
Average: 4.06|5 or more - **three students** = 30% of 10
Between 4.00 and 4.99 - **three students** = 30% of 10
Between 3.00 and 3.99 - **two students** = 20% of 10
Below 3 - **two students** = 20% of 10
The average grade is: 3 + 2.99 + 5.68 + 3.01 + 4 + 4 + 6 + 4.50 + 2.44 + 5 = 40.62 / 10 = 4.062| +|10
3.00
2.99
5.68
3.01
4
4
6.00
4.50
2.44
5
|Top students: 30.00%
Between 4.00 and 4.99: 30.00%
Between 3.00 and 3.99: 20.00%
Fail: 20.00%
Average: 4.06|5 or more: **three students** = 30% of 10
Between 4.00 and 4.99: **three students** = 30% of 10
Between 3.00 and 3.99: **two students** = 20% of 10
Below 3: **two students** = 20% of 10
The average grade is: 3 + 2.99 + 5.68 + 3.01 + 4 + 4 + 6 + 4.50 + 2.44 + 5 = 40.62 / 10 = 4.062| | Input | Output | | --- | --- | @@ -59,7 +59,7 @@ We can calculate what **percentage** is taken by a particular **group of student -The **end result** is formed in the well know fashion - **up to the second symbol** after the decimal point. +The **end result** is formed in the well know fashion – **up to the second symbol** after the decimal point. ## Testing in the Judge System diff --git a/Content/Chapter-9-1-problems-for-champions/five-special-letters/five-special-letters.md b/Content/Chapter-9-1-problems-for-champions/five-special-letters/five-special-letters.md index ee8dc1b79..8a9b86aca 100644 --- a/Content/Chapter-9-1-problems-for-champions/five-special-letters/five-special-letters.md +++ b/Content/Chapter-9-1-problems-for-champions/five-special-letters/five-special-letters.md @@ -66,7 +66,7 @@ As every problem, we start the solution by **reading and processing the input da ![](/assets/chapter-9-images/03.Five-special-letters-01.png) -We have several main points in the problem - **generating all combinations** with a length of 5 including the 5 letters, **removing repeating letters** and **calculating weight** for a simplified word. The answer will consist of every word whose weight is within the given interval **`[firstNumber, secondNumber]`**. +We have several main points in the problem – **generating all combinations** with a length of 5 including the 5 letters, **removing repeating letters** and **calculating weight** for a simplified word. The answer will consist of every word whose weight is within the given interval **`[firstNumber, secondNumber]`**. ### Generating All Combinations @@ -90,7 +90,7 @@ This way we already have generated all 5-letter combinations and can proceed wit ### Removing Repetitive Letters -Once we have the finished string, we have to remove all the repeating symbols. We will do this by adding **the letters from left to right in a new string and each time before adding a letter, we will check if it already exists** - if it does, we will skip it and if it is doesn't, we will add it. To begin with, we will add the first letter to the starting string. +Once we have the finished string, we have to remove all the repeating symbols. We will do this by adding **the letters from left to right in a new string and each time before adding a letter, we will check if it already exists** – if it does, we will skip it and if it is doesn't, we will add it. To begin with, we will add the first letter to the starting string. ![](/assets/chapter-9-images/03.Five-special-letters-05.png) diff --git a/Content/Chapter-9-1-problems-for-champions/magic-dates/magic-dates.md b/Content/Chapter-9-1-problems-for-champions/magic-dates/magic-dates.md index 5bb3b5807..43dbd2858 100644 --- a/Content/Chapter-9-1-problems-for-champions/magic-dates/magic-dates.md +++ b/Content/Chapter-9-1-problems-for-champions/magic-dates/magic-dates.md @@ -2,7 +2,7 @@ **Date** is given in a "**dd-mm-yyyy**" format, e.g. 17-04-2018. We calculate **the weight of that date** by taking all of its digits, multiplying each digit with the others after it, and finally summing up all the results obtained. In our case, we have 8 digits: **17032007**, so the weight is **`1*7 + 1*0 + 1*3 + 1*2 + 1*0 + 1*0 + 1*7`** **+** **`7*0 + 7*3 + 7*2 + 7*0 + 7*0 + 7*7`** **+** **`0*3 + 0*2 + 0*0 + 0*0 + 0*7`** **+** **`3*2 + 3*0 + 3*0 + 3*7`** **+** **`2*0 + 2*0 + 2*7`** **+** **`0*0 + 0*7`** **+** **`0*7`** = **144**. -Our task is to write a program that finds all **the magical dates - dates between two specific years (inclusive) corresponding to the weight given in the input data**. Dates must be printed in ascending order (by date) in the format "**dd-mm-yyyy**". We will only use the valid dates in the traditional calendar (the leap years have 29 days in February). +Our task is to write a program that finds all **the magical dates – dates between two specific years (inclusive) corresponding to the weight given in the input data**. Dates must be printed in ascending order (by date) in the format "**dd-mm-yyyy**". We will only use the valid dates in the traditional calendar (the leap years have 29 days in February). ## Input Data @@ -20,7 +20,7 @@ The result should be printed on the console as consecutive dates in **"dd-mm-yyy ## Constraints - * The start and final year are integer numbers in the range [**1900 - 2100**]. + * The start and final year are integer numbers in the range [**1900 … 2100**]. * Magic weight is an integer in the range [**1 … 1000**]. * Allowed program time: 0.25 seconds. * Allowed memory: 16 MB. @@ -49,7 +49,7 @@ For looping through the dates, we will take advantage of the functionality that Once we have the start date, we want to create a **loop that runs until we exceed the final year** (or until we pass December 31 in the final year if we compare the full dates), increasing each day by 1 day. -To increase by one day in each rotation, we will use a method of **`DateTime` - `.AddDays(…)`**, which will add one day to the current date. The method will take care instead of us, to decide where to skip the next month, how many days there is a month and everything around the leap years. +To increase by one day in each rotation, we will use a method of **`DateTime` – `.AddDays(…)`**, which will add one day to the current date. The method will take care instead of us, to decide where to skip the next month, how many days there is a month and everything around the leap years. ![](/assets/chapter-9-images/02.Magic-dates-02.png) @@ -63,7 +63,7 @@ In the end, our loop may look like this: ### Calculating Date Weight -Each date consists of exactly **8 characters (digits)** - **2 for the day** (**`d1`**, **`d2`**), **2 for the month** (**`d3`**, **`d4`**) and **4 for the year** (**`d5`** to **`d8`**). This means that we will always have the same calculation every time, and we can benefit from this **to define the formula statically** (i.e. not to use loops, referring to different numbers from the date, but write the whole formula). To be able to write it, we will need **all digits from the date** in individual variables to make all the necessary multiplications. By using the division and partition operations on the individual components of the date, using the **`Day`**, **`Month`** and **`Year`** properties, we can retrieve each digit. +Each date consists of exactly **8 characters (digits)** – **2 for the day** (**`d1`**, **`d2`**), **2 for the month** (**`d3`**, **`d4`**) and **4 for the year** (**`d5`** to **`d8`**). This means that we will always have the same calculation every time, and we can benefit from this **to define the formula statically** (i.e. not to use loops, referring to different numbers from the date, but write the whole formula). To be able to write it, we will need **all digits from the date** in individual variables to make all the necessary multiplications. By using the division and partition operations on the individual components of the date, using the **`Day`**, **`Month`** and **`Year`** properties, we can retrieve each digit. ![](/assets/chapter-9-images/02.Magic-dates-04.png) diff --git a/Content/Chapter-9-2-problems-for-champions-part-2/bulls-and-cows/bulls-and-cows.md b/Content/Chapter-9-2-problems-for-champions-part-2/bulls-and-cows/bulls-and-cows.md index e5e531621..ee2ecbe6d 100644 --- a/Content/Chapter-9-2-problems-for-champions-part-2/bulls-and-cows/bulls-and-cows.md +++ b/Content/Chapter-9-2-problems-for-champions-part-2/bulls-and-cows/bulls-and-cows.md @@ -56,9 +56,9 @@ If there are **no suggested numbers** that match the criteria provided from the ## Tips and Tricks We will solve the problem in a few steps: - - We will read the **input data**. - - We will generate all possible **four-digit combinations** (candidates for verification). - - For each generated combination we will calculate **how many bulls** and **how many cows** it has according to the secret number. Upon matching the needed bulls and cows, we will **print the combination**. +- We will read the **input data**. +- We will generate all possible **four-digit combinations** (candidates for verification). +- For each generated combination we will calculate **how many bulls** and **how many cows** it has according to the secret number. Upon matching the needed bulls and cows, we will **print the combination**. ### Reading the Input Data @@ -105,7 +105,7 @@ What logic can we use? The easiest way to check how many cows and bulls there ar What conditions do we need? -The bulls condition is very simple - we check whether the **first digit** of the generated number matches the **same digit** in the secret number. We remove the digits that are already checked in order to avoid repetitions of bulls and cows. +The bulls condition is very simple – we check whether the **first digit** of the generated number matches the **same digit** in the secret number. We remove the digits that are already checked in order to avoid repetitions of bulls and cows. ![](/assets/chapter-9-2-images/03.Bulls-and-cows-09.png) @@ -113,7 +113,7 @@ We repeat the action for the second, third and fourth digit. ### Counting the Cows -We will apply the following condition for the cows - first we will check whether the **first digit** of the generated number **matches the second one**, the **third one** or the **fourth digit** of the secret number. An example for the implementation: +We will apply the following condition for the cows – first we will check whether the **first digit** of the generated number **matches the second one**, the **third one** or the **fourth digit** of the secret number. An example for the implementation: ![](/assets/chapter-9-2-images/03.Bulls-and-cows-10.png) diff --git a/Content/Chapter-9-2-problems-for-champions-part-2/expression/expression.md b/Content/Chapter-9-2-problems-for-champions-part-2/expression/expression.md index b5521e1f8..3aef1fee0 100644 --- a/Content/Chapter-9-2-problems-for-champions-part-2/expression/expression.md +++ b/Content/Chapter-9-2-problems-for-champions-part-2/expression/expression.md @@ -67,7 +67,7 @@ For the goals of our task we need two variables: ![](/assets/chapter-9-2-images/02.X-expression-04.png) -We will clarify two details regarding the aforementioned code. The first one is the use of **`decimal`** type for **storing the output of our expression** in order to avoid any problems with the accuracy pertaining to the **`float`** and **`double`** type. The second one is the default value of the operator - it is **`+`**, so that the very first number can be added to our output. +We will clarify two details regarding the aforementioned code. The first one is the use of **`decimal`** type for **storing the output of our expression** in order to avoid any problems with the accuracy pertaining to the **`float`** and **`double`** type. The second one is the default value of the operator – it is **`+`**, so that the very first number can be added to our output. ### Defining the Program Structure @@ -77,7 +77,7 @@ Now that we already have our starting variables, we must decide **what will be t The next step is the processing of our **`symbol`** variable. We have 3 possible cases for it: * If the symbol is a **start of a sub-expression placed in brackets** i.e. the found symbol is a **`(`**. -* If the symbol is a **digit between 0 and 9**. But how can we check this? How can we check if our symbol is a digit? We can use for assistance the **ASCII code** of the symbol, via which we can use the following formula: **`[ASCII code of our symbol] - [ASCII code of the symbol 0] = [the digit that represents the symbol]`**. If **the result of this condition is between 0 and 9**, then our symbol is really a **number**. +* If the symbol is a **digit between 0 and 9**. But how can we check this? How can we check if our symbol is a digit? We can use for assistance the **ASCII code** of the symbol, via which we can use the following formula: **`[ASCII code of our symbol] – [ASCII code of the symbol 0] = [the digit that represents the symbol]`**. If **the result of this condition is between 0 and 9**, then our symbol is really a **number**. * If the symbol is an **operator**, i.e. it is **`+`**, **`-`**, **`*`** or **`/`**. ![](/assets/chapter-9-2-images/02.X-expression-06.png) @@ -86,7 +86,7 @@ The next step is the processing of our **`symbol`** variable. We have 3 possible Let's examine the actions that we need to undertake in the relevant cases that we defined: * If our symbol is an **operator**, then the only thing we need to do is to **set a new value for the `expressionOperator` variable**. -* If our symbol is a **digit**, then we need to **change the current result of the expression depending on the current operator**, i.e. if **`expressionOperator`** is a **`-`**, then we must **decrease the result by the numerical representation of the current symbol**. We can get the numerical representation of the current symbol via the formula that we used upon checking the condition for this case (the **`[ASCII code of our symbol] - [the ASCII code of the symbol `0`] = [the digit that represents the symbol]`**) +* If our symbol is a **digit**, then we need to **change the current result of the expression depending on the current operator**, i.e. if **`expressionOperator`** is a **`-`**, then we must **decrease the result by the numerical representation of the current symbol**. We can get the numerical representation of the current symbol via the formula that we used upon checking the condition for this case (the **`[ASCII code of our symbol] – [the ASCII code of the symbol `0`] = [the digit that represents the symbol]`**) ![](/assets/chapter-9-2-images/02.X-expression-07.png) @@ -96,7 +96,7 @@ Let's examine the actions that we need to undertake in the relevant cases that w ### Calculating the Sub-Expression Value -After that, in order to **calculate the sub-expression value** we will use the same methods that we used for calculating the main expression - we use a **`while` loop** to **read symbols** (until we reach an **`)`** symbol). Depending on whether the read symbol is a number or an operator, we modify the result of the sub-expression. The implementation of these operations is identical to the above described implementation for calculating expressions. This is why we believe the reader will be able to easily handle it. +After that, in order to **calculate the sub-expression value** we will use the same methods that we used for calculating the main expression – we use a **`while` loop** to **read symbols** (until we reach an **`)`** symbol). Depending on whether the read symbol is a number or an operator, we modify the result of the sub-expression. The implementation of these operations is identical to the above described implementation for calculating expressions. This is why we believe the reader will be able to easily handle it. After finishing the result calculation for our sub-expression, we **modify the result of the whole expression** depending on the value of the **`expressionOperator`**. diff --git a/Content/Chapter-9-2-problems-for-champions-part-2/passion-days/passion-days.md b/Content/Chapter-9-2-problems-for-champions-part-2/passion-days/passion-days.md index b26b0c81c..8f86441ed 100644 --- a/Content/Chapter-9-2-problems-for-champions-part-2/passion-days/passion-days.md +++ b/Content/Chapter-9-2-problems-for-champions-part-2/passion-days/passion-days.md @@ -25,7 +25,7 @@ Always only one "**`mall.Enter`**" command will be received, as well as only one The output data must be **printed in the console**. When shopping is over, the console must print individual output depending on what purchases have been made. - If **no purchases have been made** – "**No purchases. Money left: {remaining funds} lv.**" -- If **at least one purchase** is made - "**{number of purchases} purchases. Money left: {remaining funds} lv.**" +- If **at least one purchase** is made – "**{number of purchases} purchases. Money left: {remaining funds} lv.**" **The funds** must be printed with **accuracy of up to 2 symbols after the decimal point**. @@ -50,9 +50,9 @@ When shopping is over, the console must print individual output depending on wha ## Tips and Tricks We will separate the solution of the problem into three main parts: - - Processing of the **input**. - - **Algorithm** for solving the problem. - - Formatting the **output**. +- Processing of the **input**. +- **Algorithm** for solving the problem. +- Formatting the **output**. Let's examine each of the parts in details. @@ -79,7 +79,7 @@ Here is the place to point out that calling **`Console.ReadLine()`** after the e ### Reading the Commands -The algorithm for solving the problem is a direct one - we continue **reading commands** from the console, **until the command "mall.Exit" is passed**. In the meantime, we **process** each symbol (**`char`**) of each one of the commands according to the rules specified in the task requirements, and in parallel, we **modify the amount** that Lina has, and **store the number of purchases**. +The algorithm for solving the problem is a direct one – we continue **reading commands** from the console, **until the command "mall.Exit" is passed**. In the meantime, we **process** each symbol (**`char`**) of each one of the commands according to the rules specified in the task requirements, and in parallel, we **modify the amount** that Lina has, and **store the number of purchases**. Let's examine the first two problems for our algorithm. The first problem concerns the way we read the commands until we reach the **"mall.Exit"** command. The solution that we previously saw uses a **`while-loop`**. The second problem for the task is to **access each symbol** of the command passed. Keeping in mind that the input data with the commands is **`string`** type, the easiest way to access each symbol inside the strings is via a **`foreach` loop**. @@ -91,11 +91,11 @@ Here is what using two loops of this kind would look like: The next part of the algorithm is to **process the symbols from the commands**, according to the following rules in the requirements: -> - If the symbol is a **capital letter**, Lina gets a 50% discount, which means that you must decrease the money she has by 50% of the numeric representation of the symbol from the ASCII table. -> - If the symbol is a **small letter**, Lina gets a 70% discount, which means that you must decrease the money she has by 30% of the numeric representation of the symbol from the ASCII table. -> - If the symbol is **"%"**, Lina makes a purchase that decreases her money in half. -> - If the symbol is **"\*"**, Lina withdraws money from her debit card and adds 10 lv to her available funds. -> - If the symbol is **different from all of the aforementioned**, Lina just makes a purchase without discount, and in this case you should simply subtract the value of the symbol from the ASCII table from her available funds. +> * If the symbol is a **capital letter**, Lina gets a 50% discount, which means that you must decrease the money she has by 50% of the numeric representation of the symbol from the ASCII table. +> * If the symbol is a **small letter**, Lina gets a 70% discount, which means that you must decrease the money she has by 30% of the numeric representation of the symbol from the ASCII table. +> * If the symbol is **"%"**, Lina makes a purchase that decreases her money in half. +> * If the symbol is **"\*"**, Lina withdraws money from her debit card and adds 10 lv to her available funds. +> * If the symbol is **different from all of the aforementioned**, Lina just makes a purchase without discount, and in this case you should simply subtract the value of the symbol from the ASCII table from her available funds. Let's examine the problems that we will be facing in the first condition. The first one is how to distinguish if a particular **symbol is a capital letter**. We can use one of the following ways: * Keeping in mind the fact that the letters in the alphabet have a particular order, we can use the following condition **`action >= 'A' && action <= 'Z'`**, in order to check if our symbol is within the capital letters range. @@ -115,8 +115,8 @@ We believe the reader should not have difficulties implementing all the other co In the end of our task we must **print** a particular **output**, depending on the following condition: -> - If no purchases have been made – "**No purchases. Money left: {remaining funds} lv.**" -> - If at least one purchase is made - "**{number of purchases} purchases. Money left: {remaining funds} lv.**" +> * If no purchases have been made – "**No purchases. Money left: {remaining funds} lv.**" +> * If at least one purchase is made – "**{number of purchases} purchases. Money left: {remaining funds} lv.**" The printing operations are trivial, as the only thing we need to take into consideration is that **the amount has to be printed with accuracy of up to 2 symbols after the decimal point**. diff --git a/Content/Conclusion/overview.md b/Content/Conclusion/overview.md index 481d5714d..3b159f300 100644 --- a/Content/Conclusion/overview.md +++ b/Content/Conclusion/overview.md @@ -3,11 +3,11 @@ If you have **read the entire** book and you've solved all the problems from the exercises and reached the present conclusion, **congratulations**! You've already made the **first step** in learning the **profession of a programmer**, but there is a **long way** to go until you become **really good** and make **software writing** your **profession**. Remember the **[four main groups of skills](chapter-00-preface.md#become-a-developer)** that each programmer must have in order to work in the industry: - - Skill #1 – **writing the program code** (20% of programmer's skills) - covered to a large degree by this book, but you must learn additional basic data structures, classes, functions, strings and other elements of code writing. - - Skill #2 – **algorithmic thinking** (30% of programmer's skills) - covered partially by this book and developed mostly by solving a large amount of diverse algorithmic problems. - - Skill #3 – **fundamental understanding of the profession** (25% of programmer's skills) - acquired for a few years in combination with learning and practice (reading books, watching video lessons, attending courses and mostly by writing diverse project in various technological areas). - - Skill #4 - **programming languages and software technologies** (25% of programmer's skills) - acquired in a long period of time, by a lot of practice, consistent reading and writing projects. Such knowledge and skills quickly get outdated and need to be updated frequently. Good programmers study new technologies ever day. - +- Skill #1 – **writing the program code** (20% of programmer's skills) – covered to a large degree by this book, but you must learn additional basic data structures, classes, functions, strings and other elements of code writing. +- Skill #2 – **algorithmic thinking** (30% of programmer's skills) – covered partially by this book and developed mostly by solving a large amount of diverse algorithmic problems. +- Skill #3 – **fundamental understanding of the profession** (25% of programmer's skills) – acquired for a few years in combination with learning and practice (reading books, watching video lessons, attending courses and mostly by writing diverse project in various technological areas). +- Skill #4 – **programming languages and software technologies** (25% of programmer's skills) – acquired in a long period of time, by a lot of practice, consistent reading and writing projects. Such knowledge and skills quickly get outdated and need to be updated frequently. Good programmers study new technologies ever day. + ## This Book is Only the First Step! **The present** book on programming basics is just the **first step** in building the skills of a programmer. If you were able to solve **all problems**, this means you have **obtained valuable knowledge** in the programming principles with C# on a **basic level**. You are about to start **in-depth** studying of programming, and develop **your algorithmic thinking**, and then add **technological knowledge** regarding the C# language and the .NET ecosystem (.NET Framework, .NET Core, Entity Framework, ASP.NET, etc.), front-end technologies (HTML, CSS, JavaScript) and many other concepts, technologies and instruments for software development. @@ -19,6 +19,6 @@ As we already explained, the first and basic skill of a programmer is **to learn ## How to Proceed After This Book? This book **gives you solid grounds**, thanks to which it will be easy for you to continue developing as programmers. If you wonder how to continue your development, you have the following possibilities: - - to study for a **software engineer at SoftUni** and make programming your profession; - - to continue developing as a programmer **in your own way**, for example through self-training or via online lessons; - - to **stay at coder level**, without going more seriously into programming. +- to study for a **software engineer at SoftUni** and make programming your profession; +- to continue developing as a programmer **in your own way**, for example through self-training or via online lessons; +- to **stay at coder level**, without going more seriously into programming. diff --git a/Content/Conclusion/overview/recommended-resources.md b/Content/Conclusion/overview/recommended-resources.md index b2c3f19d2..c03a88386 100644 --- a/Content/Conclusion/overview/recommended-resources.md +++ b/Content/Conclusion/overview/recommended-resources.md @@ -11,13 +11,13 @@ Regardless of the path you have chosen, if you are seriously involved in program If you will study programming seriously, **surround yourselves with people who are involved in programming** seriously. Join **communities of software developers**, attend software conferences, go to events for programmers, find friends with whom you can talk about programming and discuss problems and bugs, find environment that can help you. In Sofia and other cities there are free events for programmers, a few times a week. In smaller localities you have the Internet and an access to the entire online community. Here are some recommended **resources** that will be useful for your development as a programmer: -* https://softuni.bg - official **website of SoftUni**. In it you will find free (and not only) courses, seminars, video tutorials and trainings in programming, software technologies and digital competences. -* https://softuni.bg/forum - official **forum of SoftUni**. The discussions forum of SoftUni is exceptionally positive and full of colleagues who would like to help. If you ask a reasonable question related to programming and the technologies studied at SoftUni, you will almost certainly get a reasonable answer within a few minutes. Try it, you will not lose anything. -* https://www.facebook.com/SoftwareUniversity/ - official **Facebook page of SoftUni**. By it you will learn for new courses, seminars and events related to programming and software development. -* http://www.introprogramming.info - official website of the **books "Programming Basics"** with **C#** and **Java** by Dr. Svetlin Nakov and his team. The books examine in-depth programming basics, basic data structures and algorithms, object-oriented programming, and other basic skills, and are an excellent continuation for reading after the current book. However, **besides reading, you need to do intense code writing**, do not forget that! -* http://stackoverflow.com - **Stack Overflow** is one of the **widest** discussion forums for programmers worldwide, where you will find assistance for any possible question in the world of programming. If you are fluent in English, look up at StackOverflow and ask your questions there. -* https://fb.com/groups/bg.developers - the group "**Bulgaria Programming @ Facebook**" is one of the largest online communities for programmers and discussions on the topics of software development in Bulgarian language on Facebook. -* https://www.meetup.com/find/tech/ - look for **tech meetups** around your city and involve in communities that you like. Most of the tech meetups are free and newbies are welcome. +* https://softuni.bg – official **website of SoftUni**. In it you will find free (and not only) courses, seminars, video tutorials and trainings in programming, software technologies and digital competences. +* https://softuni.bg/forum – official **forum of SoftUni**. The discussions forum of SoftUni is exceptionally positive and full of colleagues who would like to help. If you ask a reasonable question related to programming and the technologies studied at SoftUni, you will almost certainly get a reasonable answer within a few minutes. Try it, you will not lose anything. +* https://www.facebook.com/SoftwareUniversity – official **Facebook page of SoftUni**. By it you will learn for new courses, seminars and events related to programming and software development. +* http://www.introprogramming.info – official website of the **books "Programming Basics"** with **C#** and **Java** by Dr. Svetlin Nakov and his team. The books examine in-depth programming basics, basic data structures and algorithms, object-oriented programming, and other basic skills, and are an excellent continuation for reading after the current book. However, **besides reading, you need to do intense code writing**, do not forget that! +* http://stackoverflow.com – **Stack Overflow** is one of the **widest** discussion forums for programmers worldwide, where you will find assistance for any possible question in the world of programming. If you are fluent in English, look up at StackOverflow and ask your questions there. +* https://fb.com/groups/bg.developers – the group "**Bulgaria Programming @ Facebook**" is one of the largest online communities for programmers and discussions on the topics of software development in Bulgarian language on Facebook. +* https://www.meetup.com/find/tech/ – look for **tech meetups** around your city and involve in communities that you like. Most of the tech meetups are free and newbies are welcome. * If you are interested in IT events, tech conferences, trainings and internships, take a look at the large **IT events websites**, such as http://iteventz.bg and http://dev.bg. ## Good Luck to All! diff --git a/Content/Conclusion/overview/study-software-engineering-alone.md b/Content/Conclusion/overview/study-software-engineering-alone.md index 1338b2a7c..966a47312 100644 --- a/Content/Conclusion/overview/study-software-engineering-alone.md +++ b/Content/Conclusion/overview/study-software-engineering-alone.md @@ -1,6 +1,6 @@ # Study Software Engineering in Your Own Way -Another possibility to develop after this book is to **continue studying programming outside of SoftUni**. You can enroll or subscribe to **video trainings** that go into more details in programming with C# or other languages and development platforms. You can **read books** on programming and software technologies, follow **online tutorials** and other online resources - there are plenty of free materials on the Internet. However, keep in mind that the most important thing towards the profession of a programmer is **to do practical projects**! +Another possibility to develop after this book is to **continue studying programming outside of SoftUni**. You can enroll or subscribe to **video trainings** that go into more details in programming with C# or other languages and development platforms. You can **read books** on programming and software technologies, follow **online tutorials** and other online resources – there are plenty of free materials on the Internet. However, keep in mind that the most important thing towards the profession of a programmer is **to do practical projects**! **You can not become a programmer without a lot of code writing and intense practicing**. Allocate **sufficient time** on it. You can not become a programmer for a month or two. On the Internet you will find a wide variety of **free resources**, such as books, manuals, video lessons, online and on-site courses on programming and software development. However, you need to invest **at least a year or two** to acquire a foundation level, needed for starting a job. diff --git a/Content/Conclusion/overview/study-software-engineering-in-softuni.md b/Content/Conclusion/overview/study-software-engineering-in-softuni.md index 761414368..21a7397b6 100644 --- a/Content/Conclusion/overview/study-software-engineering-in-softuni.md +++ b/Content/Conclusion/overview/study-software-engineering-in-softuni.md @@ -30,11 +30,11 @@ The forms of training at SoftUni are **on-site** (the better choice) and **onlin We recommend to everyone who gets **excellent score at the SoftUni entrance exam** and are really passionate about making programming their profession, to leave the rest of their commitments aside and **spend their entire time** on learning the profession of a "software engineer" and start making a living through it. - - For people who **work** this means quitting their job (and get a loan or decrease their expenses, in order to spend with a lower income a period of 1-2 years until they start working in the new profession). - - For people who **study** in a traditional university, this means to move significantly their focus towards programming and the practical courses in SoftUni, by decreasing the time spend in the traditional university. - - For **unemployed** people this is an excellent chance to assign their entire time, power and energy on acquiring a new, perspective, well paid and highly sought profession, that will give them good life quality and a long-term prosperity. - - For **students** in secondary schools and high-schools this means **giving a priority** to what is more important in their development: studying practical programming in SoftUni, that will give them a profession and a job, or giving their full attention to the traditional education system, or combining smartly both undertakings. Unfortunately, often priorities are determined by parents, and we don't have a solution for these cases. - +- For people who **work** this means quitting their job (and get a loan or decrease their expenses, in order to spend with a lower income a period of 1-2 years until they start working in the new profession). +- For people who **study** in a traditional university, this means to move significantly their focus towards programming and the practical courses in SoftUni, by decreasing the time spend in the traditional university. +- For **unemployed** people this is an excellent chance to assign their entire time, power and energy on acquiring a new, perspective, well paid and highly sought profession, that will give them good life quality and a long-term prosperity. +- For **students** in secondary schools and high-schools this means **giving a priority** to what is more important in their development: studying practical programming in SoftUni, that will give them a profession and a job, or giving their full attention to the traditional education system, or combining smartly both undertakings. Unfortunately, often priorities are determined by parents, and we don't have a solution for these cases. + We recommend to all who **can not get an excellent score at the SoftUni entrance exam** to spend more time on better learning, understanding, and most of all, practicing the material studied in the present book. If you can not easily solve the problems in this book, you will not be able to cope with programming and software development in the future. **Do not skip the programming basics!** Do not under any circumstances make bold decisions and quit your job or the traditional university, making great plans for your future profession of a software engineer, if you don't have an excellent grade at the SoftUni entrance exam! It measures if programming is suitable for you, to what extend you like it and if you are motivated to study it seriously, and work this for years every day with joy and pleasure. diff --git a/Content/Preface/about-softuni/about-the-book.md b/Content/Preface/about-softuni/about-the-book.md index f3df1a561..6c83b0dac 100644 --- a/Content/Preface/about-softuni/about-the-book.md +++ b/Content/Preface/about-softuni/about-the-book.md @@ -30,9 +30,9 @@ TODO If you are a **teacher in programming**, informatics or IT, or you want **to teach programming**, this book gives you more than well-structured teaching material with many examples and tasks. **Free**, additionally to the book you receive quality educational content for teaching in school, in **Bulgarian**, according to the school requirements: -* **Presentations** \(PowerPoint slides\) for each studied topic, compliant to the 45-minute classes in schools - free. -* Well-developed home and classroom **exercises** with detailed requirements and exemplary input and output - free. -* **Automated system for checking exercises** and homeworks \(online judge system\), which is used by students, also free . +* **Presentations** \(PowerPoint slides\) for each studied topic, compliant to the 45-minute classes in schools – free. +* Well-developed home and classroom **exercises** with detailed requirements and exemplary input and output – free. +* **Automated system for checking exercises** and homeworks \(online judge system\), which is used by students – also free . * **Video tutorials** with methodological guidance from the **free course for programming teachers**, which is conducted regularly by the SoftUni Foundation. All these **free teaching resources** can be found on the SoftUni Foundation website, along with the training content for all programming and software courses. Download them free here: [http://softuni.foundation/projects/applied-software-developer-profession/](http://softuni.foundation/projects/applied-software-developer-profession/). diff --git a/Content/Preface/how-to-become-a-programmer/how-to-become-a-programmer.md b/Content/Preface/how-to-become-a-programmer/how-to-become-a-programmer.md index dc63914c9..dfa249f0a 100644 --- a/Content/Preface/how-to-become-a-programmer/how-to-become-a-programmer.md +++ b/Content/Preface/how-to-become-a-programmer/how-to-become-a-programmer.md @@ -46,21 +46,21 @@ As you can guess **the programming language doesn't matter** for the development **Fundamental knowledge and skills** for programming, software development, software engineering and computer science form around 25% of the developer's minimum skills to start a job. Here are the more important of these skills and knowledge: * **basic mathematical concepts** related to programming: coordinate systems, vectors and matrices, discrete and non-discrete mathematical functions, state automats and state machines, combinatorics and statistics concepts, algorithm complexity, mathematical modeling and others -* **programming skills** - code writing, working with data, using conditional statements and loops, working with arrays, lists and associative arrays, strings and text processing, working with streams and files, using programming interfaces \(APIs\), working with debugger, etc. -* **data structures and algorithms** - lists, trees, hash-tables, graphs, search, sorting, recursion, binary search trees, etc. -* **object-oriented programming** \(OOP\) - working with classes, objects, inheritance, polymorphism, abstraction, interfaces, data encapsulation, exceptions management, design pattern -* **functional programming** \(FP\) - working with lambda functions, higher order functions, functions that return a function as a result, closure, etc. -* **databases** - relational and non-relational databases, database modeling \(tables and links between them\), SQL query language, object-relational mapping \(ORM\), transactions and transaction management -* **network programming** - network protocols, network communication, TCP/IP, concepts, tools and technologies from computer networks +* **programming skills** – code writing, working with data, using conditional statements and loops, working with arrays, lists and associative arrays, strings and text processing, working with streams and files, using programming interfaces \(APIs\), working with debugger, etc. +* **data structures and algorithms** – lists, trees, hash-tables, graphs, search, sorting, recursion, binary search trees, etc. +* **object-oriented programming** \(OOP\) – working with classes, objects, inheritance, polymorphism, abstraction, interfaces, data encapsulation, exceptions management, design pattern +* **functional programming** \(FP\) – working with lambda functions, higher order functions, functions that return a function as a result, closure, etc. +* **databases** – relational and non-relational databases, database modeling \(tables and links between them\), SQL query language, object-relational mapping \(ORM\), transactions and transaction management +* **network programming** – network protocols, network communication, TCP/IP, concepts, tools and technologies from computer networks * **client-server** interaction, peer to peer communication, back-end technologies, front-end technologies, MVC architectures -* **technology for server \(back-end\) development** - web server architecture, HTTP protocol, MVC architecture, REST architecture, web development frameworks, templating engines -* **web front-end technologies \(client development\)** - HTML, CSS, JS, HTTP, DOM, AJAX, communication with back-end, calling REST API, front-end frameworks, basic design and UX \(user experience\) concepts -* **mobile technologies** - mobile apps, Android and iOS development, mobile user interface \(UI\), calling server logic -* **embedded systems** - microcontrollers, digital and analog input and output control, sensor access, peripheral management -* **operating systems** - working with operating systems \(Linux, Windows, etc.\), installation, configuration and basic system administration, process management, memory, file system, users, multitasking, virtualization and containers -* **parallel programming and asynchrony** - thread management, asynchronous tasks, promises, common resources, and access synchronization -* **software engineering** - source control systems, development management, task planning and management, software development methodologies, software requirements and prototypes, software design, software architectures, software documentation -* **software testing** - unit testing, test-driven development, QA engineering, error reporting and error tracking, automation testing, build processes and continuous integration +* **technology for server \(back-end\) development** – Web server architecture, HTTP protocol, MVC architecture, REST architecture, web development frameworks, templating engines +* **web front-end technologies \(client development\)** – HTML, CSS, JS, HTTP, DOM, AJAX, communication with back-end, calling REST API, front-end frameworks, basic design and UX \(user experience\) concepts +* **mobile technologies** – mobile apps, Android and iOS development, mobile user interface \(UI\), calling server logic +* **embedded systems** – microcontrollers, digital and analog input and output control, sensor access, peripheral management +* **operating systems** – working with operating systems \(Linux, Windows, etc.\), installation, configuration and basic system administration, process management, memory, file system, users, multitasking, virtualization and containers +* **parallel programming and asynchrony** – thread management, asynchronous tasks, promises, common resources, and access synchronization +* **software engineering** – source control systems, development management, task planning and management, software development methodologies, software requirements and prototypes, software design, software architectures, software documentation +* **software testing** – unit testing, test-driven development, QA engineering, error reporting and error tracking, automation testing, build processes and continuous integration We need to clarify once again that **the programming language does not matter** for the assimilation of all these skills. They accumulate slowly, over many years of practice in the profession. Some knowledge is fundamental and can be learned theoretically, but for their full understanding and in-depth awareness, you need years of practice. diff --git a/README.md b/README.md index d6e5016c6..ae2ff2aff 100644 --- a/README.md +++ b/README.md @@ -6,26 +6,26 @@ The **free** book "**Programming Basics with C#**" introduces the readers to wri > > This is unfinished work. Once we finish it, we shall publish the book in PDF / MOBI / other formats. -Programming Basics with C# - book cover +Programming Basics with C# – book cover * [Preface](Content/Preface/overview.md) * [1. First Steps in Programming](Content/Chapter-1-first-steps-in-programming/overview.md) * [2.1. Simple Calculations](Content/Chapter-2-1-simple-calculations/overview.md) - * [2.2. Simple Calculations - Exam Problems](Content/Chapter-2-2-simple-calculations-exam-problems/overview.md) + * [2.2. Simple Calculations – Exam Problems](Content/Chapter-2-2-simple-calculations-exam-problems/overview.md) * [3.1. Simple Conditions](Content/Chapter-3-1-simple-conditions/overview.md) - * [3.2. Simple Conditions - Exam Problems](Content/Chapter-3-2-simple-conditions-exam-problems/overview.md) + * [3.2. Simple Conditions – Exam Problems](Content/Chapter-3-2-simple-conditions-exam-problems/overview.md) * [4.1. More Complex Conditions](Content/Chapter-4-1-complex-conditions/overview.md) - * [4.2. More Complex Conditions - Exam Problems](Content/Chapter-4-2-complex-conditions-exam-problems/overview.md) + * [4.2. More Complex Conditions – Exam Problems](Content/Chapter-4-2-complex-conditions-exam-problems/overview.md) * [5.1. Repetitions (Loops)](Content/Chapter-5-1-loops/overview.md) - * [5.2. Loops - Exam Problems](Content/Chapter-5-2-loops-exam-problems/overview.md) + * [5.2. Loops – Exam Problems](Content/Chapter-5-2-loops-exam-problems/overview.md) * [6.1. Nested Loops](Content/Chapter-6-1-nested-loops/overview.md) - * [6.2. Nested Loops - Exam Problems](Content/Chapter-6-2-nested-loops-exam-problems/overview.md) + * [6.2. Nested Loops – Exam Problems](Content/Chapter-6-2-nested-loops-exam-problems/overview.md) * [7.1. More Complex Loops](Content/Chapter-7-1-complex-loops/overview.md) - * [7.2. More Complex Loops - Exam Problems](Content/Chapter-7-2-complex-loops-exam-problems/overview.md) - * [8.1. Practical Exam Preparations - Part I](Content/Chapter-8-1-exam-preparation/overview.md) - * [8.2. Practical Exam Preparations - Part II](Content/Chapter-8-2-exam-preparation-part-2/overview.md) - * [9.1. Problems for Champions - Part I](Content/Chapter-9-1-problems-for-champions/overview.md) - * [9.2. Problems for Champions - Part II](Content/Chapter-9-2-problems-for-champions-part-2/overview.md) + * [7.2. More Complex Loops – Exam Problems](Content/Chapter-7-2-complex-loops-exam-problems/overview.md) + * [8.1. Practical Exam Preparations – Part I](Content/Chapter-8-1-exam-preparation/overview.md) + * [8.2. Practical Exam Preparations – Part II](Content/Chapter-8-2-exam-preparation-part-2/overview.md) + * [9.1. Problems for Champions – Part I](Content/Chapter-9-1-problems-for-champions/overview.md) + * [9.2. Problems for Champions – Part II](Content/Chapter-9-2-problems-for-champions-part-2/overview.md) * [10. Methods](Content/Chapter-10-methods/overview.md) * [11. Tricks and Hacks](Content/Chapter-11-tricks-and-hacks/overview.md) * [Conclusion](Content/Conclusion/overview.md) diff --git a/SUMMARY.md b/SUMMARY.md index a58a92c67..980de6070 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -117,7 +117,7 @@ * [Problem: Element Equal to the Sum of the Rest](Content/Chapter-5-1-loops/exercises-loops/half-sum-element.md) * [Problem: Even / Odd Positions](Content/Chapter-5-1-loops/exercises-loops/even-odd-positions.md) * [Problem: Equal Pairs](Content/Chapter-5-1-loops/exercises-loops/equal-pairs.md) - * [Lab: Drawing with a Turtle - Graphical \(GUI\) Application](Content/Chapter-5-1-loops/graphical-and-web-apps/drawing-with-turtle/drawing-with-turtle.md) + * [Lab: Drawing with a Turtle – Graphical \(GUI\) Application](Content/Chapter-5-1-loops/graphical-and-web-apps/drawing-with-turtle/drawing-with-turtle.md) * [Lab Exercises: Turtle Graphics](Content/Chapter-5-1-loops/graphical-and-web-apps/graphical-and-web-apps.md) * [Problem: \* Draw а Hexagon with the Turtle](Content/Chapter-5-1-loops/graphical-and-web-apps/drawing-hexagon.md) * [Problem: \* Draw a Star with the Turtle](Content/Chapter-5-1-loops/graphical-and-web-apps/drawing-star.md)