1 00:00:00,270 --> 00:00:04,800 In part one, we implemented tasks one to four, and now the final task is to let the user search the 2 00:00:04,800 --> 00:00:05,880 database by name. 3 00:00:06,360 --> 00:00:09,200 So first it asks the user, who do you want information on? 4 00:00:10,020 --> 00:00:14,490 And the reason I'm using print, not print line, is because I want the user to enter the information 5 00:00:14,490 --> 00:00:22,710 beside the question, in which case I'm going to say string name is equal to scan next line to pick 6 00:00:22,710 --> 00:00:24,240 up the user's search query. 7 00:00:25,800 --> 00:00:30,810 Now we have the user's answer so I can make a for loop that runs through every row in the database. 8 00:00:31,050 --> 00:00:36,000 We are going to start at Rosero and the loop is going to keep running until we index every row in the 9 00:00:36,000 --> 00:00:36,780 database. 10 00:00:45,620 --> 00:00:49,340 And we know that the name is stored in the first index of each row. 11 00:00:53,420 --> 00:00:55,750 So I'm going to check the first index in each row. 12 00:00:59,910 --> 00:01:02,820 And check if it equals the user's response name. 13 00:01:07,270 --> 00:01:11,290 Then we're going to print all of the information about the figure that the user is searching for. 14 00:01:11,410 --> 00:01:14,740 I'll print a tab of space first, will print the user's name. 15 00:01:19,370 --> 00:01:21,680 Which is that index zero of rowby. 16 00:01:27,690 --> 00:01:29,310 Then I'll print the date of birth. 17 00:01:31,750 --> 00:01:33,880 Which is that index one of Roee? 18 00:01:39,750 --> 00:01:46,230 Then I'll print occupation, which is not indexed to overthrow I, and with this final line of code, 19 00:01:46,230 --> 00:01:49,920 we are done, the most exciting part is to test your code. 20 00:01:58,560 --> 00:02:01,140 Once again, I'm going to add information about Marco Polo. 21 00:02:09,139 --> 00:02:10,039 And Shakespeare. 22 00:02:21,290 --> 00:02:26,870 Prints all of the information good, and now it's asking me to search for a specific figure that I want 23 00:02:26,870 --> 00:02:31,160 information on, I'm going to say I want information on Marco Polo. 24 00:02:34,440 --> 00:02:39,060 And here it's running through every row in the database, and if what the user is searching for matches 25 00:02:39,060 --> 00:02:43,440 a name in the database, it's going to print all of their own values, as you're seeing here. 26 00:02:46,970 --> 00:02:51,560 Now, it would be nice if there was a line of space between here and here, so we can do just that. 27 00:02:54,790 --> 00:02:59,560 I'll put a new line and we're not going to put a new line here because we need the scanner input to 28 00:02:59,560 --> 00:03:00,490 be on the same line. 29 00:03:00,490 --> 00:03:02,770 So it makes sense that a new line right after. 30 00:03:13,260 --> 00:03:18,600 I can rerun the code and faster the output, and it looks like Java PD's complete. 31 00:03:20,470 --> 00:03:25,960 That is all I want to congratulate you on finishing up Module one at this point in the course, you've 32 00:03:25,960 --> 00:03:28,830 learned and implemented all of the Java fundamentals. 33 00:03:29,440 --> 00:03:34,240 You know how to store values inside variables, control how your code around using effluents, which 34 00:03:34,600 --> 00:03:41,310 break your code up into functions, run your code in a loop and use arrays to store many values at once. 35 00:03:42,310 --> 00:03:45,220 Now that you've reached the end, it's time for the ultimate challenge. 36 00:03:45,220 --> 00:03:47,030 You're going to try and build tic tac toe. 37 00:03:47,860 --> 00:03:52,600 This is not an easy challenge and you can bet your cup of Java that it's going to involve tuti arrays 38 00:03:52,600 --> 00:03:53,770 and nested loops. 39 00:03:54,340 --> 00:03:55,460 I hope you're excited. 40 00:03:55,480 --> 00:03:56,140 Let's do it.