Friday, 21 November 2014

Suitability of Procedural Languages for Graphical Applications D1


package sresponse;

import javax.swing.JOptionPane;

/**
*
* @author m1305423
*/
public class SResponse {

   /**
    * @param args the command line arguments
    */
   public static void main(String[] args) {
       // TODO code application logic here
       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 graphical application using Procedural Programming that is allow you to enter you name and then it would come up with the answer and the response of what you enter into the program.It is using string so that you could enter your name into the system and when you submit it you will receive the response.Things such as procedural programming will allow you sort out the graphical information because it will be organised in a step by step structure.It will also mean that you can organise the program when you are creating the program and it will also make it easy to test the individual programs,this is also means that you should be able to create the application without no bugs and glitches.
An advantage of using procedural programming to create the graphical program as you would be able to simulate real life events much easier using procedural programming and also because you would be able to use coding over and over again which will mean that it is easy to create a program with it.This is because if you need to repeat a function more than once you will be able to whilst creating the program.The programming styles will make the system easier to create and they have been used in the creation of operating systems such as linux that was created by Python.

Modular Elements are Important M1

Modularity is an important because it help the programmer break down the coding into procedures and function, this makes it easier to read and to work out.It allows the programmers to work on different or separate modules of the coding and this will save them time. Modularity will make it easier for coding to maintain and it means that you can easily change parts of the coding and to add new parts into it and this will allow it to become easier to use functions,procedures and pr-defined functions.this allows the data to become more independent, which makes it easier to use.

Key features of procedural programming P1

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.
   



Benefits of Data P4

The programmers will have data benefits such as things like different variables such as integer,boolean,String,double,char and float.

Integer- Is a data type that will the mathematical workings out that is a whole number.Integer means maths of a whole number.This will mean that you will use in the mathematics sums that you will do in Java and this will define that something is a whole number.The benefits of using integers is that your work would stay organised as you can see clearly where you define the value.

 public static void main(String[] args) {
   
   int iPass = 10;      //This is showing that int=iPass so i pass is an integer and the value of iPass is 10
   int iMerit = 15;     //iMerit is an integer and it is worth 15
   int iDistinction = 20; //iDistinction is an integer and it is worth 20


Boolean- Boolean will create a truth or false statement in the programming language your are using.This will help with things such as a truth or false quiz or something like a question with a yes or no answer for example "Are you 21?" there would only be two outcomes to this question and they would be yes and no or true or false.The benefits of using a Boolean is that you can create a statement where you can find out a true or false answer



This is checking the value of the check cell.The if and else is allowing it to become the boolean.






String-String is the data type that will allow you to write with letters.when you use string you will have to put them in quotation marks so that they will print them.The benefit of using a string is that it will allow you to create text on a page for example like a report.


public class HumanBeing {
   String sName;  //This coding is  showing that the value of sOrigin is a string and this means the value is letters.
        char cSex;    //This line of coding is showing that cSex is equal to characters
        String sOrigin; //Value is string which means you can write with characters
        double dHeight;//The value of height is measured by numbers and this measured by double
        double dWeight;//the value is measured by double so it will measure by numbers
        String sSkinColour; //The string will find the value of the letters
     



Double-Double is like an integer because it was to do with maths but double is for the larger number which will deal with huge numbers.The benfit of using a double is that you can work out mathematical problems with large numbers quickly.


public class HumanBeing {
   String sName;  //This coding is  showing that the value of sOrigin is a string and this means the value is letters.
        char cSex;    //This line of coding is showing that cSex is equal to characters
        String sOrigin; //Value is string which means you can write with characters
        double dHeight;//The value of height is measured by numbers and this measured by double



Char-char is another data type that is just like string data type.It will hold a single character and like string you will also need to put the text in speech marks'a'.The benefit of using a char is that you can define a letter, which will be effective to the make it stand out.

public class HumanBeing {
   String sName;  //This coding is  showing that the value of sOrigin is a string and this means the value is letters.
        char cSex;    //This line of coding is showing that cSex is equal to characters




Float- Float is a data type that will move something such as text or an image, to a left or right however it will not go up or down.The benefit of using a float is that you will be able to move an image or something that you will need to and this will be able to space out the page that you are creating.



float:left; /*Float will allow whatever you are moving to the left or to the right however you will not be able to move things up or down and this will also allow other things to wrap around the object you are using the float with. They are also very useful for moving images.*/



Choosing a programming language P2

This is are the reasons why companies may choose a different programming language and this may because of reliability, staff, suitability, and cost and these are only a few reasons.

Reliability- the software programs will have to be reliable for the companies to use.This is so that they will be able to complete programs and tasks set from the company without any problems occurring on behalf of the software.The things that could help the software be reliable or things such as built in security on the software so that it wont get hacked.

Trained Staff- The trained staff may influence on the factors why companies may choose a different programming style. this is because it will cost the money to train or hire new staff and if they had trained staff that could program well in object oriented they will probably choose object oriented because it will save the company money.

Suitability-The company will have to find out which programming language would be suitable for the majority of there customers, so that they could keep a wide range of their customers and this will be set for things such as the average bandwidth of there customers and also the average power for their customers and this would let them know which program would be suited to their customers such as things such there customers power and speed of there internet.

Cost- The cost of the buying the programming language   may put of a company buying this and this could be for a smaller company, there will also be other issues such as training the staff to a different programming language could cost the companies a lot of money and also to train new staff coming into the company would make the company think again about choosing a certain programming language.

Application and limits P1

                                              Application and limits


Procedural Programming- Procedural programming will allow you to do step by programming, by this I mean you can organize your coding so that you know which one will go first,Procedural programming will also have programming languages that will mean that there will be pre-built code, that will allow you to make the coding of your code easier as there is coding that has been. Procedural programming will be using things such as variables and these may include things such as char,Boolean,String,double and integer amongst many others.These variables will make things your making the program about a certain style example if your creating a true or false program you would use the Boolean variable or if you were creating a program that you want to present numbers you may use integer or double.In procedural programming you will store the memory in separate memory locations, whereas in object orientated programming where the data would be stored all in the same place as the functions.An advantage of this programming style is that it is relatively simplistic and that you can also re use coding, without any errors occurring.A disadvantage of the programming style is that it is more importance is given to the operations rather than the data.


Event Driven- Event driven programming will allow you to create programs that allows the program to respond to many different inputs and events that could be about anything such as creating a calculator that will have many different inputs and many different events occurring.This will mean that the applications you make will be very interactive.A key feature of event driven is service oriented.This means that it will allow the users to stop and start the programs which will mean that they would be able to edit that when you start up the system, that you can set up the program as you as you turn on the system and an example of a program like this could is Bluetooth.Another great feature of this could be things such as keyboard events;An example of this could be when you use certain keys to use short cuts. Example of this is things such as ctrl+t would allow you to add tabs on a webpage quicker than just clicking the button on the webpage.The advantage of using event driven programming is that it will allow your application to be more interactive for the users and the disadvantages of using event driven programming is that you will need to use a lot of processing power for the event loops.


Object Oriented- Object oriented is a programming language that organizes the language around objects rather than actions or data and this is what makes it different event driven programming.The developing languages such as Java and C++ .The program will act as one object trying to interact with each other and they do this by sending messages to each other.another concept of OOP is that they use classes and that they use a collection of objects of the similar type and in the class many objects can be stored in a class. Encapsulation is also used in OOP because the data cannot be accessible to the public. OOP is good to use if you are going to test a system and test how the objects are going to work and how it will run.This will make more of an accurate prediction if it will work.They have different features such as classification which will allow them to define what they want each object to do and it also has a modularity feature which will allow you to make the data independent which will allow things to be separate and you would have to change the whole application by changing one thing. The advantage of OOP is that the coding can easily be re used in many different programs and this will save you a lot of time when creating programs.The disadvantage of OOP is that the programs are large and this will slow down the speed.