Transcripts
1. Introduction: welcome to the C Sharp for beginners. Step by step course. In this video, I will give you a brief preview of what to expect in the course, how to get the most out of it and what you will learn in the first section. I have designed this course to teach you the most important concepts and features of programming and the C sharp language. We will be building a very simple A team application in this course and the major parts of the sea Sharp language will all be used to do that. I will teach you a feature of the language and we will immediately apply it. In a real scenario, the governor is just in time learning and doing so. The concepts will stick with you on. When you finish the course, your foundation in the language will be solid and you will be capable of moving on and building more sophisticated C sharp applications. Each video in this course that we create code in has a download of the finished product in the resource is section. This should help you get through problems where things just aren't working for you. In that particular video, however, I strongly encourage you to avoid the French product unless you are having issues. The first hurdle you have to overcome when learning a new programming language is the syntax. Until you can sit down and write code without thinking about the syntax, you're wasting brain cycles. Top the code yourself. Practice riding C sharp code until you are completely comfortable doing so. Even go so far. A. Still delete your code and write it again until you can do so from memory. The best way to learn a programming language is repetition over and over until it is second nature. In this section, we will start with the basic requirements of the A T M application. The requirements will be laid out and presented in a way that a real product that you are being paid to create might be presented. Then we will look at why C. Sharp is a great beginner level programming language and what you might be able to accomplish the C sharp. What kind of platforms of language supports some of the frameworks available and so on? Then I will help you get the latest version of visual studio downloaded and installed on your machine. Finally, I will show you how to navigate around inside of visual studio and how to use the program. In the next video, we will look at the requirements of the A T M application.
2. ATM Application Requirements: in this video, I will go over the basic 80 M application requirements. There are a couple of things you should know about requirements first, there almost never given to you in a completed state. It will be your job to ask questions. It helps to remember that most likely the requirement originated from an idea. It is just a likely that the idea came from a business person and even more likely that the person who had the original idea didn't put much thought into things like security, performance, maintain ability, reuse and validation. You have to consider all these points and mawr when implementing of requirement. Second, the requirements you're given will most likely touch on other requirements that are not mentioned in the requirement you were given. It pays to be forward thinking and make your codas extensible as possible. For example, the same. We have a basic requirement for validation of a field that has a US based phone number, so you implement that requirement later on, you get another requirement to validate another field that has a US based phone number, and still later you get another requirement for validating awful number fields and the validation has taken to account the country code that was selected by the user. Depending on what work you have done, you may have to completely scrap it, and you may even have duplicate code in your system, and you will have to make changes in several different places. You could have avoided most of this trouble with proper design. As a disclaimer, I have gotten requirements that were as complete or even more so than they would be if I had done them myself. But the 1st 2 rules will apply. Most of the time you will least find yourself in that situation more so than not. Let's move on to the basic requirements for the A team application. As a user, I would like to be able to log into the application with a four digit account number and four digit PIN number. This is a pretty simple requirement, obviously, in a re elei tm, you have a car that you insert and the pan must match the pin number that is stored for the card. But for now, this will do but notice what is not mentioned. What if an invalid combination is entered? What would happen if a user tried 10 or 12 times to log in with back credentials. As a user, I would like to be able to log out of the application again. This is an easy requirement, and if you can log in, you should be able to log out as a user. I would like the system toe have a main menu that is accessible from all other screens of the application. Do you see anything wrong with this requirement? Notice that it doesn't have any details on what the screen should have. As a user, I would like to be able to view my account balance again. This is a straightforward requirement, but detail is missing. As a user, I would like to be able to make deposits into my account. There is detail missing here, too, but we will ignore that for now. As a user, I would like to be able to make withdrawals from my account. What if the user has less money in the account that they want to withdraw? What if it is exactly the same amount that the user has in their account? As a user, I would like to be able to view all my latest transactions. How many exactly? What if there haven't been any in over a year? What if there are thousands in the past week? As you can see, you will almost always have more questions than answers. You will need to have a conversation with Stakeholder, the business analyst or the person who created the requirement. In the next video, we will be setting up your development environment.
3. Why C#: in this video, I will make my argument for why I believe C. Sharp is a great language for you to learn to begin with. I want to say right away, the sea short may not be the best language for everyone. If you are looking to ride an operating system like Windows or leanings, C Sharp is in fact the wrong language For you to learn. You should be looking at C or C plus plus, if you are trying to create something that absolutely must work directly with hardware, C Sharp is not the best choice. But if those two categories don't really, you out. C Sharp is probably a great language for you to learn. Let's start with the language and features. C. Sharp is a modern, high level language. This means that is closer to spoken words than lower level languages like assembly or C. The language does, however, have a C style syntax. This has been official because there are many languages that have a seashell syntax, and that means that if you learn, see sure you will have an easier time picking up another seat based language like Java C C plus plus or Java script. They look and behave similarly. C Sharp is in demand. I will give a couple of points of proof later in this video, but it is consistently one of the five most popular programming languages. C Sharp is an easy language to pick up but has a breath that makes it difficult to master. In many cases, there are several different ways to accomplish a single task, which makes it harder to master. C. Sharp has an extremely strong community surrounding it. Microsoft is always done a wonderful job to back the language and make sure the documentation is second to none. And there are millions of examples out there. If you want to do something, nearly anything, you can find an example or thousands on the Web for just that thing. Much of the C Sharp language is open source, and it has an enigma or E. C. M. A standard, which is publicly available but owned by Microsoft. Recently, The Dark Knight framework was also made publicly available and open source and has a version running on Lenox and Eilis. C. Sharp is rapidly evolving, and this is very important. When C. Sharp was first introduced it was clearly a knockoff of Java in many ways. Now, however, Java appears to be somewhat of a knockoff of C Sharp, and the Java language is following and see shorts footsteps. A new version of C Sharp is released about every two years, and every release always has some really great features. As I mentioned before, C Sharp can be used to great programs on platforms other than just windows, and to me, that drastically increases its appeal. Finally, using C sharp means you can use visual studio. What I'm about to say may be considered controversial. Visual studio is by far the best development environment available, free or commercial. Some will laugh at that and say they are more productive in VM or cliffs or some other integrated development environment. But here's the thing. If they are, it is because they're no doubt an expert in those environments. However, until you reach that expert level, there is very, very little doubt that a beginner and visual studio will be more productive and proficient than a beginner in any of those other environments. In case I haven't convinced you, I want to give you a quick run down some of the things you can accomplish with C Sharp. If you are targeting Windows, you have two options WP F or Windows Presentation Foundation and Universal Windows Platform or You WP for short, which targets Windows 10 WP f can still be used in Windows 10 But you WP is the recommended way to go for Windows 10 and future versions of Windows. If you want to create Web applications, you have a SP .net, also known as Web forms and s p dot net. NBC. NBC uses the popular Model View Controller Development Paradigm. I would recommend that if you are going to do Web you had in the NBC direction, Wet Forms is not as popular. Currently is NBC, and I can't see Microsoft creating many new features for that particular platform. If you need to create Web services again, you have two options. Windows Communication Foundation or Day Bcf and Web AP I I won't make a recommendation on this one, as I have used both, but I definitely prefer Web A PR. It is just easier, and W C F has never really resonated with me, but your knowledge may very if you are targeting Mobile Zaman allows you to write C sharp code that compiles into native applications. Zaman supports IOS, Android and Windows phone. Of course, IOS and Android are the biggies and cover 90 plus percent of the market. In case you do need Windows phone support, though, you have it for the cloud. Microsoft Azure is pretty incredible, and it, since it is from Microsoft, has really good support in integration. But you can use Amazon Web services. Finally, we come to game development, and the £900 gorilla for C Sharp based game development is Unity three D. If you are an aspiring game developer, you really should check out unity. It isn't just for three D support to Dia's well, and Unity supports just about any platform that you would want to target, including IOS, Android Windows, the Web, the PS four, the Xbox one Wii U and Nintendo DS. If I didn't mention a platform, you are interested in check unities website as they support nearly 30 platforms currently. Next, let's look at some popularity points first. When I searched dust dot com on February 24th 2018 there were about 6000 open C sharp positions. The language is currently ranked number five on T. O B's Programming Language Popularity Index. You should check out the index to see how T o. B ranks, the languages and the formulas they use if you want salary numbers. Glassdoor says that the average C sharp developer in the United States makes about $80,000 per year, and the average senior C sharp developer in the United States makes about $97,000 per year . Both are pretty impressive numbers for something that you absolutely do not have to go to college for and can learn in a few months. And as I mentioned earlier in this video, if you learn C sharp, you can learn other sea bass languages more easily, and that will open up even more job opportunities. In the next video. I will help you get your development environment up and running
4. Setting Up Your Development Environment: in this video, I will give you a quick overview on installing visual studio. Open a browser to visual studio dot com. Forward slash downloads. You should see the four options on the screen community, professional enterprise and code. Click the download button for Visual Studio 2017 Community Edition. This is a pretty fast download when it completes open that program up. This may take a few moments, so feel free to pause the video until the installer loads. Once the program is loaded, you should be presented with an installation dialogue like the one in the slide. Make sure you are in the workloads tab and you are welcome to pause the video again and go through these options. But make sure you select the dot net desktop environment highlighted in this slide. I will give a quick overview of the more important options that are most likely to interest you. I just want to give a word of warning here. If you select a bunch of options in this dialogue, your download time is going to multiply it many times over. Okay, and the top section is Windows Development. The Universal Windows Platform development option will enable you to develop Windows 10 applications and applications for the Windows App store. The dot net desktop development section is what we will be using and definitely needs to be installed in the Web and Cloud section. The SP dot net and Web development option will allow you to develop a s p dot net and SP .net NBC applications if you select the NBC option in the right hand. Pain in the mobile and gaming section is both Sam and for mobile and Unity for Game development. And finally, in the last section under other tool sets, the dot net core cross platform development option is available for developing cross platform applications. I recommend that for now, you only select the dot net desktop development option and in the right hand pain, just leave the default options as they are. You can run this application again at any time to modify your installation, and the next video I will walk you through the visual studio user interface
5. Introduction to Visual Studio: in this video, I will give you a very brief introduction to Microsoft Visual Studio, but a fault. When you launch visual studio, you should see the start page in the left hand pain. All of the most recent project you have worked on will be listed. This is a real convenience because for the most part, you will be working on the same things day in and day out in the middle pain. You have the open section, which allows you to check out projects from source control, using visual studio team services and get hub. Both are free, and I encourage you to check them out. Visual Studio Team Services is located at www dot visual studio dot com and get Hub is located at www dot get hub dot com. Accessing the source control function of each of these sites will require you to sign up for a free account, but both are totally worth it. Source control is the practice of storing your code in an online repository that you can use for version control and back up version. Control means that each time you check a fall in the version control system will create a new copy of the Foul. You can look at the previous versions to see what has changed over time. Below the check out section, you can open a project solution or photo from disk using a standard open dialogue. You can also open a Web project from disk or connect to a Web server to edit those projects below the open section. You have the new project section. In the bottom half of this section, you will find all the project templates you have used recently. Beneath. The recent Project Template list is a create new project link, which will open up the Create New Project Wizard Dialogue, where templates are grouped into similar functions. Above the recent projects list is a text box where you can search all the templates you have installed on your machine for a specific project. Top If I type in a sp dot net a inner, I will see a list of all project templates to have a s p dot net in the template name that I have installed. The right ham pain is developer news that is published and maintained by Microsoft. I don't get much use from the news, so I always minimize it, but you, as a new developer, might find some good articles in there from time to time. Let's move the visual studio's menu system and foul. We have a menu item for new that will allow you to create a new project website, and so one using the wizard we saw earlier. There is also an open menu Adam that lets you open a project or solution or a website just like the home page towards the bottom. There is a recent files menu, Adam that will show a list of follows you have recently opened, and below that is a recent project and solutions being you, Adam, that will show a list of projects and solutions you have recently opened. Visual studio is a windowed environment Inside the visual studio main window. You will often have dozens of tool windows open in three different tapped pains on the left , right and bottom and the View menu. Most of a child menu items are windows, and there are even mawr under the other Windows menu Adam. There are also many tool bars you can show or hide that perform a variety of functions under the tools menu at the bottom, there is an options menu. Adam. If you want to customize visual studio, chances are the configuration is in this dialogue. There are thousands of ways to customize the environment, but for most people, the default settings will be fine. There are a couple of configurations I want to call your attention to. Under the environment. Heading the first is fonts and colors. If you have trouble seeing the text on the screen, or if the Texas too large, you can adjust that here. The second is keyboard shortcuts. This will allow you to assign new shortcuts to existing atoms or create your own. As you become more experienced, you will find yourself using the mouse less and relying on the keyboard more and shortcuts becoming very important. The last man you I want to show is window. The more you use visual studio, the more you will want it to be a certain way. When you are happy with the layout, you can save it with the Save window layout. Menu Adam. After saving a layout, you can restore that. Lay out any time with the apply window layout menu Adam, and finally, you can reset the window layout to the factory defaults with the reset layout menu. Adam, Let's look inside visual studio for a bit. All the tool windows in visual studio can be pinned, and I'm pinned and resized. You can customize it to suit your knees and what you're working on. Visual Studio also remembers the window order. If you notice the solution, Explorer windows at the top rod and the properties window is on the bottom, right. I will, um, pin them both. And if I then pin them back open again, they go back to where they were. Before being on pin, you will notice that you have several to windows at the bottom. Arguably, the air list is the most handy, as they will give you details about errors in your code before being compiled. Visual studio also supports split pain views. I will open to code falls and then use a split pain view for the code area. This is great for side by side comparisons. The last thing I want to show is how to debug. Debugging is the practice of walking through the code as it executes to see first hand. What is happening Debugging is called debugging because it is usually what happens when you were tracking down bugs in your code. On the far left, rob aside the code window, you will see a thin grey strip. You can set break points on any line that has executed BLE code in it by clicking the strip . Break points are handy because they stop your code from executing. If you know the area of your code that is having a specific problem, this will save you from walking through everything you can just set a break point where the problem is and start there. So I have sent a break point and you will see that program execution pauses When it gets hit, you can tell by the way the red line turned yellow. You can remove a break point by clicking the same spot again. To make your debugging easier, I want to call your attention to three different toolbar items at the top of the screen. The first to step into the shortcut key for step into is F 11. You will use it a lot when you are debugging and you have a method being called. You can step into that method and see what is going on there. The next toolbar, autumn is step over. It does the exact opposite of step into by stepping over called methods. The shortcut key for step over is F 10. Finally, the step out to a bar Adam will step out of a method that you have stepped into, and that keyboard shortcut is shift F 11. Pay attention to this while the bugging. You have fine control over many things. As you can see, I entered 1234 for this prompt while debugging. Though I can hover over the variable housing the value 1234 and change it, I will add a five to the end, and as you can see, it has now changed. You can do the same in the locals tool window at the bottom of the screen. I will add a six. Now if I hover over the variable again, you'll see the value has been changed to 123456 This concludes the tour for visual studio. I know it might seem a bit overwhelming because it is a big product, but just use what you have to and learners Ugo. In the next video, we will be in Section two and start looking at C Sharp
6. C# Introduction: in this section, we will start our adventure into C sharp. First, we will learn about the visual studio console application project template and what you might use it for. Then we will learn how to create and use variables and how to properly scope any that you may need to create. Then we will build the log in screen for the application and start looking at control logic using FL statements after, if else we will look at how to authenticate users in our application, and then we will learn about properties, methods and constructors how I'm going to use each and how to properly scoped them. After that, we will learn more about control logic by looking at switch case statements. And then we will build the main menu screen after the main menu screen. We will look at a couple of different methods available to us to manipulate strings, and then we will build the display balance screen. After the display balance screen. We will take a few minutes to examine how math and see sharp works. Then we will build the deposit screen after the deposit screen will have a look at business rules and then build the withdraw screen and then take a look at a raise, lists and generics. Next, we will take a look at the different loops we can use and then build the recent transaction screen. After the recent transaction screen, we will learn how Link works and then build support in the application for more than one user. Finally, we will go over e news and then fix a few bugs that exists in the application. In the next video, we will start with consul applications.
7. Console Apps: In this video, we will look at console applications and their uses. Consul applications are the most basic seashore application time. They lack the typical user interface that we are accustomed to. Instead, users interact with them from the command line by entering commands in the form of text and reading the applications output from the same window. Because their basic and do not necessarily require interaction from a user, it makes them the perfect project choice for performing repeatable tasks where the conditions and inputs are already known. That could be ran from the command line and from other applications. Impetus to a consul application happened in two ways. First arguments can be specified when the program is launched. Second Consul applications can retreat text entered by the user in two ways. Consul dot Reekie and council dot reid Line both consul dot Reekie and console dot Reid Line perform a blocking action, and execution of the program stops until text is entered. Council dot Reekie reads the first key pressed by the user console dot reid line reads all text. The user is entered as soon as they press the enter key. Getting data out of a consul application is very similar. Consul dot Right and console Die. Right line. Right. Text to the console window console. Die right will replace text on the current line where the cursor is and console that right line will create a new line. And I put the text there. In the next video, we will look at C sharp variables.
8. Variables: variables are an in memory representation of a piece of data. They're made up of three parts. The variables top the variables name and the variables value variables must be declared, and this is more commonly called a variable declaration. In these two variable declarations, you see the pattern of the top string and the name greeting and first name in the first. The variables value is set during the declaration in the second. The variables value set after the declaration, but both statements are essentially the same. Top name and value variables are important because they represent data that are programs can manipulate and use. There are two main types of variables. Reference tops and value tops. Reference. Top variables are actually a reference to a piece of memory. If two reference top variables both point to the same piece of memory, changing the value of that memory for one variable will change the value for the other variable as well. Value top variables air different. They're always small and actually house the value. If you assign a value top variable of value and copy that value to another value top variable, the value is actually copied. This table shows the list of value tops for 99% of use cases. You can use the following variable map things strings for alphanumeric data and for numbers , double for precision numbers with the decimal place and the number of digits after the decimal place matter. But for binary data, like a file bull for true false values and long for very large numbers after 18 years, they're still tops in the value top list I haven't used. And you likely won't either. In the next video, we will discuss bearable scope and access modifiers.
9. Variable Scope and Access Modifiers: variable scope determines the visibility of a variable to the rest of the program. In short, variables are generally scoped to the object they are created in. This includes methods. Methods will be covered in death in a later module, but we must touch on them here if you are to have an understanding of arable scope. A method is a co block that contains one or more code statements. They're defined by their signature, which is the return top name and arguments like this. The first line double calculate tax double value is the method. Signature, as I said, is the top of value. The method returns the name of the method and the arguments that must be passed to the method for it to do its work. The variable double tax is declared in the calculate tax method, so it is visible only to this method, and that means the variable scope is limited to only this method. Here is another example. This is the greeting generator class. The greeting generator class contains the greeting variable because the grating variable was declared at the class level and not in a method. The variably scope to the class and any method in the class can make use of the greeting variable as the display greeting method does notice the signature of the display greeting method. It returns void, which means no or nothing avoid return. Time means that the display grading method does not and actually cannot return a value when executed. Here is one final example took have variable scope again. We have the greeting generator class and the grating variable is still available. But the change creating method will change the value for the greeting variable. When a variable that is scoped at the class level has its value changed, it will be changed for all methods that make use of agreed unbearable. For this reason, always err on the side of caution and limit the scope of any variables you're using. If the variable is really needed in more than one method, a class level declaration may be warranted. But if it is not declared at the lowest level possible, which typically means in the method, using the variable access modifiers are a way to change the visibility of properties, which are something similar to variables, methods and even entire classes. By the fall, any class you create is not visible. This is known as private, just like variable scope. You should always err on the side of caution and get classes, methods and properties the lowest visibility that is needed. This table at ones, the different access modifiers. There are a couple of terms that you may not recognize in this table, and assembly is a compile Dr Object. There are two different tops. Process assemblies, orry axes and library Singhalese or D L. Els e Exceeds can run on their own. And dll zehr, used by other assemblies as functional libraries or, in other words, code that could be executed by another assembly. Inherited were inheritance is a key tenet of object oriented programming, or O lt. It means that class can inherit the functionality of another class. This creates a parent child relationship. Take a moment and pause the video to review the table. If you haven't done so already, all access modifiers listed in the table can be applied to classes. This is important because the visibility of the class directly affects the visibility of any methods, properties or variables contained in that class. For example, if you declared a class as internal but have a public method. That method will be automatically restricted to internal, since only other classes in the same assembly can see the class. In the next video, we will start building the logging screen.
10. Login Screen: In this video, we will be building the log in screen, launch visual studio and click the Create New Project link at the bottom of the new project section. Here you will see a list of project tops. Select the consul app dot net Framework project that you may also see a consul at dot net core project Top is well, depending on what you installed but selected dot net framework version and in the name text box at the bottom of the dialogue. Enter the name a T m. Your version might take longer or shorter to load. If this is the first time you have ran visual studio, it will almost certainly take longer. It could be a long as 30 seconds. This is all we get with a console project Static void Main is what is known as the entry point of the application. Static is something new that we haven't touched on before. When the static modifier is attached to a class, it means the class cannot be in Stan Shih ated or created. This also means that in memory there could only be one copy of a static. The object it is singular also studied classes can only have static methods. A static method on a non static class, however, is a little different. It means that the method can be called without a stance, creating an instance of the class and the main method we're going to create to string variables toe hold the prompts for the user. The first is account number prompt, and we will set the value of that variable Teoh inner account number. The second will be PIN number prompt, and that value will be in her pin number. Using console dot right line, we will prompt for the user's account number. We will then create another string variable named account number to store their response. We then prompts for the PIN number with consul dot right line, and we will create another string variable named pin number to store that response. Finally, we will add a console dot Reekie just to keep the program from accident. For now, this is all we need to do. We need to learn something new before we can authenticate the user and allow them into the system. Let's run the app and see what we get. We should get a prompt to enter the account number and another prompt in our pit member, everything seems to be working. In the next video, we will learn about if statements.
11. If Else Statements: In this video, we will be looking at FL statements. If else statements are also known as control logic, they're often used to control the flow of an application. If one statement is true, go down this path if it isn't go down this other path. If else statements are used to evaluate expressions of Boolean logic, we're going to look at a series of examples and go through an explanation of each. In this example, we are doing a comparison of two variables A and B. The value of these two variables isn't really important right now. The double equal sign is what is known as the Equality Operator. The Equality Operator compares the values on the left side to the right side of the double equal sign. A single equal sign will assign a value, but a double equal sign reforms a comparison between the left and ride. In this example, we haven't added step. If a and B are equal, we perform the same actions as a last slide. However, if they aren't equal, we perform the else code in an if else statement on Lee, one set of code will execute either the code in the F block will execute or the code and the else block will execute. In this example, we again haven't out of step. If we need to test more than one condition separately, we can perform an else if statement. This is different than the else condition because we are testing for a second condition. We still haven't else block to catch any conditions that are not specifically tested for, but else if blocks are good ways to avoid nested if statements, which is an if statement nested within another, if statement nested, if else statements can quickly get out of hand and become hard to read and understand if you run into conditions that require nested. If statements and there are plenty of reasons why this may happen, try to find a way to make the code easier to read and understand your future self will. Thank you. In this example, we're testing for an actual Boolean value in the first if statement were literally saying, If true, however, I wanted to show this example because the second statement has a bit of spice notice the exclamation point at the beginning of the test. In this context, the exclamation point means not so in the second were actually saying, if not true or false. One final example. These statements are a bit more complex, and the first, if statement were performing two different tests, the double and for Sam Means. And so the stigma says, if a is less than B and C is less than D, in the second s statement, were performing two different tests. And if either are true, the code in the if statement will be executed. The Devil pat means or so the second, if statement, says that if B is greater than A or C is greater than D, this is a list of the most common operators you will see equal Sue not equals to greater than greater than or equals two last thing and less than or equals dio. There are many that are not in this list, however, but in an exhaustive list would be nearly impossible because anything that can be evaluated down to a brilliant test can be an operator, and you will see more than what is in this list as we move along the course. Several of these operators are most common with number tests, but two strings can be tested with equals and not equals. Justice to numbers can be In the next video, we will work on authenticating the user.
12. Authenticating the User: in this video, we're going to work on authenticating a user. This will be a fairly short video because what we are trying to accomplish is very simple. For now, we're going to do the simplest thing that works. Our system will only allow one user at the beginning of the main method. Create a string value. To hold the account number we will use name it expected account number and give it a value of 1234 Create another string variable toe. Hold the pin number we are expecting and give it a value of non non non non. In a later video. We will create the ability for multiple users to log in. But for now, this gives us what we need and will allow us to progress at the end of the method and before console don't read key. Let's add any if statement comparing the value we have recorded for account member to the expected account number and the value we recorded for PIN number to the expected PIN number , we will group these two conditions within and double in for San. If both match, we will simply print out a statement saying authentication successful and in the Els. If the authentication fails, we will print out a statement saying Authentication failed. Let's run the program. I will enter the correct credentials and test that scenario 1st 1234 for the account number and four nines for the pin number it works. Hit any key to exit. Let's run the program again and, you know, invalid credentials just to make sure that we get the felled message from the else block All Inter 9999 as the account number and 1234 is the pin number that works as well. Great. In the next video, we will discuss properties, methods and constructors.
13. Properties, Methods, and Constructors: In this video, we will be discussing properties, methods and constructors. You may recall that I mentioned in a previous video that properties air similar to variables. They are public data members that you can restrict access to with modifiers such as public or internal. However, properties air actually special fields called successors, their implementation looks like this in this example. You see, we have a backing store created for the property balance with a variable named underscore Balance properties can have either a center together or both. The get of a property returns the backing store underscore balance. The set will assign a new value to the backing store, underscore balance The get instead of a property can have different access modifiers so you could have a public get and a private set a read write property will have both of get and set read. Only property will only have a get and very rarely you will see right only properties with only a center. If a property doesn't need tohave logic within the getter or center, you can create an autumn implemented property like this. Here, See, Sharp will create the backing store of a property for you it definitely is less CO. But it has its limitations. With an auto implemented property, you have no real control over the value of your property because you can't perform any top of logic or validation. I encourage you to use auto implemented properties when you can, but don't take risks if you need to perform some sort of logic on your backing store or control what is assigned to the backing store. The longer manual method is the only route method or co blocks that contains one or more code statements. I'll see sharp code is executed in the context of a method because every C sharp application has the main method we spoke of in a previous video. Also in a previous video, you may recall that methods are defined by their signatures, which is the access modifier, the return top, the method name and any arguments the method requires to do its work. Methods on an object can be used when visible with the dot syntax. For example, if we have a calculator class, one of the methods that you might expect to see on that calculator class will be ad if we name our instance of the calculator class calculator. We would call the ad method with calculator dot ad. We could actually spend quite a lot of time talking about methods because it is a very broad topic. But I will show two examples and then move on the constructors. In this example, the get balance method return to the class level underscore balance of arable. This is a pretty clean example. In the second example, the ad deposit meant that takes a single double argument and then as that amount value to the underscore balance that you again pretty straightforward and easy to understand. Finally, constructors constructors are actually special methods that must follow a specific set of rules. First, they cannot contain a return top. Second, the constructor must have the same name as their parent class constructors air automatically called when a classes and Stan Shih ated. But you can control which constructor is called by specifying multiple constructors with different argument tops. Objects can also have different instructors with different access modifiers. A good use case for this is that you may provide one public constructor foreign Stan Shih ation from external callers and provide a second internal constructor for in stance. She ation inside the same assembly you can also over low constructors. This means that you can have hundreds of constructors as long as each constructor does not have the same argument, top specified. In this example, we have a constructor with no argument specified. This is known as the default constructor. If you don't require any other constructors, you don't have to actually include the default constructor. If you're not doing work within the constructor itself and the fall constructor will be created for you, a compile time. However, if you need the default constructor and a second non default constructor, you have to create it. As the example shows. In this example, we also have another constructor that takes an argument named balance of the Double Top. Just a minute ago, I said you could have multiple constructors as long as each constructor does not have the same argument, Top specified. In this example, we could not create a second constructor that only accepts one argument if that argument was a double top, even if you name the double talk differently from the first, we could, however, have another constructor that took a single string parameter top or a single image of primer atop. In the next video, we will look at switch case
14. Switch Case: in this video, we're going to talk about sweet statements, switch statements or select statements, as they're also known, will decide from a list of auctions which code execute switch statements are very similar to, if else, if else statements. They provide a fairly similar structure in that you can create a list of criteria and have that criteria executed in a procedural fashion. Until one or no matches have been found. However, switch statements are more appropriate than if else, if else statements. If you are testing three or more different cases, they're just cleaner to read, easier to create and easier to maintain. Switch statements, as I mentioned already can evaluate a list of criteria and decide which code to execute. Based on that criteria, switch statements are made up of K statements, and each case must either be broken with the brake keyword, which will stop the switch execution or allow it to fall into the next case statement or when your criteria has been met. You can simply return from the switch statement. I prefer to use the brake, keyword and return after the switch statement has executed if need be. But that is just my own personal preference. You will see both if you stick to counting. Let's look at some examples in this example are switch statement is testing for a favorite fruit and when one of the cases is satisfied, assigns and text to the message variable. As you can see three different fruit cases air tested. This would be akin to, if else, if else. If I find the switch statement easier to read and understand, you should also take note of the break keyword at the end of each case statement. As I said before, this allows the switch statement to fall through to the next case. But what is really happening is that the break keywords stops the rest of the switch statement from executing because the switch statement has been satisfied. In this example, we have an extra statement at the end, the default key, where it performs the same function as an else statement in an if block. If none of the other cases air satisfied, the default statement is executed. Please note that even the do false statement has the break keyword. This is the last example, and you will notice that the cases air stacked in this one. The way the cases are stacked means that if it is Monday, Tuesday, Wednesday, Thursday or Friday, the same code will be executed while Saturday and Sunday have a different code block. In the next video, we will get back to coding and build the main menu screen.
15. Main Menu Screen: In this video, we will build out the main menu screen. The main menu screen will be a list of options available to the user, including deposit withdrawal. Recent transactions display balance and log out. We won't be implementing any of that functionality yet, but we will create bear methods for them so that we don't have to revisit the menu screen again for a while. Let's get started. The first thing we're going to do is to create a new class because our main Methodist static. That means that everything else in that class will have to be static as well. And that really isn't the best idea with the new class. However, in our main method, we just have to substantiate that one object in turn control over to it, right. Click on the A Team Project and Solution Explorer and hover over ad and then find the class menu. Adam. If class isn't in your list, you could select add and New Autumn class should be at or near the top of the dialogue. Name the class A TM controller. This class will not be available outside of this project, so I will use the internal access modifier. We're going to have to move from code over from the program about CS class to our new 18 controller class. Start with the variables expecting account number and expected pin number. After the copy into the 80 and controller class, add the prophet access modifier to both variables. I am going to also add an underscore to the beginning of both variable names, depending on who you speak to. This is sometimes considered a best practice, and others will say no. I think it is in large programs. It is reassuring to see an underscored variable name because I can be pretty confident that this is a private variable and I don't have to put a lot of thought into the variable scope . Now copy the rest of what is in the main method back in the 18 controller class. Create an internal method named display log in screen paste. The remaining code. Into that method, we will need to fix the expected account number and expected PIN number of variables by adding an underscore. Next, create a private method named display main menu. In this method, if you haven't guessed already, we will print out the menu system over application. The first line will be the number one surrounded by square brackets and then the text check account balance. The next line will be the number two surrounded by square brackets in the text deposit, then the number three surrounded by square brackets in the text withdrawal after withdrawal , the number four surrounded by square brackets and the text recent transactions. Finally, the number five surrounded by square brackets and the text log out on the screen. I want a space between the menu and the text asking the user to select an option. You can do this by using console dot right line with no tech specified, then the line. Ask them to select an option and press enter. Next, create a string variable names. Selected option equals console don't read line. We will then use a switch statement to test the selected option value. But before we go too far down that road, we need to create skeleton methods for each option. Skeleton methods are place holders for methods. The methods air there, but the full functionality of the method is not create a private method named display account balance screen. In that method, print the title at the top of the screen account balance for this example, next at console dot Reekie so that the method will Paul's and we could make sure everything is working last at a line that calls the display main menu method. This will allow us to get back to the mini. Now we will create the display deposit screen method and had the same logic title at the Top council. Don't Reekie and display Mahaney do the same for the display withdraw screen and again for the display recent transaction screen. We also need a law got method, but it is different than the rest. When they call log out, we will clear the screen with console dot clear and then call the display log in screen. Back in the display main menu screen. We also want to clear the screen when the Methodist first called when we're testing, it will be harder to spot issues when we change screens. If we don't have a clean slate to work with in the display log in screen method, when a user successfully authenticates instead of displaying the authentication successful message, we want to redirect them to the main menu screen. And in addition to the authentication felled message, if they do not successfully authenticate, we want to reload the log in screen so called display log in screen. Okay, finally, we can finish up the switch case statement we started on a few minutes ago. In case of one, we want to display the account balance screen by calling the display account balance screen method. In case of two. We want to display the deposit screen by calling the display deposit screen method. In case of three, we want to call the display withdrawal screen. In case of four. We want to display the recent transaction screen. In case of five. We want to call the lockout method all other cases or the default case. We will display an air message saying Invalid selection, Place any key to continue, then wait for the user to respond with consul dot Reekie in the program dot CS file. We need the wire up the A team controller class to take control. We need to substantiate the 18 controller class with the new keyword. Then we call the display log in screen on the controller. One last thing in the display deposit screen display, withdraw screen display, recent transaction screen and display account balances, screen methods. We need to clear those screens when they display, so we're at a console dot clear call at the beginning of each method. Let's run the application and see how the menu system works in her. 1234 for the account number and 9999 for the pin number and we should see the main menu. I will run through each auction to make sure that what we have is working account balances , fine deposit works, withdrawal works, recent transactions, works and log that works. I went out in a wrong credentials and see what we get. All then are 1 to 3 for the count number and 999 for the pin. So I don't really like the way the log in screen doesn't clear. For now. I will add a consulate, are clear at the beginning, but we'll probably need to do something else. Long term, the user won't be able to see the authentication failed message, but for now, though, we have a working main menu. In the next video, we will be working with strings
16. Working with Strings: In this video, we will learn how to work with strings. Strings are actually a collection of characters or cars. As the dot net framework goes, strings are immutable, which means they're actually read only. If you create a string with a food value and then modify the food value to bar, you're actually creating a new string object. This is important and data intensive applications or applications where you are creating very large strings. Another large topic for strings and one that we are going to explore is formatting. Strings can be formatted in several different ways. We will take a look at a couple of those formatting options, including stream, concatenation, string dot format and string interpolation. First concatenation Here is an example. As you can see, we're just joining the two strings together. This is what string concatenation is joining two strings together to create 1/3 new string , and C sharp string concatenation is done with the plus sign. Many beginners use this method extensively, and there is nothing wrong with that. When you're first starting out, it's drinking. Cat Nation is the easiest for beginners to understand. In this example, we're substituting the variables color and animal into the Senate's. As you can hopefully see, things are already starting to get complicated. We have to worry about spacing. The string is broken three times, and there are four plus signs to get everything right. It only gets more complicated from here if you use compact nation as you go to method for formatting strings. Next string dot format string dot format allows you to create a string and had placeholders for values that are typically variables or properties directly in the stream. And when the statement is executed, the placeholders are replaced with the values. Your sign. The place odors are Ordell's meaning index or numbers, starting at zero and incriminating each time you add a new substitution. 0123 and so on. In this example, we're still printing out food bar, but you can see the string dot format function. The orginal placeholders are the curly brace zero Curly Brace and Carly Brace. One curly brace Notice where the string dot format and parentheses is the way string dot format is structured. You have your entire string comma, and then each orginal argument required, separated by commas and the entire things to run about parentheses. In this example, we have the brown fox. In its again. We have the orginal zero, which is the value of color, and one which is the value for animal. The value of the color variable will be substituted where the zero orginally is, and the value of the animal variable will be substituted, where the value of one orginal is one final string dot format example. And this one noticed that the string actually has 20 Ordell's. In this case, everywhere that the zero Wardle exists, the value of the color variable will be substituted, so the end result will be the quick brown fox jumps over the lazy brown dog. Let's look a string interpolation. String interpolation is very similar to string dot format, but instead of having order Nell's, you can just enter the variable or property right in the stream instead of having a comma separated list at the end. Surrounded by the string dot format function, the dollar sign at the beginning is the key that there is a catch. There can be no white space between the dollar sign and the opening double quote, including a line, feet or regular space. It will cause a compile time air instead of curly brace. Orginal curly brace string interpolation uses curly brace variable curly brace. Here is the brown fox sentence again with string interpolation. I really like string interpolation and smaller sentences, even if I have to enter a variable more than once. If it is a long sentence or needs to be broken over several lines, there are better options. But for simple strings, the ease of use of string interpolation makes sense. In the next video, we will build the cheque account balance screen.
17. Check Balance Screen: in this video, we will build out the check balance screen. The Czech balance screen is probably the simplest screening we will build, since all that has to do is display one thing. For that reason, we're going to introduce the user account object in this video. Also right Click the A T m Project in Solution Explorer and add a new class name the new Class User account. Give the user account object and internal modifier in the user account class. Create an auto implemented internal string account number property with a get and a set. If you remember correctly auto implement. It means that you don't have to worry about creating a back in store for the property. Also, create an auto implemented internal string pin number property, also with a get and a set, and finally create an auto implemented internal double balance property. With a get in a set, we can close the user account tab. We won't be modifying anymore in this video. In the a t M controller class, we're going to remove the underscore expected account number and underscore expected pin number variables and replace them with a private user account. Underscore Active account bearable. Strictly speaking, assigning and no value to this variable is not required. It is just a habit I've gotten into. It will be no, regardless of whether you assign no value to it or not. Before we allow the user to log in. We do need some value for the underscore active account. Bearable. Create an internal constructor for the A team controller class. In this constructor, we will assign a default value to the underscore Active account object underscore. Active account equals new user account. If you then hit the opening curly brace, you can assign values to the objects properties inside the curly braces, a sign the account number property the value of 1234 the pin number property, the value of 9999 and the balance property the value of 1 61.23 You should keep the same values because if you follow along exactly with the videos, you will be able to double check your coat against mine after the closing curly brace at a semi Cohen. We now need to fix the references to underscore expected account number and underscore expected pin number in the display log in screen method. Replace underscore expected account number with underscore active account dot account number and replace underscore Expected pin number with underscore active account dot pin number in the display account balance screen method. We just need to display the balance of the underscore active account after the title. At the top of the method, I'm going to add a blank line using console dot right wine, then create another console about right line. But in this line, we're going to display the balance. I'm going to use string interpolation here, So dollar sign. Double quote. Current account balance Colon space dollar sign. This is an actual dollar son that will be displayed on the screen. Then open Curly Brace underscore active account dot balance and closing Curly Brace. Don't forget to semicolon. After displaying the balance, I'm going to add another empty line and then align, telling the user to press any key to continue. Let's run the program and see how it looks in her 1234 for the account number and 9999 for the pin number. Let's take a look at what we have accomplished. Remember that we have 161.23 for the balance it works. In the next video, we will look at how math works and see short.
18. Math: in this video, we will go over the basics of math and C sharp math, and C Sharp is close to the math we already know. It has the standard operators that you would expect, including addition with a plus sign subtraction with Amman Asan Division with a forward slash and multiplication with an asterisk. The Order of operations and See Sharp works pretty closely to what you learned in math class. In school, all operations are performed left arrive. Also, multiplication and division operations will occur before addition and subtraction operations, and those also work left to right operations in parentheses will be executed before operations outside of breath sees and are also executed. Left arrive. Let's take a look at a couple of examples. In the first example, we have a Siris of energy variables, and we're setting the value of the W variable to a plus B minus C plus D minus e all the operations in this example, or either addition or subtraction. So to calculate, you simply work left to right and perform each operation in his turn. If you look at the last line, you will see that the result is negative. Two. If you can comfortably work that out in your head or with a calculator. You are well on your way. In the next example, things were getting a bit more complicated. This example has both multiplication and division. I'm going to work this out and hopefully you can follow along on. We can reach the same conclusion first, since we have both multiplication and division, we have to work those operations first, and we do them left to rot. B Times D is eight A divided by E is one managers always round automatically if needed. A plus D is five. Since we have solved everything from that point on, five minus one is four. Hopefully, you were able to follow that logic. It might help if you write the equation down on paper and substitute the values for the variables and do the equation one step at a time, and then rewrite the equation after each operation, with the value substituted for completed operations in the next example, we also have multiplication and division operations, but we have parentheses grouping some of the operations operations inside of parentheses take precedence over multiplication and division. The variable W is sent to a plus E or seven minus B times C or six. The next operation, since we have already calculated the operations inside of the parentheses would be be time see or six divided by E, which is one then we have a plus E or seven minus the rest of the expression or one, which is six again. If you're having problems understanding, write the equation down and perform the operations one step at a time, and rewrite the equation after each operation. In this example, we also have parentheses, but we have different groupings up parentheses, which means that all operations inside the parentheses must be worked out. First D plus e is 10 a times B is too 10 minus two is eight. A divided by C is 2.66 You may be confused by the answer, which is to bankers. Math would see 2.66 rounded up to three. This is not the case in C short because 2.66 is not three. A special function called a floor is used, which always rounds down. There is also a function called a ceiling, which always rounds up. Now We need to discuss value assignment. Consider this example and see if you can determine why the results are the way they are. Paused the video if you need extra time. The reason why balance is still 100 at the end of the example is that the value of the balance property was never actually assigned to it was used as a base point in the addition operation. But the balance property was never actually assigned a value. If you look toward the end of this example, you can see that in this one we are actually assigning the balance property. The new value. This fixes the issue from the previous slide. Let's take a look. At one final example, C. Sharp has the notion of Compound Osama, which will both perform the math and set the value of the property in question. There is an addition Compound the Simon operator as well as one for subtraction, multiplication and division. You would just substitute the minus multiplication or division symbol in place of the plus symbol. The equal sign is actually telling C sharp to perform the operation and set the value. You will see the compound of Simon operators a lot, so get comfortable with them. In the next video, we will build the deposit screen
19. Deposit Screen: In this video, we will be creating the deposit screen and the display deposit screen method below the title line. I am going to insert a blank line by using console dot right line. Next, we're going to prompt the user to enter the deposit amount and press inner. Create a string variable name deposit amount and use it to get the value the user enters using console dot reid line. Now we're going to do something new. Create a double variable type named amount. We need to get the value that the user is entered and we have stored in the deposit amount variable into the double amount bearable. We can do this with double dot try pars. Drop Ours is a special function on many standard data types, like Aunt Double, decimal daytime and so on. Drop parts will take a value. In this case, the deposit amount bearable, and if it can parts the value into the double time, we'll assign it to a variable. If not, it won't. But the important part is that we're not throwing exception Noticed I am wrapping the Trop Horace function in an if statement. If the value parses correctly, we want to execute one block of code. But if it isn't, we want to execute a different block. Also taken out of the out key word. This is what actually assigns the value that was parts to the amount. Variable, as I mentioned out, is a key word, and it performs a special task. You already know that methods can return values, but only one you can use out in your own methods as well. If you need to keep track of a variable or a value that the method is using. If the value they entered is valid, we need to add the amount to the underscore active account dot balance value. If the value is not valid, we will display an error message telling them that the value that neared was invalid and to press any key to continue next at a console. Don't read T line, and then we need to reload the deposit screen by calling the display deposit screen method back in the F block. We need to tell the user that the deposit was accepted. Console don't write one. I am going to use string interpolation here again. Dollar sign. Double quote the words deposit amount dollar sign This dollar sign will actually be displayed on the screen. Open curly brace amount closing Curly brace accepted. Press any key to continue, and I guess we need a blank line between the value, the user inner and the message. So, at a console, don't rot line above the successful message below the successful message at a console. Don't Reekie, so the application pauses and they can see the message. And then I called to the display main menu method. We will now run the application and see what we get. Log on as usual and go to the account balance screen to check the balance. $161.23. Go back to the menu screen and then head over to the deposit screen. I'm going to deposit $10.67. That will make our total balance $171.90. If everything works correctly, it a key to return to the main menu. Let's check the account balance screen. Well, the amount is right, but we will have to adjust the display of the amount to the account for proper formatting. I'm keeping a list of bugs in the application, and we will go back and fix them all in a later video. For now, our deposits. Cree seems to be working just fine, and the next video, we will be looking at business rules.
20. Business Rules: in this video, we're going to be discussing business rules. Business rules have become a bit of a byword, an application development recently, it seems that many developers are confused by what constitutes a business rule. What the best way to implement them are and so on. You will also hear business logic and business rules used interchangeably. This is normal. They are the same thing. So what is the business rule? Business rules can be in many different things. Data validation and user input validation are definitely business rules, But there are limits. Validating a phone number isn't really a novel idea, so that single piece of the operation isn't a business rule of itself. But the overall work that goes into validation will definitely differ from application to application, so validation is made up of business rules. All logic specific to your application should be considered business rules for your application. Any logic that you could not easily port to another application and have it make perfect sense to do so should be considered business rules. Most applications have a flow in them. To complete a task, you must follow a specific route so that data is complete accurate and so that every step of a process is completed. This is also known as control, flow or flow constriction this round and the logic that forces users onto that WRAL should also be considered business logic. All applications have constrains constraints could be anything from administrative access to account specific operations, to controlling what a user is allowed to do and what they're not allowed to do and should all be considered business rules. Any logic that influences the behavior of users should be considered business rules. This can be data validation that stops the user from submitting a form until all require fields are completed or having only specific users be capable of accessing specific areas of the application. Finally, all business rules must evaluate down to a Boolean value there either true or false. So what does not constitute a business rule standard code that could be found in pretty much any other application, for example, code that handles text processing and data access pretty much. All applications have to do this. To some extent, Onley code that is specialized for your particular application should be considered a business rule. In the next video, we will build the withdrawal screen
21. Withdraw Screen: In this video, we will build out the withdrawal screen and the display withdraw screen method. We're going down a very similar road that we traveled in the deposit video. First, let's use console dot right line to prompt the user to enter the withdrawal amount before I forget what's at a blank line about that problem. Next, add a string variable named withdrawal amount to store the response from the user using console dot Riegel on create a double variable named amount. We need to get the value of the withdrawal amount into the amount bearable. Again, we will use double dot drop cars with the double amount variable as the out argument. Also, we will again wrapped the trap. Our statement in an if statement, however, we need to create a business rule in the F block, and you can probably guess the reason we can't allow users to withdraw more than they have . So we will have a nested if statement in the trap horse. If block that will check the validity of the transaction. If the value of the withdrawal variable is less than or equal to the underscore active account dot balance value, we can allow the transaction and deduct the amount value from the underscore active account about balanced value. We need to provide a message saying that the withdrawal is successful and the press any key to continue and then display the main menu screen. We also need a blank line between the users entry and the successful message. If the value the user enters is not valid, however, we need to reject the transaction in the else block of the nested, if at a blank line. And then another console dot right line to display the message telling the user that the amount they enter exceeds the account balance and a press. Any key to continue then consul dot Reekie to Paul's program execution and then display the main menu in the else block of the Trop horses statement. We need to create a blank line, the consul dot right line and then an air message, saying the amount they entered was invalid and to press any key to continue, we need to cause the application so the air messages visible and they call the display withdrawal screen method and I see an error and you might have already picked up on it. I have my logic reversed in the nest in if statement. If the amount is less than a recall to reprocess the withdrawal, I have greater than or equal to. I see another issue as well, after the message telling the user that the withdrawal was successful. We need to Paul's So another console dot Reekie there. Now we can run the application and take a look at the results. I will log in with the same credentials and go straight to the withdrawal screen. I am going to withdraw $100. That looks good. Now let's go check the account balance screen. We should have $61.23 and we do. Since we're down to $61.23. Let's try to withdraw another $100. We should get the air message, and we do. Let's try to withdraw on invalid a mountain. I will enter gibberish in see what happens. Yeah, exactly what should happen In the next video. We will be working with a raise and lists
22. Arrays and Lists: In this video, we will be discussing a raise and lists and touch briefly on generics, a raise or fixed size sequential collection of elements of the same time. The size must be declared when you raise created, and that size cannot be changed. From that point on, sequential means that their index based starting a zero. The first element can be accessed with zero orginal. The second element, with one orginal, the third with the two orginal and so on. A race can be creative anytime, even objects, but you should be as restrictive as possible when creating a raise. Let's take a look at a few examples. In this first example, a new array of streams named First Names has been created with the size of three. Then I'm setting the value of the first element in the array to marry the second element in the array to Tom and the third element in the array to Nancy. In the next section, I am using string interpolation to print out the values of each element to the console. As you can see, values in the array can be set by referencing the specific element in the array, using the orginal and the equal son, and the value stored in the array can be referenced in the same way without the equal son. In this next example, the initialization of the array is done completely differently. The values air said automatically, but the results are exactly the same. We can still access the elements in the array, as we did in the previous example. The only thing that changed was the way it was in Stan Shih ated. There is still a lot to learn about a raise, but we have already learned what we need to know for now. In fact, we are going to be using a raise at all. But they work so nicely with this, and we're going to be using those. So that is the next topic. Lists are part of the sea shark concept known as generics. Generics are built around top parameters. Take a look at the following example. The code on the Left is a simplified excerpt from a design pattern known as the generic repository pattern. The code on the rock is a DB context from the dot in an object relational mapper named Entity Framework. The code on the left has the ability to work with any class. From the right hand side. There are six different types to find in the right hand side, and without generics, you will be left with few options of than running a lot of duplicated code to handle each of the six. And remember that this example is very simplified. It is not uncommon for a business system to have 50 or more objects that would have to be listed on the ride, and I have worked on projects with over 300 even 500 regardless of how many out and you add , the code on the left would not get any longer or more complicated. That is the true power of generics. With this next example, you will notice that we have a variable declared of top list, and this list will only accept streams. This is denoted inside the angle brackets. Strain could be changed to literally anything a person, an address in order and so on. This list works exactly the same for every time. Let's have quite a bit of power. As you can see, we can add on to the list. More importantly, we don't have to know how many out of the list is going to contain. We can just keep adding to it without anything changing notice that we can still access the elements in the list just like we can in the array with the orginal references. The reason I introduced a raising this video, even though we won't be using them at all in the A t M application is because of raising list work. Great together, in this example, noticed that we haven't array declared, and we have signed values to the array. Then we easily cast Theoretical A list, and we're them working with a list again. It also goes the other way. In this example, we're casting a list to an array. There are many, many methods in the dot net framework that return an array of elements. It is important to know that you're not stuck with those rays or that it is a big effort to get the array into something that you can easily work with and manipulate. There are literally mountains of more information that we go over for a raise. Listen generics, but as a beginner, that should give you a solid base to build arm. In the next video, we'll be looking at loops
23. Loops: In this video, we will be discussing loops. Loops are a powerful construct and see sharp. They allow you to reiterate or go through atoms and an array list or collection and inspect and process each one. They also allow you to wait on a specific set of conditions to be what you are expecting before proceeding. There are several different types of loops, including while for each four and do of the four different tops. We will only be using the for each loop in our application, but I want to show a brief example of all four different types because any of the four could be used for our purposes. I chose the for each loop because it makes the most sense. We will start with the four leave. The four loop has three parts the counter The tests were conducting to determine when the loop should stop executing and the increments. The counter can be said to any number and doesn't have to be zero. We could just as easily have started at one. Instead, the test can be anything that can be measured. It could be the number of elements in an array or list in our case. We just want to go through the loop five times and print the value of I in each iteration of the loop. Finally, you have the increment. Each time we passed through the loot, the value of I will be incriminated by one Hi plus plus does that for us? Also notice that we are specifically assigning that increment to the I variable. The loop takes care of that for us. Next we have the do while luv the do while loop looks much different than the four loop do is actually a complete statement In this loop, the condition that we're testing is done after the do statement is executed and not before , like the four loop also notice that we have to increment the verbal we're testing on our own. The loot doesn't take care of that forest. We do, however, get the exact same results. Then there's the wild blue. The while loop is very similar to the do wild blue But the wildly performs a test and then executes the statement notice again that we have to take care of the increment on our own and that our results are again exactly the same Finally, we have the for each loop. The four h loop is different than the others, and this is the loop top we will be using in the program. There is not an increment involved in the for each loop. Instead, the for each loop is built specifically for a raise, collections or lists. In this example, we're looping over a list of imagers, but we could be looping over a list of people or an array of strings, and the same basic rules apply. Please take note that we're assigning a variable of I to the current manager on the list. We're iterating over the top, specified for the variable has to match the top contained in the array or list, and inside the four each statement, you have access to that injure, and you could work with it inside the floor. Each statement and that pretty much covers lose. They are powerful, and often the hardest part is deciding which is best for you four inches bill specifically for a raisin list. But the other three can all be used interchangeably. In the next video, we will build the recent transaction screen
24. Recent Transactions Screen: in this video, we will build the recent transaction screen. The first thing we need to do is introduce the idea of transactions into our program. Right now, we aren't tracking deposits and withdrawals, so that is where we start. Right Click the A T M Project in Solution Explorer and add a new class name. The class user transaction, like the other classes or objects we have introduced in the program, marked the class as internal. We need to add a couple of properties to the user transaction object Great. An internal string transaction. Top property with a get and a set, then an internal daytime property named Time Stamp with a get and a set last, create an internal double amount property with a get and a set. You can close this class now we need to store these transactions somewhere. The best place to do that is the user account object at an internal generic list of user transactions and named the property transactions with a get in a set. If you try to access and add or delete objects from a list that hasn't been Stan Shih ated , you will get a no reference exception. So we need to instance she ate it before we try to use it. Create an internal constructor for the user account object and inside that constructor, set the transactions property to a new generic list of user transactions. Go ahead and close the user account class. We won't need it again. We have to start collecting the transactions in the display deposit screen method in the double dot Trop horse. If statement block after we alert the user that the deposit was successful, we need to add a new transaction to our list. Underscore active account dot transactions don't add. And inside the ad method, we're going to create a new user transaction and said the properties of the class in the curly braces like we have done before. The amount property will be set to the private amount variable. The time state property will be such a daytime dot now, and the transaction top property will be set to the string deposit. I'm going to fix the spacing, and then we need to create the same functionality in the display withdrawal screen immediately after the withdrawal. Successful message. We need to create nearly duplicate code, as we had in the deposit method. The only difference will be the transaction top property. It will be withdrawal instead of deposit. At this point, we're now collecting the transactions, but we need to display them in the display recent transaction screen method below the title . Insert a blank line. We then need to look through the user transactions in the underscore. Active account, not transactions list. We will use a four each loop to do this for each user transaction transaction. In Underscore active account dot transactions on the next line created, Opening Curly Brace and hit the Enter Key. We need to write some useful content to the screen inside the loop. I will use string interpolation for this inside of the consul dot right line method Call. I will display the transaction day, then the amount and then the transaction top. Pause the video. If you need to catch up, you will have to make sure your string interpolation is correct. Below the For each loop, I will write a blank line and then another line that tells the user to press any key to continue. This should give us all the functionality that we need. Run the program and log in as usual, go to the deposit screen. Let's create a transaction for $192.19. Go back to the deposit screen and create another transaction for $57.14. Go to the withdrawal screen and created withdrawal for $22.19 and then another withdraw for $119.45. If we go to the recent transaction screen now, we should have four transactions displayed, and there they are. Good. In the next video, we will have an introduction to link.
25. Introduction to LINQ: in this video, I will give you a brief introduction to Link Link stands for language Integrated query, which probably doesn't tell you much. If you don't already know SQL, we should start with the query part. Queries are statements issued to a database that create, retrieve, update or delete data. This is also known as crowd create retrieve, but they believe these four operations are the major ones. You, as a developer, will perform when using a database, and they are the center of nearly any business application that you will create. Link allows you to do these types of operations in code against the database using an object relational mapper or O R N, such as linked to sequel or any framework or against objects in in memory list collections or a raise. Part of the beauty of Link is that there is a specifications at Microsoft uses, and the code you would write that would access Sequel server database would be the same or very, very close to the coach would use to access Oracle Database link providers can be written for other database technologies or even Web services. That would also match what would be used to access databases. The real value of link, though in my opinion, is that it makes our jobs as developers much easier. Assume the following scenario. You have a list of user objects in memory. You need to go through those accounts and extract the accounts that have a balance of $100 or more. As you can see, we would need to create a loop that would go through the list and extract the accounts with the required balance. We would then need to store those accounts in a second list when they are discovered so we could do whatever action is planned or perform the action in line. However, with Link, this becomes much easier. We simply write a query that will give us the list of accounts with a balance over $100 store those items in a second list. Bearable. The code is much cleaner, but on the surface it looks more complicated. We need to talk about Lambda expressions, Lambda expressions or what you see in the wear parentheses in this example. Since we are working with user accounts, X is a user account. If we were working with managers, it would be an integer and a strain. If we were working with strains, then we have the fat arrow. This is what makes a Lambda Lambda after the fat arrow. We have our expression that will evaluate the items in the list of accounts and pull out the items that match our query at the end. Notice that I'm casting the results to a list. This may seem odd, since we're starting with a list, but when you execute a query against the collection or list, it becomes a generic aquarium wall in this case and hike wearable of user accounts. Link is a powerful tool in a developers toolkit and will save you many, many keystrokes. Where is a single function and one that you will likely use Often there are many, many more such a single, which evaluates a Lambda expression and returns one and only one Adam. But if there are more than one, you will see an exception. You will also see an exception if there isn't one that matches the criteria first, which will evaluate a land expression and return the first out of that matches last, which will evaluate a land expression and return the last out of that matches order by which will reorder your audience based on the value of a field on the objects in the collection. Thor, which will simply sort the items sword is both simpler and more complex. Than order by sword allows you to get really creative in how you sort your items distinct, which will simply return The distinct objects in the collection list or array contains will determine if an object exists in the list. Exists will perform the same functionality of contains but evaluates Orlando expression. Instead of checking for an exact object. Take will return the number of specified objects, and skip will skip over a specified number of objects. I really hope you can see the importance of Lincoln, your programming efforts and how it may be vory invitations for you to learn that in the next video, we will build support in the application for multiple users
26. Supporting More Than One User: In this video, we will create the capability for application to support more than one user. This is going to require a lot less work than you might think at the class level, at a private generic list of user accounts and name it underscore accounts. Remove the current code in the A. T M controller constructor and said the underscore accounts variable to a new generically EST of user accounts thin. We need to add a few accounts to the list, so we have something to work with. I'm going to add the same account we have been using up to this point. With an account number of 1234 and opinion of 9999 I will set the balance $241.95 for the second account. And so I can easily recall what the account numbers are. I will give it an account number of 2345 and the same pen four nines for this one. I will set the balance to $42.91. I will have one more account and said the account number 23456 and four nines for the pen. The balance on this last account will be $124.66. That's really all the data that we need to prove that multiple users are working now above the if statement in the display log in screen method. After we read the PIN number entered by the user, declare a user account variable named account. And let's set that to underscore accounts dot single or default single or to fall acts just like single with the added benefit that no exception will be thrown. If the list doesn't contain the correct matching credentials instead, the account variable will be no in the single or default call top eggs. This means that the variable were working with in this function will be referenced with the X variable name, then the fat arrow. And we need to check that the ex thought account number matches the value we have read from the user input. So X dot account number double equals account number. Of course, the account number alone isn't enough. We also need to ensure that the pin number on X also matches what the user is entered. So we need the group that with the account number test double and for San and then x dot pin number equals pin number, the single or default all reads ex dot account number equals account number and X stop it number equals PIN member. Next, we need to remove the criteria we currently are testing for and replace it with. The account does not equal or exclamation point equal sign. No, no, as you might recall, is nothing. If the account is not know, we need to set the underscore active account variable to the account verbal we just created , so add that above the display May menu screen method. Finally, in the log out method, we need to set the value of the underscore active account variable to know before displaying the log in screen, we can now run the application inducing testing. I will log in first with a count. 1234 If I go to the cheque account balance screen, it should be $241.95 and asked next, I will log in with the 2345 account and do the same thing. The balance should be $42. 91 cents and it definitely looks like everything is working. We can now log in and out of the application, and the application supports multiple users. In the next video, we're going to be looking at the names.
27. Enums: in this video, we will be discussing the names. E Newme is short for enumeration, which is a distinct list of named constants called You Numerator List. He Nunes Avery useful when you need to restrict a property value to a known list of options , I want to show a short example. So there is no mystery about what I am describing in this example. There is a simple Renew declared named Vehicle Top. The name has three potential values. Car, SUV and truck. In the registered vehicle class, you will see there is a variable named top of vehicle, and the top is our vehicle top E No. By default, values in the evening list haven't energy or value. Starting with zero, these values increased by one huge timing. Adam is added to the list in this example. I have create a vehicle object and assigned the top of vehicle value truck. Then I'm printing out the value of both the manager and string value of the vehicle dot top a vehicle value. As you can see, we can cast the value to an an edger and get that value as well as the stream. I realize we haven't spoken about casting values from one day to talk to another, but you should be able to tell what is going on. You can also change the energy value oven enumeration and assign your own value. Consider this example. As you can see, I have assigned a value of three to the card, sixth to the SUV and nine to the truck, and you can see the proof of what I have done in the output the truck values still printed out. But the energy values and change to nine. This is a free names, but I hope you can see why you would want to use them in the next video. We'll be fixing a few bugs in your application.
28. Bug Fixes: in this video, we'll be fixing a few bugs in the application and adding one enhancement I need to come clean. When you are creating software, it is vital that you do not write new code and create new features in an application until all bugs were fixed. If you have any choice, it is a very logical decision. If you have existing bugs, you may be writing code the depends on that buggy code. That means that the bug just keeps getting harder and harder to fix and in commercial applications, more expensive to fix. A swell Over the past few videos, we have been doing just this, but it is not a habit that I would look to cultivate if I were you. The first bug we're going to look at is in the main menu. If a user doesn't select a valid option, the program will have to be exited and reloaded. Let me demo that real quick. As you can see, if I enter an invalid value like six, the screen just sits there. We need to fix that by reloading the menu. After an invalid selection is entered in the display main menu screen method inside the switch statement and the default option after the console dot reid key line. You just need to call the display main in you screen method again. If we run the application again, the behavior should be fixed. I will try six again. The menu reloads. Good. I'll try another 19 Okay, I'll get the next bug is a fairly straightforward one as well, and really isn't a bug, but more of a gap in the deposit screen. If you deposit $10 were displaying a message thing that the deposit of $10 was accepted. However, in the withdrawal screen, we just display a message saying that withdrawal was successful and the message doesn't have the dollar amount. Let's demo that real quick. I will start with the message that gets displayed when you make a deposit, see the value that is printed out in the confirmation message. Now I will go make a withdrawal. We can contrast the deposit successful message. With the withdrawal successful message and the display withdrawal screen method, you just need to alter the successful message to match what the deposits green shows. We may as well you string interpolation. I will run the application again and just make sure the functionality is working as intended. It seems to be fine. OK, this next part is for the enhancement. Right now, we're using strains to create transactions with the word deposit and withdrawal. We need to change that. To use an email, right, click the 18 and Project in Solution Explorer and add a new class name the class transaction top once it is open at an internal modifier for the class, and then remove the word class and replace it with evening in the Innu Marais Shen list. Just add deposit and withdrawal as options. You can close this fall now and open up the user transaction class. We just need to change the transaction. Top property Top transaction time saving. Close this file as well. Now back in the A T M controller class in the display withdrawal screen method. We just need to replace the text withdrawal with transaction top dot withdrawal, and we need to do the same thing and the display deposit screen method by replacing the deposit stream with transaction top, don't deposit. Those should be the only changes required for this enhancement. The text of the transaction top she still per now as deposit and withdrawal. Okay, that works pretty well. The next bug we're going to look at is a display issue. Any time we print out a dollar value to the screen, we need that value properly formatted to currency. I will run through a few tests so that you can understand the issue. I will deposit $10. What we would like to see here is a currency sambal tan 0.0 Formatted correctly. I will run through a couple more transactions to make sure I have in my mind exactly what we need. In each case, we want the currency sambal either at the front of the back dollar amount decimal sin amount, regardless of what we're displaying. Since we're displaying currency on the screen and most of the message such as display deposit screen display, withdrawal screen display, recent transaction screen display of account, balance screen, we need to use a single long method that we can call from each of these methods to get the proper format so we don't have duplicated code everywhere, and if an issue is ever found, we only have to fix it in a single place. This is key to writing good maintainable code. I will create a private method that returns a string named Get Currency for display, and it will accept one argument of top double, and I will name that argument value. I'm going to use string dot format here to do just that. Take the double value that we're trying to print out and formatted correctly. I know we briefly looked a string dot format in the Working with strings video, but it has some functionality that we did not cover. You can actually ask the format function to formatted in a specific way inside the method. Create a string variable named Formatted Value Equal string dot format and then use double quotes. And this is going to look a bit strange if you recall the string dot format function uses a place under system, so we're going to use open Carly zero Colon Capital C. Close. Curly. What this is doing is saying we want the first argument, but we wanted in the capital C format and the capital C format happens to be currency, so when it gives us the value back, it should be properly formatted Now we just have to put a comma after the closing quote and then use the value that was supplied to the method and then returned the format of value from the method. Finally, we need to go through existing code and call this method everywhere that we're putting out a currency value to the screen. The display Recent transaction screen myth. It is the first. Remove the dollar sign and wrapped the transaction dot amount value in the get currency for display method. We need to do the same thing in the display withdrawal screen method. Remove the dollar sign and wrap the amount variable in the method call and again in the display deposit screen method and finally, in the display account balance screen myth. This one is underscore. Active account about balance. Okay, I think that is everywhere. Just going to make sure you're okay. Let's run the application and take a look at the results. The account balance screen looks fine, but we need more data. I'm going to deposit $5.5 fans and then withdrawal $10 then withdrawal another $1.50. Now, if we go back to the account balance screen. It should display correctly. It does before closing. Let's give the recent transaction screen a quick look. It's fine to the final bug is in the log in screen. At this point, when a user innards invalid credentials, they don't get to see a message about the air that may demonstrate really quickly what is going on here. And, as you can see when you enter invalid credentials, their message is not visible. The solution is fairly simple. In the display, log in screen method at the top removed the console dot clear line in case of invalid credentials. We still need to clear the screen, but we will do it before the air messages displayed and they call the display log in screen method again. So right above the authentication failed message in her console dot clear, and I think that's it. Better check the log out method. It's already there. Okay, lets test. If I enter invalid credentials like 123 and 9999 we should see the authentication filled message, and there it is, great. That covers all the bug fixes that I know about. Up to this point, there are two shortcomings in the application, but those will be covered in the next section. When I give you a few assignments to work through on your own. In the next video, we'll talk about what is involved in Section three.
29. Assignments Introduction: in this video, I will give you a preview of what to expect in this final section. In this section, I will give you a Siris of Osama's to complete on your own. They somewhat the course is covered. You should be able to complete the assignments fairly easy. If you find that you cannot complete the assignment, try looking back through the course. I will indicate in each Osama where we learned what you will need to complete the work if you still have trouble completing the assignment. After looking at the indicated sections, watch the next video and I will show you how I solve the problem and then go back and try again. At this point, the application is nearly feature complete, so these Islamists are just to help you think critically about the application and the development process and the next video. We will look at our first assignment
30. Assignment #1 - Header Component: in this video, I will lay out some basic requirements for the header component. Here is the problem description. As a user, I would like to see my full name on the main menu account balance, deposit withdrawal and recent transaction screens in the form of a welcome message. And here are the technical requirements. First, the solution needs to be reusable. Second, the welcome message should look decent on the screen. Third, the message must be displayed the top of each screen where you know who the user is. Basically, this is excluding the log in screen and last, you're going to have to add a name, property to the user account, object and populate the name with some value. If you encounter any issues, view the next video to see my solution and then go back and try to rework your own. In the next video, I will review my solution to the header component
31. Assignment #1 Review: in this video, I will show my solution to creating a header component. I will start with the fourth technical requirement and add the name property to the user account object. I'm also not going to use name. I will use full name. Always try to be as descriptive as possible with property names. So you never have to doubt what they're being used for. Then I will give each of the accounts we create in the A t M controller constructor a value for the full name property. I will just use a random names Karen Smith and Tom Granger and Eva Richards. Okay, that satisfies that. Next, I will take care of the first requirement by adding a private method with no return top named display. Welcome message. This means that we only have the code that prints the welcome message in a single place on We could just call this method where we need it. Inside. I will use console dot right line to print out the message and you string interpolation to format. The message message will say Welcome to U. S. A bank and then open currently underscore. Active account dot Full main close Curly also, to satisfy the second requirement, I will use an empty console dot right line to give the header component a bit of spacing. Finally, I will take on the third requirement. I will start with a recent transaction screen and right after console dot clear. I will just call the display Welcome message, method and working our way. Ah, I will do the withdrawal screen next, also right after the consul dot clear line, and I repeat the same for the deposit screen and again for the account balance screen and finally, for the main menu method. Now let's give it a quick test. I will use the same account always use, and it looks decent enough on the main menu screen and in the account balance screen. The deposit screen is fine. I have to enter a deposit to get out of this screen. The withdrawal screen also looks fun and also have to enter withdrawal here to get out, and the recent transaction screen is also fun. In the next video, I will give it an Osama for a couple of deposit screen problems
32. Assignment #2 - Fix the Deposit Screen: in this video, I will expose to problems in the deposit screen and get some general guidelines on what to do to fix the issues. Here is the first issue. I want to demo the problem so you can see a firsthand if we lock into the 1234 account and go to the account balance screen, you can see that it has a current balance of $241.95. Now, if we go to the deposit screen and deposit negative 10 it will be accepted. Now, if we go back to the account balance screen, the account balance has had $10 deducted from it. This isn't a problem you would likely see in an actual 80 M because it doesn't have a minus key. But we do have one, so we have to account for it here. And here is the problem statement. As a user, when I tried to deposit $0.0 or less, the system should reject the transaction, and here are the requirements for the fix. First, deposits of less than one cent cannot be accepted. You may need to revisit the if else video to get a refresher. Second, when this does happen, notify the user specifically about what they did wrong. Last, the user should still be on the deposit screen after the invalid entry, so follow along with the existing error messages to provide a consistent user experience. Here's the second problem statement. As a user, I should be able to get back to the main menu screen from the deposit screen without making a deposit. The tenant requirements are currently one of the user enters the screen there, prompted the inner deposit amount and press inner change that message to also include that they can inter X to return to the main menu. And, of course, you'll have to test for that value and then return them to the main menu screen if they enter it. Second, this needs to be reusable. As you know, that withdrawal screen has the same issue is the deposit screen so we may as well have a single solution for both problems? You may have to put some thought into how you can solve this problem simply and elegantly, but it is a good test of your reasoning skills. The reusable requirement is definitely a monkey ranch, but it offers a chance for you to improve those skills again. If you cannot find a good solution to the problems, watch the next video and then revisit the problems again. In the next video, I will review my solution to this asama.
33. Assignment #2 Review: in this video, I will provide my solution to fixing the deposit screen assignment. We will start in the display deposit screen method. I will tackle the first requirement of the first problem stopping a user from depositing zero or negative amounts inside the if dot double tri par statement. I will test if the amount variable is less than or equal to zero, and I will go ahead and create the else and then deal with that first. The else will end before the second house in this statement. Next, I will satisfy the second requirement of the first problem inside the If I just created, I will use consul dot right line to print out the air. Message deposits must be greater than $0.0. Press any key to continue, then a conso dot Rechy to Paul's execution. And finally, to satisfy the third requirement of the first problem, I will add a call to display deposit screen. Let's run the application and test this part of the functionality entering the same credentials as always. If we go over to the deposit screen, I will try to deposit negative $10. Great. It was rejected. Now we need to test for the escape character to satisfy the second problem. The first thing I will do is try to satisfy the second requirement by creating a private method that returns a Boolean value named is entry escape sequence. And it will take a single string argument named entry. In this method, I will create a Boolean variable named is Match. I now need to test the value that was passed in. So I will create an if statement and I'm going to cast the entry argument to lower case. So I don't have to worry about testing upper case and lower case values. And if that lower case entry argument equals X, I will set the is match variable. True. Then after that, if I would just return the is match. Maribel, back in the display deposit screen method. I need to implement this so I will create another if statement above the double amount variable. And the s statement is going to say if is entry escape sequence and I will pass the deposit amount there. If that statement is true, we need to call the display main menu screen method. If it isn't true in the else I will just wrapped the rest of the code in this method and they're closing Curly next to satisfy the first requirement of the second problem. I just need to alter the product that is displayed to the user when they enter the screen. I would just add or press X and entered exit. Okay, We are ready to test if I enter the same credentials and then go to the deposit screen because I changed the work. Oh, we worked on earlier. I'm just going to make sure that the screen still will not process negative posits. Okay, that works fine. Now I will try eggs. Bingo. That works as well. In the next video, I will give the details on the third assignment, which is nearly identical to what we just did here for the withdrawal screen.
34. Assignment #3 - Fix the Withdraw Screen: in this video, I will give a quick overview of the requirements for fixing the withdrawal screen assignment. Here is the first problem statement as a user, when I trotted withdrawal $0.0 or less, the system should reject the transaction and the requirements are first. Withdrawals of less than one cent should be rejected. Second, when this is attempted, an error message should be displayed that it's similar to the one for the same scenario in the deposit screen. Third, the user should stay on the withdrawal screen instead of being redirected back to the main menu. Fourth, the solution needs to be reusable and last re factor that a deposit screen solution to reuse this one here is the second problem statement. As a user, I should be able to get back to the main menu screen from the withdrawal screen without making a withdrawal. And here other requirements first alter the message that is displayed on the withdrawal screen when the user first enters to also indicate that they can press X to exit the screen . Second, use the existing solution that was developed for the deposit screen. In the next video, I will give you my solution to this problem
35. Assignment #3 Review: in this video, I will review my solution to the assignment for fixing the withdrawal screen. I will start by adding a new profit method that returns a bully and named Is transaction amount valid? And that method will take a single double argument named Value. We need to test the value perimeter to see if it is less than or equal to zero. If it is, we were returned false. After the s statement, you can safely return true. Let's pause for a minute and take a look at this because I realize it may appear a bit strange. This is really the equivalent of an if else statement because we're returning the value in the if statement, The return True statement will not be hit if the value is zero or less. Hopefully you can understand what is going on here. But if not, feel free to rewrite it to be a full FL statement or similar to the is entry escape sequence method right above this. Next in the display withdrawal screen method brought below the if double dot trop horse opening block, I will add another if statement that will call the is transaction amount valid method and passing the amount value. So if this value is valid, we want to go ahead and execute the existing code. So we need to block that coat off with a curly brace after the next. If else statements conclusion, we also need to add an else statement to the new if statement. If the value isn't valid, we want to show on air message saying withdrawal amount must be greater than $0 0 cents. Press any key to continue. Then we need to Paul's with conso dot Reekie and finally reload the withdrawal. Scream by calling the display withdrawal screen method. We also need the implement the same functionality and the display deposits green method. I will remove the if amount is less than or equal to zero statement and the corresponding else statement and get everything back to normal, just like in the withdrawal screen. We do want to execute this code if the amount variable is valid, so I will create another if statement in the same place to test the amount value using the transaction amount. Valid method. This if statement will end before the next Els and we will add our own l statement. If the value of amount isn't valid, we need to display a message saying deposit amount must be greater than $0 0 sands press any key to continue. Then I will pause with console dot Reekie and finally called the display deposit screen message. This takes care of the required changes. For the first problem statement, I will start on the second problem statement by altering the existing message in the withdrawal screen to also include or press X and inner to exit. Next, I will add a new if statement above the double amount declaration, and I will call the if is entry escape sequence method and passing the withdrawal amount variable. If this is the escape sequence, we just need to display the main menu screen. And if it isn't true, we want to execute everything else in the method. So the closing curly brace goes at the end of the method. Now we contest. I will inter credentials and go to the deposit screen to make sure I didn't break anything . I will try negative 10 on that gets rejected. Good. Now I winter X and make sure it redirects us to the main menu that works as well. Next, we will test withdrawal screen. I will try negative 10. Good. Now I just want to make sure that a good withdrawal amount will actually be accepted so I would enter 10. Okay, that's working as well. Okay, now go back into the withdrawal screen, and let's make sure that the X behaves is it's supposed to, as it does great, and the next video will either be the course review or more assignments. As I see shortcomings in the course or improvements to be made, I will add more assignments if nothing has been added. The final video, the course review, is next.
36. Course Review: in this video, I will close at the course and offer some final thoughts, appreciation and advice. First, I want to thank you for sticking with the course through to the end. I also want to remind you that your opinion matters, and if you haven't done so already, I encourage you to leave a rating and feedback whether that feedback is good or bad. Of course, the more information you give, the better. It will help me improve the course and help me improve as an instructor. If you're wondering what you should do next, I have the one question you should be asking yourself. Do you think that you should stick with C sharp or find another language to learn? If you're going to stick with C sharp, I want to remind you of what options you have, but you should watch the Y C sharp video again. There. See sharp frameworks and tools available for you to target Windows in the form of WP f and you WP For the Web, you can choose between a s p dot net Web forms, and I asked Donna NBC for Mobile. You should check out Samrin and for game development Unity three D. However, if you think the C Sharp just isn't for you, for some reason, I would encourage you to look at one of three languages Java JavaScript or C plus plus of the three Java is probably the best option. It is very close to see sharp, and you can leverage nearly everything that you have learned in this course immediately. JavaScript is very flexible and the programming language of the Web, and it is truly exploding with that explosion, though, comes fragmentation. The state of JavaScript can only be described right now is a mess, but it does offer massive growth. There just aren't going to be fewer websites tomorrow or next year than there are today. And finally C plus plus C plus plus, in my opinion, is a much harder language to learn that C sharp job, but were Java script and you will have a lot more worries with C plus plus. But the possibilities with C plus plus are just about limitless. You can do nearly anything again. I want to thank you for taking the course. If you encounter any issues or need help, please reach out to me in the discussion board for this course. I will check it regularly. I wish you all the best in your programming endeavors. Goodbye.