TASK 1 INTRODUCTION This task is for displaying

  • Slides: 23
Download presentation
TASK 1 INTRODUCTION This task is for displaying 2 different programs and how each

TASK 1 INTRODUCTION This task is for displaying 2 different programs and how each program works, then describing what makes them work with their different functions, event, method, using tools, datatypes.

First Program Description: The first program is for compound interest. It is used for

First Program Description: The first program is for compound interest. It is used for retrieving what is in the principal text box, then grabbing what is in the rate text box, how many times a year, the number of years and calculate all this information to display the final result/total.

Second Program Description: This is a simple login system which will have a user

Second Program Description: This is a simple login system which will have a user name and a password in an array, to hold the usernames and passwords, if the correct username and password, is entered into the text box you will get the message “you can log in” if the username or password is incorrect it will display the message” you can not login.

First Program

First Program

Command: Example of Use: What does the code do? Which Program is it found

Command: Example of Use: What does the code do? Which Program is it found in? txtbox. Text rate = Convert. To. Decima l(txt. Rate. Text)/ 100; ; It takes what is inside “txt. Rate. Text” converts it to a decimal and puts it inside the variable rate. Compound Interest Calculator.

Command: Example of Use: What does the code do? Convert. To. Decimal (sometimes called

Command: Example of Use: What does the code do? Convert. To. Decimal (sometimes called type conversion) princpal = This converts something Convert. To. Decimal( from inside a variable, txt. Principal. Text); textbox or another type of item to a decimal. Which Program is it found in? Compound Interest Calculator.

Command: Example of Use: What does the code do? Which Program is it found

Command: Example of Use: What does the code do? Which Program is it found in? To. String lbl. Result. Text = lbl. Result. Text + ("rate " + rate + " time " + time + " result " + result. To. String("#. # #") + "nr"); Take text from a datatype/variable and converts the data inside the variable to text so it can be read as a string/characters. Compound Interest Calculator.

Command: Example of Use: What does the code do? Which Program is it found

Command: Example of Use: What does the code do? Which Program is it found in? = (this is known as an assign operator) decimal rate = 0; This means that whatever is in Compound Interest front of this symbol “=/Equals” Calculator. means what comes after the symbol.

Command: Example of Use: What does the code do? Which Program is it found

Command: Example of Use: What does the code do? Which Program is it found in? If statements (also known as a decision statement) int num =(int) This means if what is inside Compound Interest cmb. Compound. Selec the integer “num” equals to 1 Calculator. ted. Index; then do nothing, however “else” if “num” equals to 1 if (num == 0) { then set the decimal } else if (num compound to 12 and so on for == 1) other digits. { compound = 12; } else if (num == 2) { compound = 2; } else if (num == 3) {

Command: Example of Use: What does the code do? Which Program is it found

Command: Example of Use: What does the code do? Which Program is it found in? Variables decimal princpal = 0; decimal rate = 0; decimal compound = 1; int time = 0; Variables are data types, pieces of information held inside names. There are different variables for different functions and properties. Compound Interest Calculator.

Command: Example of Use: What does the code do? Which Program is it found

Command: Example of Use: What does the code do? Which Program is it found in? Methods public void store. Data() { princpal = Convert. To. Decimal(txt Principal. Text); rate = Convert. To. Decimal(txt Rate. Text)/100; ; time = Convert. To. Int 16(txt. Ti me. Text); The “store. Data()” method takes what is inside “txt. Principal. Text” converts it to a decimal and places it inside princpal, then does the same for rate and then for time it takes the information from “txt. Text. Time” converts it to a int 16 and places it inside the variable time. Compound Interest Calculator. } private void btn. Calc_Click(object sender, Event. Args e) { store. Data (); calc. Inter est(); } The method “btn. Calc_Click” triggers the methods “store. Data()” and “calc. Interest()”

Command: Example of Use: What does the code do? Which Program is it found

Command: Example of Use: What does the code do? Which Program is it found in? . Equals (username. Equals(n ame. Array[count, 0]) && password. Equals(na me. Array[count, 1])) This takes the username variable and sets it to be equal to the first row in the array/”count, 0”. Login Program. Then does the same for password but in the second row, count, 1.

Second Program

Second Program

Command: Example of Use: What does the code do? Which Program is it found

Command: Example of Use: What does the code do? Which Program is it found in? . Equals (username. Equals(n ame. Array[count, 0]) && password. Equals(na me. Array[count, 1])) This takes the username variables and sets it to be equal to the first row in the array/”count, 0”. Login Program. Then does the same for password but in the second row.

Command: IDE Example of Use: What does the tool do? Which Program is it

Command: IDE Example of Use: What does the tool do? Which Program is it found in? This tool helps create the code and the GUI for the application. Visual Studio

Command: Toolbox Example of Use: What does the code do? Which Program is it

Command: Toolbox Example of Use: What does the code do? Which Program is it found in? This creates text boxes, combo boxes, labels, checkboxes etc. Visual Studio

Command: Properties box Example of Use: What does the code do? Which Program is

Command: Properties box Example of Use: What does the code do? Which Program is it found in? It allows you to edit text box files, combo files, etc. Property files, name, colours, font type, font size, background image. Visual Studio

Command: Example of Use: What does the code do? Run Button private void btn.

Command: Example of Use: What does the code do? Run Button private void btn. Enter_Click(obje ct sender, Event. Args e) { username = txt. Username. Text; password = txt. Password. Text; Clicking the button takes Login program. what is entered into “txt. Username. Text” and assigns it into the username variable, then does the same with “txt. Password. Text” and assigns it to the password variable. Then triggers the “chk. Logins()” method. chk. Logins(); } Which Program is it found in?

Command: Example of Use: What does the code do? While Loop (used to repeat

Command: Example of Use: What does the code do? While Loop (used to repeat code until a certain condition is met) while (count < This while loop is checking if Login program. name. Array. Get. Uppe the variable count is less r. Bound(0)) than the number of rows in the array, then the code is telling the computer to count the number of rows in the array. Then it checks if the variable username equals to/ is the same as the data in the selected row/count in the array and it does the same/equivalent for the password, if it does then display the text “txt. Login. Text = "You can login"; Which Program is it found in?

Command: Example of Use: What does the code do? Get. Upper. Bounds (count <

Command: Example of Use: What does the code do? Get. Upper. Bounds (count < This is used to check how name. Array. Get. Uppe many rows are in the array. r. Bound(0)) Which Program is it found in? Login program.

Command: Example of Use: What does the code do? Which Program is it found

Command: Example of Use: What does the code do? Which Program is it found in? Logical Operator (&&) if (username. Equals(n ame. Array[count, 0]) && password. Equals(na me. Array[count, 1])) This means just means if Login program. the username variable and/&& password variable are in these specific rows in the array then do something.

Command: Example of Use: What does the code do? Which Program is it found

Command: Example of Use: What does the code do? Which Program is it found in? Break if Stop the count loop running. Login program. (username. Equals(n ame. Array[count, 0]) && password. Equals(na me. Array[count, 1])) { txt. Login. Text = "You can login"; break; }

Command: Example of Use: ++ (used to add one 1 count++; to a value)

Command: Example of Use: ++ (used to add one 1 count++; to a value) What does the code do? Which Program is it found in? Adds 1 to the count. Login program.