0 added
0 removed
Original
2026-01-01
Modified
2026-03-09
1
<blockquote><p>Meow!</p>
1
<blockquote><p>Meow!</p>
2
<p>Stop messing around, time to work!</p>
2
<p>Stop messing around, time to work!</p>
3
<p>We have a new project, we need to write a computer store. It’s a serious customer: everything must be done in the best possible way. Here is a small technical assignment:</p>
3
<p>We have a new project, we need to write a computer store. It’s a serious customer: everything must be done in the best possible way. Here is a small technical assignment:</p>
4
<ul><li>The user selects the computer, and the program logs the result of the order.</li>
4
<ul><li>The user selects the computer, and the program logs the result of the order.</li>
5
<li>The message should include technical characteristics and the final price of the product.</li>
5
<li>The message should include technical characteristics and the final price of the product.</li>
6
<li>There is a base price for any computer, and the final amount depends on each technical indicator of the device.</li>
6
<li>There is a base price for any computer, and the final amount depends on each technical indicator of the device.</li>
7
</ul><p>I’m waiting for the result! Don’t let me down!</p>
7
</ul><p>I’m waiting for the result! Don’t let me down!</p>
8
</blockquote><p>As before, we will analyze the task to understand what the program will consist of.</p>
8
</blockquote><p>As before, we will analyze the task to understand what the program will consist of.</p>
9
<p>Obviously, we won’t be able to cope without a function. We will transfer the selected computer to the function and get the final amount. When performing calculations, we must take into account the base price of the device and the cost of each characteristic. For example, the prices of computers with a screen of 13 and 15 inches will be different. It turns out, each device has indicators: the base price and technical characteristics (RAM, processor and display size). In other words, we have several properties pertaining to one entity, a computer. Have you guessed where we will store it? That’s right, in the object.</p>
9
<p>Obviously, we won’t be able to cope without a function. We will transfer the selected computer to the function and get the final amount. When performing calculations, we must take into account the base price of the device and the cost of each characteristic. For example, the prices of computers with a screen of 13 and 15 inches will be different. It turns out, each device has indicators: the base price and technical characteristics (RAM, processor and display size). In other words, we have several properties pertaining to one entity, a computer. Have you guessed where we will store it? That’s right, in the object.</p>
10
<p>As a result, we’ll get a computer configurator. In the object, we’ll store the computer and its characteristics, and the object will be stored in the body of the function. When choosing a device, we will call the configurator function, which will write to the computer’s object its characteristics, calculate the price and return it.</p>
10
<p>As a result, we’ll get a computer configurator. In the object, we’ll store the computer and its characteristics, and the object will be stored in the body of the function. When choosing a device, we will call the configurator function, which will write to the computer’s object its characteristics, calculate the price and return it.</p>
11
<p>First, create the buildComputer function and the computer object inside it, and then check that the function returns it.</p>
11
<p>First, create the buildComputer function and the computer object inside it, and then check that the function returns it.</p>