java script discussion responses
I’ve provided 2 discussions below that need to be responded separately. The discussion topic is the following ‘List and describe how elements relate to Java programming language and you would use them for when writing a Java program”.
1-)The video â€œElements of Programmingâ€, by Paul McJones says that mathematics is good for programming and like other areas of science and engineering, programming must be based on a solid mathematical foundation .This book provides a different understanding of programming than is presented elsewhere. The book shows that algorithms implemented in a real programming language, such as C++, can operate in the most general mathematical setting. For example, the fast exponentiation algorithm is defined to work with any associative operation. Algorithms are important while writing programs. Book describes many concepts like objects, types, procedures and concepts. It says programming is a iterative process organizing the concepts and algorithms into a coherent mathematical theory.
Some of the basic programming elements discussed in video are:
1.Algorithms : set of steps to a computer program to accomplish a task
2.operators: performing mathematical calculations on your data ,Ex: â€˜+â€™ can be used in programming for addition and also string concatenation.
3.objects : A object is representation of entity as a value in memory. An object can be a variable, a data structure, a function, or a method, and as such, is a value in memory referenced by an identifier.
4.Functions: a named section of a program that performs a specific task, a function is a type of procedure or routine.
5.Procedures: it is a sequence of instructions that modifies state of object . a procedure is a set of coded instructions that tell a computer how to run a program or calculation.
6.Conditional statements: conditional statements, conditional expressions and conditional constructs are features of a programming language, which perform different computations or actions depending on whether a programmer-specified boolean condition evaluates to true or false.
Many programming languages like Java, c++, c#, python uses them:
- Java uses many algorithm techniques like quick sort, bubble sort,selection,insertion,merge.
- Java is an Object-Oriented Language. As a language that has the Object-Oriented feature, Java supports many concepts like polymorphism, encapsulation, inheritance.. etc.
- Java uses many mathematical concepts to manipulate variables ,like arithmetic, assignment operators..etc
- Java supports many conditional statements like if , nested if, else if, switch..etc
2-)Process to develop various sets of instruction is known as programming. In the attached video of â€œElements of Programmingâ€, it has been concisely described by Paul McJones that the programming is a method based on the simple mathematical theories used appropriately. This allows decomposition of complex systems into components with mathematical specified behavior. It has been described in detail how programming starts with algorithms, then to make premises to make it work in a methodical way using every aspects of elements that required. In continuation to this theory, the basic elements which are being used commonly in all programming languages can be summarized as follows:
- Variables: This determines the representation of data in program. It can contain simple to complex values. This consists of data which is used by the program during execution.
- Loops: It is a sequence of instructions which carries out a group of commands till a certain condition is meet. There can also be endless loops i.e. an infinite loop if the code is lacking from a functional exit. In such case, it goes run for indefinite repetitions.
- Conditionals: This specifies the execution of the statements depending on whether the condition is satisfied or not. Every time the program is being executed it depends on the input values of the instruction and when this matches with the condition, the specified action takes place.
- Input/Output: This allows interaction of the program with the external entities. It can be inserting texts from a keyboard, reading and writing files or can be printing something out to the terminal screen.
- Subroutines and functions: This allows programmers to use a set of code into one location, which can be used over and over again. Function is required for complicated calculations and the result of that may or may not be used subsequently in an expression. The primary purpose is to receive arguments as input and return a single result. In case of subroutines, it returns several results. A subroutine that is a member of a class is often called a method.
These above mentioned elements are the basic requirements of all programming languages including JAVA, which is an object-oriented programming language.
- It can be defined as a collection of objects that communicate via invoking each other’s methods.
- Each object has its unique set of instance variables and its state is created by the values assigned to these variables.
- There are three types of loops are being used in Java, i.e. while loop, for loop and do-while loop.
- In Java, there are four types of conditional statements. Those are if statement, if-else statement, nested if statement, switch statement.
- In Java, there are two types of streams, which can be defined as sequence of data. Those are InPutStream, which used to read data from a source and OutPutStream, which is used for writing data to a destination. Java provides strong but flexible support for I/O related to files and networks.