Real World Guide

Old Level 03 - 1When I retrained my friends to be programmers, I noticed an interesting thing. People that already worked somewhere were learning very gladly. And the more experience they had out of IT, the more diligently they studied. Those, who were college students, sometimes just didn’t care. Having talked to working people and the students I noticed, that students believe in “magical employment” waiting for them right after they graduate. Now, for those who haven’t yet gotten rid of rose-colored glasses – here is the Real World Guide. We all have our needs. The need for family, friends, home, job, hobby… But I would like to talk about one of the most important needs that are always on the front burner: to have a good job and a good life. Most of the people have this need. And everyone tries to satisfy it almost every day through work, profession and career. It seems all logical to achieve this goal through professional and personal development. Which of us doesn’t want to become a highly-valuable specialist, an international professional: fame, respect, high income, great possibilities – sounds terrific. And what’s the action plan of all these millions and milliards of future high quality workers? Quite often this plan looks like this: finish school, prepare for the higher education, enter university or college, study, graduate, find a good job, work, do a stunning career, and leave on deserved retirement. That plan only seems right, but it isn’t. The difference between the right plan and the wrong one is this: the right one gets you to your goals, the wrong one doesn’t. The plan I described previously leaves out so many things from the real life, that I don’t even know how to call it: primitive, expired or simply wrong. What does the most common “success plan” in the world not take into account?

Competition

Old Level 03 - 2

1 The winner takes it all

5% of the best specialists get 50% of all money. 20% of the best specialists get 80% of all money. Some companies look for better employee and others - for cheaper one. The first type does not afraid to overpay, because they want to get the best specialist for money they have. The second type wants to pay the scarcest money for that minimum quality that will suffice. Old Level 03 - 3You begin your career/professional way at the left point of chart. But it is better to be in its most right part. A long way for you. You need to get to its right half as quick as possible. A specialist from right part of chart differs from a specialist from the left part by amount of experience, thus, by quality experience. While you are in the left half, number of such specialists as yourself on the labor market exceeds the demand. And that means it is a market of buyers (employer). And you have to compete with others like you for the lousiest vacancy. But as soon as you get enough experience, and pass to the right half, the rules of the game begin to change. Demand begins to exceed offer and salaries start growing. 5 years of good experience can multiply your salary by 10. So, think, look around, and study. But it’s even better to be in 5% of the best specialists. Here your salary will be limited only by money your clients/employers have. They want to hire the best - let them pay the most. Just like on auction. A smart and hard-working person manages to get in 20% of the best specialists in 5 years. And for the following 5 years he gets in 5% of the best specialists. But, certainly, he should work on his self-education and change jobs often. Sometimes overwork. There is no need to work many (long) hours. Best specialist does not do more work, he does it better. Better than anyone. That is why he cannot be replaced by ten less qualified workers. If on presidential elections you got 48% votes, and the second pretendant got 47%, you still did not get the support of majority, you did not surpass the competitor in two times. You come over him by one, only one percent! But you will become a president and will get everything, and he will remain nobody and will get nothing.

2 Looser gets nothing

Old Level 03 - 4If you have already entered a college, you are probably familiar with the situation that only 200 people enter, while there are 2,000 of those who apply. During the competition with 10 people applying for one place, from 1,000 people only 100 people will become students, other 900 will get nothing. What do you think will happen when you graduate and start looking for a job? Competition will increase dramatically! Let’s assume this year one graduates from Faculty of Law in Berlin. Let us further assume there are only 10 Colleges in Berlin that annually produce 1000 lawyers all together. At the market there are two vacancies with salary of $80,000 per year, 8 vacancies with salary of $40,000, and thirty vacancies in state organizations with salary $20,000 per year. Fail 1: 1000 "lawyers" and only 40 vacancies. That means, only 40 from 1000 lawyers will get jobs according to their professions and other 960 people, who spent 5 years studying in a college, will go to work as “sales managers”. Fail 2: You are one of the 40 best graduating law-students, what are your chances get the job? Far less than 100%, in fact there is “old-boy network”, hereditary professions, getting job through good connections etc. Most of these 40 vacancies will be occupied by sons, nieces and grandchildren of top-managers of these companies. Fail 3: You are the best graduating student of the year, but you don’t yet have the real practical experience. On the market there are already specialists with 3-5 years of experience who will also apply for good vacancies. They became overgrown with experience, reputation and got connections. So, maybe, you’ll have to start from the very bottom. Fail 4: You will have to work on "unpaid" jobs for the sake of experience for about 3 years, and at the same time you’ll have to work on your self-education, and only then you will be able to compete for good vacancies with a prospect, future valuable experience and high salary. This is the very stage you had to pass in college. But if you studied in an ordinary college, you will now have to do it all for yourself.

3 You have nothing

Old Level 03 - 5All you have is your diploma, but in most cases in the eyes of your future employer it isn’t worth the paper it was printed on. In most cases the employers know “the real value” of your diploma and its microscopic use in comparison to real experience. You have a higher education? Who doesn’t? A lot of people with higher education out there. It guarantees nothing. It’s just like a “I’m not a fool” certificate, nothing more. There is more use of your driving license. Colleges do not provide any super-modern skills. Usually you learn as much in a year of real work, as you learn in four years in college. That’s life, whether you like it or not.

Level 3

Old Level 03 - 6

1 Diego talks about a simplest program

- Hey, Diego! - Hey, Amigo! - Professor recently praised me. He was glad that I’m progressing thanks to his lectures. - Yeah, it’s exactly him to thank for. It’s freaking hilarious! - I have something interesting for you. I’ll tell you how to write a simple program. It’s very easy. A minimal program consists of one class and contains one method main(). That’s what it looks like. Old Level 03 - 7- I’ve already seen it before, so it’s clear. - But nobody wants simple programs. The more complex task the program solves, the awesomer it is. Therefore, programs consisting of thousands of classes are common practice. - An ordinary program is usually written by a team of 10 people for 2-3 years. - Then, what’s the big one? - Well, the program that more than 100 developers are working on more than 5 years. - More than 500 man-years? Wow! - You bet! And Java is one of the best programming languages for resolving large and huge tasks. - I even dare not ask what a huge task is. - You’d better not. - It didn’t take programmers long to realize that it’s easy to get lost in thousands of classes. So they have come up with special tools that speed up the process of writing programs by many times. Therefore, the larger the program you write, the greater the benefit. - Are you saying that the programmers created a program for writing programs? - You are right. First of all, a program is a tool for automating some routine operations. And if you write a code for years, then you have lots of such operations. - Programs for development of programs are called IDE (Integrated Development Environment). - Today you’ll get yourself familiar with one of them. - But not just one of them - the best of them! Its name is Intellij IDEA. It’ll be your friend for many years. It’s like an older brother who’ll always give a tip and help. - I am very intrigued! - Well, if you’re not going to write a program in Microsoft Word, then you need an awesome development environment, right? We the robots prefer Intellij IDEA Community Edition. Download and install its latest version.

Tip 1

How to find Intellij IDEA в Google

Tip 2

Download page of Intellij IDEA

Tip 3

Link to installation file

Tip 4

- You also will need to install JDK. JDK is actually a "Java Development Kit" which is made by the creators of the Java platform. JDK includes a Java virtual machine, a java class compiler and many other things a Java developer may need. - Why not write programs on the site? Just as I did it before? - It’s convenient for small programs, but it’s better to write large ones in Intellij IDEA. You know we’re going to make a professional programmer out of you. So the sooner you learn how to use those great tools, the better. Don’t be so scared, this program is designed to facilitate your life rather than complicate it. You will like it a lot and then even wild horses won’t drag you from it. - You need to write programs to learn how to write programs. To do this, you need to install Intellij IDEA and JDK on your computer. Download from internet and install the latest JDK 7 version.

Tip 1

How to find Java JDK in Google

Tip 2

Download page of JDK 7

Tip 3

  1. Click "Accept License Agreement"
  2. Choose "jdk-7u75-windows-x64.exe" if you have Windows x64
  3. Choose "jdk-7u75-windows-i586.exe" if you have Windows x32
  4. If you have Linux - you know what to do:)

Tip 4

2 Kim

- Hey, Amigo! How is it going for you? - Hi, Kim. - Everything is great. Today I’ve installed JDK and Intellij IDEA on Diego’s advice. I’m trying to figure out how to use them. - I’ll help you. I think I know a better way to teach you how to make applications. А picture is worth a thousand words. Here’s a video for you:
- Thanks, I’ll take a look. - Here’s another good link from the Intellij IDEA developer’s site Creating and running your first Java application - Thank you, I’ll take a look as soon as I manage the first one. - Now I’ll give you a step-by-step instruction. Firstly, start Intellij IDEA
Creating a project from scratch
1 Start Intellij IDEA
Old Level 03 - 8
2 Create a new project
Old Level 03 - 9
3 Select a project type
Old Level 03 - 10
4 Recently we’ve installed JDK. Now you need to add its reference to the project.
Old Level 03 - 11
5 Select the directory where JDK is installed
Old Level 03 - 12
6 Make sure that the project JDK is specified
Old Level 03 - 13
7 Here you can specify a template based on which Intellij IDEA creates a project. Do not select anything now.
Old Level 03 - 14
8 Specify a project name
Old Level 03 - 15
9 That’s it, the project is created. You can now create classes in the src folder
Old Level 03 - 16
- What are we going to do next? - Now we’ll create a simple program in Intellij IDEA
Creating a simple program
1 Right-click on the src folder and create a new package
Old Level 03 - 17
2 Specify the name of the package for our future classes
Old Level 03 - 18
3 Now create a new class for our code. Right-click on the package name:
Old Level 03 - 19
4 Type a name of the new class. Solution, for example
Old Level 03 - 20
5 Intellij IDEA created a class template for you. You can start writing a code now.
Old Level 03 - 21
6 First, create the main method
Old Level 03 - 22
7 Now display a message - It's cool to be a programmer!
Old Level 03 - 23
8 Right-click on the program code to run the program
Old Level 03 - 24
9 Enjoy the working program
Old Level 03 - 25
- And what are the lines «"C:\Program…» and «Process finished with exit code 0»? - It’s service information by Intellij IDEA. The first line contains startup options of the program, and the last one – its exit code. 0 is a normal program termination. - Thanks, Kim, that was an awesome lesson!

3 Elly

- A long time ago computers were only able to display text. The programs displayed the data typed from the keyboard. This mode of operation is called «working in console» or simply «console». Window interface is one of alternatives to console. This is when the program interacts with the user through a window / windows. Since you only learn to program, then we’ll start with the console. - I don’t mind. - The text is displayed on the console (screen) line by line. To avoid errors the text is typed on the keyboard and duplicated on the screen. It seems like a user and a program write text on the screen by turn. - You can display the text using System.out.print(). This function displays the text line by line. System.out.println() displays the text and moves the cursor to the next line. Old Level 03 - 26- You should add spaces to prevent words sticking together, for example: Old Level 03 - 27- Gotcha. - Thus, you can display anything at all: all Java objects can be converted into a string. All classes in Java are inherited from the Object class, which has toString() method. It can be called when the object needs to be converted to string. Old Level 03 - 28- I run this code, but the program has displayed “Cat is com.codegym.lesson3.Cat@1fb8ee3”. What is the meaning of this text? - A standard toString() method of the Object class returns a string consisting of a class name and an object memory address (in hexadecimal notation) - Humph, and what is the use of such method? - You can write your own implementation of toString() method in your class. When you call this method or JVM transforms your object to String, your code will be used (executed). - Really? Well, okay.

4 Julio

- Hey, Amigo. Here are some tasks on displaying for you:
Tasks
1 Date of birth
Write a program that displays your date of birth as follows: MAY 1 2012
2 My name
Write a program that displays your name on 5 rows. Each row should contain 10 words (your name) separated by a space.
3 Diego is my favorite teacher Write a program that displays the text «Diego is my favorite teacher» 1 time.
4 The product of 10 numbers
Write a program that displays the product of numbers from 1 to 10.
Hint: it’s three million and a little more
5 The sum of 10 numbers
Write a program that displays the sum of numbers from 1 to 10 by lines:
1
1+2=3
1+2+3=6
1+2+3+4=10

Example output:
1
3
6
10

5 Elly, String and non-string concatenation

- I’d like to tell you how to join strings. Gluing or joining strings together is also known as "concatenation". Those who love cats can remember it easily: Con-Cat-e-Nation. I’m joking. - The principle of joining strings together is simple. If we "add" a string and something else, then that something turns into a string by a hidden call of the toString() method. - Say what? - OK. I’ll make it simple: the number will be converted into a string, as well as the cat, if we add a string to a number and a cat. Examples: Old Level 03 - 29

6 Diego

- Hey, buddy. Here are a couple of tasks for today. To make it more difficult, only variables can be passed to method print/println. Old Level 03 - 30- Is it possible? - Mark my words, Amigo, impossible is nothing for us, the Robots. We can bend unbendable.
Tasks
1 Stop Look Listen
Write a program that displays all possible combinations of words «Stop», «Look», «Listen».
Hint: there are 6 variants. Display each combination in a new line. Do not separate words.
Example:
LookListenStop
ListenStopLook
...
2 Multiplication table
Write a program that displays the multiplication table 10 by 10 as follows:
1 2 3 …
2 4 6 …
3 6 9 …
3 Seven colors of the rainbow
Write a program that displays seven colors of the rainbow.
Two lines must have three colors. The third one must have just one color.
Separate the colors in the lines by spaces.
4 Escape character
Read about escape character in Java in additional material to the lecture.
Write a program that displays following two strings:

It's Windows path: "C:\Program Files\Java\jdk1.7.0\bin"
It's Java string: \"C:\\Program Files\\Java\\jdk1.7.0\\bin\"
5 Studying Japanese
Write a program that displays 日本語

7 Elly, Keyboard input

- Amigo, the time has come: now I’ll tell you about the keyboard input. - We used System.out to display data. And now we will use System.in to input the data. - It sounds easy. - But System.in has one disadvantage. It allows you to read from keyboard character codes only. To solve the issue and read large chunks of data at a time we’ll use a more complex structure: Old Level 03 - 31- Is it clear? - Uh... Clear as mud. - It is better to use BufferedReader object when you need to read a line from keyboard. You need to pass to BufferedReader the System.in object. And BufferedReader will read data from it. - But System.in and BufferedReader are not compatible with each other. We need to use InputStreamReader object as an adapter. - I kind of got it. And what is this Scanner class? - Sometimes it’s convenient to use Scanner, but mostly it doesn’t help much. It is better to use BufferedReader and InputStreamReader. I’ve just shown Scanner class for you to know that it exists. We are not going to use it. - OK, but I’m not sure if I understand this topic completely.

8 Diego

Old Level 03 - 32- Hey, Amigo. You’re doing great. Now you are ready for a serious staff! Here’s a new task: write a program that reads some data from keyboard and displays text containing those data:
Tasks
1 How to conquer the world
Write a program that reads from keyboard a name and a number and displays the text:
«name» will conquer the world in «number» years. Bwahaha!
(The sequence of input data is important.)

Example:
Joe will conquer the world in 8 years. Bwahaha!
2 Salary in 5 years
Write a program that reads from keyboard a name and two numbers. Program should display the text:
«name» earns «number1» in «number2» years.

Example:
Nick earns $150,000 in 5 years.
3 Modesty adorns a man
Write a program that reads from keyboard a name and displays the text:
«name» earns $15,000 per month. Haw-haw!

Example:
Tim earns $15,000 per month. Haw-haw!
4 Sponsor! That has a proud sound!
Write a program that reads from keyboard two names and displays the text:
«name1» sponsored «name2», and she became a famous singer.

Example:
Nick sponsored Helen, and she became a famous singer.
5 Pure love
Write a program that reads from keyboard three names and displays the text:
«name1» + «name2» + «name3» = Pure love, oh, yeah! Right!

Example:
Joe + Eva + Angelica = Pure love, oh, yeah! Right!

9 Professor, How to do homework

- I want to tell you how to do practical homework in Intellij IDEA. I’m sure you will soon appreciate its power. Let’s stick to instructions: Step 1. Click the top menu "MY PAGE", then go to "My Downloads" and download "Project Template". You can also do this on the Profile page or following the link CodeGymHomeWork.zip Step 2. Unzip the archive to any folder. Inside you’ll find folders CodeGymHomeWork and CodeGymIdeaPlugin. CodeGymHomeWork contains a project where you can write your classes and do homework. There are also instructions for installing the plugin. Step 3. Open the downloaded project. Just launch Intellij IDEA, choose the File menu, Open Project, and then specify the folder CodeGymHomeWork (the one inside the archive). Step 4. Install the Intellij IDEA plugin Read the instructions available and install the plugin. Step 5. Create a package for your classes In the src folder create a package «com.codegym.test». This package and its subpackages will store all the classes you created. Example: «com.codegym.test.level01.lesson05.task01» If something is not clear, then here’s a video on how to do it:

10 Professor

- Hi, Amigo! I like how quickly you progressed thanks to my lectures! If you want to read something else on the complicated subject, here’s a useful link to our site. - I don’t much like these short lectures of Professor. If the student doesn’t work in a college, he will work at a job. But much harder. CodeGym Lecture 3 Discussion

11 Julio

- Hey, Amigo! Hope you’re ready for some even more hard and tiresome rest?- For each tv series episode you’ll be given 2 to 10 units of ‘dark matter’.

12 John Squirrels, Homework

- Hello, soldier! - Good morning, Captain John Squirrels! - I have excellent news for you. Here are tasks to enhance your skills. Do them every day, and you’ll improve your skills very quickly. Tasks are specially designed to do in Intellij IDEA.
Additional tasks to do in Intellij Idea
1 Life is good but good life is even better
Write a program that displays «Life is good but good life is even better»
2 I don’t want to study Java, I just want a huge salary
Write a program that displays 10 times: «I don’t want to study Java, I just want a huge salary»
3 I will earn $50 per hour
Write a program that reads from keyboard a number n and displays «I will earn $n per hour».

Example:
I will earn $50 per hour
- How am I to do them? - First start Intellij IDEA. You can get your unsolved tasks in plugin. You can also send your solutions for checking using it, like on the video you’ve watched in this level. - OK, I’ll try it right now... - Upon that, here’s a great video about some features of Intellij IDEA. The video is large enough, but very interesting.