Welcome to this section of the course. During the next couple of lectures, we are going to design and build an interactive scientific calculator that will have a user menu and 11 math operations that the user can choose from. Also, after performing each operation, the user will be asked if he or she would like to either return to the main menu and perform a new operation, or quit the program. Instead of telling you about this application, let me better show it to you. I have already built this application. And in order to run it, we will use the windows command line.
So let me open up the CMD. And let's see what this app looks and feels like. So let me run it by Thawne D calculator dot p y. Okay, so this is it. First, we're telling the user to choose the desired math operation to perform and then using a different number or identifier for Each operation, the user has 11 options to choose from addition, subtraction, multiplication, division, modulo, raising to a power square root, logarithm, sine, cosine and tangent. After showing the user all the available options, we then ask him or her to enter an option at the prompt.
Here, the user can type in any option from zero to 10, inclusively, and then hitting the Enter key is required to continue. However, if for some reason the user types in another number, or in fact, anything else besides zero or one or two, and so on, then we should handle this scenario as well in an elegant way. So let's say the user types in 11 by mistake, let's try this enter. As you can see, in this case, he gets an error message in return invalid option, then he is redirected back to the main menu. Great. Now let's say that the user wants to perform division operation, all he has to do is type in the corresponding number, in this case three, and hit enter.
Okay. Next, we're asking the user for the first value, meaning the numerator, or in plain English, the number we want to divide, let's say five. After hitting Enter, we are asking the user to input the denominator, or the number to divide five by, let's say two. Immediately after hitting Enter, once again, the result is printed out to the screen 2.5, which is correct. Finally, we are asking the user if he would like to go back to the main menu and perform another math operation, or simply quit the program. If you typed in Y for yes, then he agrees to return to the main menu.
Otherwise, by typing n, the execution of the program ends. For now, let's type in n and go to the next lecture, where you're going to learn how to build the user menu of this program. See you soon.