Pre-defined functions-Predefined functions are functions that are built into the system to create some standard operations.
String sResponse = JOptionPane.showInputDialog(null, "What is your name?","Enter your name", JOptionPane.QUESTION_MESSAGE);
System.out.println("You entered " + sResponse);
}
this is an example of a pre defined function.
Local Variables- A local variable will be created and you will only be able to see it if you are creating the programme. The public wouldn’t be able to see the local variable. Things such as the public class and the variables I use such as iPass would be the local class because you won’t be able to use it anywhere else.
Global Variables- A global variable is a variable that is accessible in many different scopes.They are only accessible after they have been declared and this makes it different to a local variable.
Parameters Passing- this will allow the variable values to be passed through the program and all the way to the procedure, which will be all of the step by step instructions.
Modularity- the modularity will allow you to split the objects into different segments and then this will allow to data to have a bit of Independence.This will make it easier for you because you wont have to change the whole application for it.
Procedures- The procedure is step by step instructions that will be put together by the programmer of what to do.
programming libraries- this will allow you to use pre built code that you can use to help you with your programming and this will help you speed up the process if you are making programs because it you wont have to keep using coding over and over , but with the libraries they are already there.
Procedural Programming Paradigm- This will just sum up the whole procedural programming language and it basically will just run a step by step routine or programing and this will help you organise the programming whilst you are going through the program and this is one of the effective programming languages.
Two examples of programming languages
- java
- javascript
If Statement
if (time < 20) {
greeting = "Good day";
}
This if statement is defining that if the time is before 20.00, the program will preview something that will will greet you “Good Day” it is also in speech marks because it is a string.
Else Statement
else {
greeting = "Good evening";
}
This is an else statement and it will work with the if statement.The way it will work is that it will find the opposite answer to the if statement.For example because the if is saying say good day before 20.00, the else statement will make it say good evening for after it.
Else If Statement
if (time < 10) {
greeting = "Good morning";
} else if (time < 20) {
greeting = "Good day";
} else {
greeting = "Good evening";
}
if the time is less than 10.00 that will create a “good morning” greeting, then if the time is after 10.00 but before 20.00 it will create a greeting of “good day” and then finally if it is after the 20.00 it will create a gretting of “Good Evening”.
For Loops
for (i = 0; i < cars.length; i++) {
text += cars[i] + "<br>";
}
In the coding above this is showing a for loop which will loop the same coding over and over, however it will be so that answers are different like this coding is starting at 1 however the “i++” is showing coding that will change plus 1 onto the i value before.
Int
public static void main(String[] args) {
int iPass = 10;
int iMerit = 15;
int iDistinction = 20;
This coding is showing you how the int variable will ok and it making the value of iPass a int and it is being declared and the code is showing the value of i pass= 10 credits.
Char
public class HumanBeing {
String sName;
char cSex;
This is showing the coding for a char and this is showing and declaring that a cSex is declared.
String
public class HumanBeing {
String sName;
char cSex;
String sOrigin;
This coding is showing that the sName is being a declared variable of a string and on a string you will need to use “hello” for the words to be shown.
Double
public static void main ( String [] args )
{
Scanner input = new Scanner( System.in); //created a variable opf type scanner so you can reach the keyboard
double priceIn; //variable declaration
double percentageIn; //variable declaration
double price;
This is displaying the numbers using a double and this coding is showing that i am declaring a variable.
Boolean
(10 > 9) // also returns true
10 > 9 // also returns true
A boolean will find out a true or false statement and the coding i have used above is showing that 10 is greater than nine and that it will return a truth result back to me.
No comments:
Post a Comment