1 00:00:00,290 --> 00:00:03,960 In this course we're going to use C# to create a shopping program for 2 00:00:03,960 --> 00:00:06,520 the Kitty Cuisine cat food store. 3 00:00:06,520 --> 00:00:08,840 And this cat food sure is popular. 4 00:00:08,840 --> 00:00:11,990 People often buy cans of it in groups of 50, 100, or 5 00:00:11,990 --> 00:00:14,820 more, even though they cost \$2 a can. 6 00:00:14,820 --> 00:00:17,680 The store needs us to write a program that lets a user 7 00:00:17,680 --> 00:00:20,370 type in the number of cans they want to buy. 8 00:00:20,370 --> 00:00:23,280 Then it should multiply that number to get the total price and 9 00:00:23,280 --> 00:00:25,060 report the total to the user. 10 00:00:25,060 --> 00:00:29,050 They're also thinking that they may need to offer discounts if a user is purchasing 11 00:00:29,050 --> 00:00:30,850 a large quantity. 12 00:00:30,850 --> 00:00:32,150 Sound complicated? 13 00:00:32,150 --> 00:00:36,313 Don't worry, everything we need to solve this problem is built in to C# and 14 00:00:36,313 --> 00:00:37,795 the .Net framework. 15 00:00:37,795 --> 00:00:40,750 We'll learn how to output text to the terminal and 16 00:00:40,750 --> 00:00:43,310 store values the user types in. 17 00:00:43,310 --> 00:00:45,780 We'll learn how to do arithmetic in C#. 18 00:00:45,780 --> 00:00:50,142 And we'll learn how to write C# methods that let us break the problem into small 19 00:00:50,142 --> 00:00:51,470 chunks. 20 00:00:51,470 --> 00:00:55,070 Let me run my code to give you a preview of what the finished shopping program will 21 00:00:55,070 --> 00:00:57,320 look like, dotnet run. 22 00:00:58,440 --> 00:01:02,880 It needs to greet the user with the message, Welcome to the cat food store! 23 00:01:02,880 --> 00:01:05,910 Then it needs to ask them how many cans they're ordering. 24 00:01:05,910 --> 00:01:08,695 It should wait for them to type in a quantity and press Enter. 25 00:01:10,200 --> 00:01:13,690 The program will need to store whatever quantity the user enters in 26 00:01:13,690 --> 00:01:15,750 the computer's memory. 27 00:01:15,750 --> 00:01:17,611 Each can costs \$2. 28 00:01:17,611 --> 00:01:21,796 So the program should multiple the quantity by two to get the total cost, 29 00:01:21,796 --> 00:01:26,117 then it should print out a message that includes the quantity the user typed 30 00:01:26,117 --> 00:01:27,985 in and the total cost. 31 00:01:27,985 --> 00:01:30,715 And one more thing, the store wants to offer discounts for 32 00:01:30,715 --> 00:01:32,925 ordering a lot of cans at once. 33 00:01:32,925 --> 00:01:37,517 So if a user orders 50 or more cans, let me rerun the program and 34 00:01:37,517 --> 00:01:41,955 enter 50, they should only be charged \$1.75 per can. 35 00:01:43,000 --> 00:01:49,371 And if a user orders 100 or more cans, they should only be charged \$1.50 per can. 36 00:01:50,630 --> 00:01:54,350 So here's our checklist of features our program is going to need. 37 00:01:54,350 --> 00:01:57,530 Over the rest of the course we'll learn the C# concepts we need 38 00:01:57,530 --> 00:01:59,230 to implement each one. 39 00:01:59,230 --> 00:02:02,440 Then we'll cross that feature off our list when we're done. 40 00:02:02,440 --> 00:02:06,400 There are several areas of the C# language that we'll need to cover in order to 41 00:02:06,400 --> 00:02:08,280 implement these features. 42 00:02:08,280 --> 00:02:10,360 Variables will let us store data, and 43 00:02:10,360 --> 00:02:13,760 types will help prevent us from using that data incorrectly. 44 00:02:13,760 --> 00:02:18,170 Methods will let us break our code into smaller, more maintainable chunks. 45 00:02:18,170 --> 00:02:21,730 We'll use strings to hold text to show the user. 46 00:02:21,730 --> 00:02:24,620 Numeric types will let us store numbers. 47 00:02:24,620 --> 00:02:26,830 We'll also need to multiply those numbers, for 48 00:02:26,830 --> 00:02:29,920 which we'll need to understand math operations. 49 00:02:29,920 --> 00:02:34,280 And lastly, we'll need to apply discounts if a certain quantity is ordered, for 50 00:02:34,280 --> 00:02:36,120 which we'll need if statements.