proyecto de ingles

16
TECHNICAL UNIVERSITY OF MANABÍ FACULTY OF COMPUTER SYSTEMS ENGINEER CAREER ENGLISH PROJECT: PROGRAMMING 2 NAME: AYALA CARRILLO JUAN ALBERTO COURSE: 3 SEMESTER C DELIVERY DATE: 03/ DECEMBER/2012

Upload: alberto-ayala-carrillo

Post on 21-Jul-2015

123 views

Category:

Documents


1 download

TRANSCRIPT

TECHNICAL UNIVERSITY OF MANABÍ

FACULTY OF COMPUTER

SYSTEMS ENGINEER CAREER

ENGLISH PROJECT:

PROGRAMMING 2

NAME:

AYALA CARRILLO JUAN

ALBERTO

COURSE:

3 SEMESTER C

DELIVERY DATE:

03/ DECEMBER/2012

Technical University of Manabi

mission:

Being academics, scientists and professionals responsible, humanistic, ethical

and caring, committed to the goals of national development, which contribute to

solving the country's problems as university teaching with research, able to

generate and apply new knowledge, encouraging the promotion and

dissemination of knowledge and culture, under the Constitution of the Republic

of Ecuador.

vision:

Being university, leader and reference of higher education in Ecuador,

promoting the creation, development, transmission and dissemination of

science, technology and culture, social recognition and regional and global

projection.

FACULTY OF COMPUTER

mission:

Being a unit with high academic prestige, efficiency, transparency and quality in

education, organized in their activities, protagonists of regional and national

progress.

vision:

Being efficient and innovative professionals in the field of computer science,

with honesty, fairness and solidarity, provide answers to the needs of society by

raising their standard of living.

TOPIC

Explanation of the given class in the semester

In the field of Programming 2

Introduction to Java

1. History of JAVA

In the late eighties Sun Microsystems decided to enter the market of consumer electronics and

more specifically in home computers, including interactive television. Java, as a language born

in the beginning designed to program appliances!

In its early versions, called OAK.

2. Design goals of the creators of JAVA

Familiar language:

Java language would not be a totally new, it would resemble what we know as C + +, so it

would not be that complicated calling at skeptics programmers.

Object-oriented language:

To be considered a language object oriented must support at least the characteristics of:

- Encapsulation

- Inheritance

- Polymorphism

- Dynamic link.

STRONG LANGUAGE:

One of the most common programming languages is the ability to write programs that can block

the system. Sometimes this block can be immediate, but sometimes appear unexpectedly

reached because, for example, the application accesses the memory areas that were not being

occupied by other programs so far. A clear example is not robust language C. When writing

code in C or C + + programmer should take care of the memory management of an explicitly

requesting a block allocation and freeing pointers when no longer needed.

In Java, pointers, and pointer arithmetic functions and freeing memory allocation (malloc () and

free ()) do not exist. Instead pointers object references are used, which are symbolic identifiers.

The Java memory manager takes an accounting of references to objects. When there is no

longer a reference to an object, it becomes a candidate for garbage collection (garbage

collection).

LANGUAGE OF HIGH PERFORMANCE (multiple threads):

One characteristic of language is that it supports concurrency through threads. Sometimes you

may be interested in splitting an application independent control multiple streams, each of which

performs its functions concurrently. When different control flows share the same logical address

space, called threads.

PORTABLE LANGUAGE:

The main goal of the designers of Java, and given the growth of networks in recent years, was

to develop a language whose applications once compiled could be immediately executable on

any machine and any operating system. For example, a program developed in Java on a Sun

workstation that uses the Solaris operating system, should be able to carry a PC running

Windows NT operating system.

LANGUAGE as simple as possible:

Java designers tried to keep the basic facilities of the language to a minimum and provide a

large number of extras with class libraries.

Safe language:

He wanted to build a programming language that is secure, that is, they can not access system

resources in an uncontrolled fashion. For this reason we eliminated the possibility of

manipulating the memory by using pointers and processing capacity of numbers in memory

locations (as in C) thus avoiding any illegal access to memory. This ensures that the Java

compiler performs a systematic verification of conversions.

OBJECTIVES

GOAL

Explain the classes given in the programming field 2 during the academic year

September 2012 to February 2013

SPECIFIC OBJECTIVE

Through classes studied a brief explanation to the teacher and classmates what

is programming 2, all this will be explained in English.

THEORETICAL FRAMEWORK

How to start programming in Java?

This part of the study material is not intended to address still concepts, but

rather, you can configure any computer window xp or Windows 7 32 or 64 bit

and get it ready to start programming.

First of all: Installing "jdk-7u7-nb-7_2-windows-i586-ml" JDK "Java Development

Kit", will not only compile but run applications, available for a variety of

operating systems:

FORM 1 :: Use the Shell vine run java code for this point is important to read

and performers very well using the following commands: • javac.exe, compiler

generated files *. Apartir class source code (*. Java) . The *. Java is text, you

can create and edit in a text editor, using the syntax of Java.

• Java.exe, systems interpreter for PC / Windows, executes bytecode files (files

compiled class extension). The *. Class have executable code, bytecode,

platform independent, to be executed on a "hypothetical or virtual machine"

called Java Virtual Machine (JVM). Is this JVM neutral who plays this code

making a particular code on the CPU used. This avoids having to make a

different program for each CPU or plataforma.1

Remember watching the second image of this manual and look at the directory

where javac command is located.

1 http://mmca13.blogspot.com/2008/09/compilar-y-ejecutar-archivos-de-

java.html

Shell enters the system and see what happens when Digitas commands: java

or javac.

You will realize that the javac command is not enabled, therefore the following

steps and then try to use the command in question, the difference observed.

To educate the system accepts this command indicating that we should add

"environment variables" as indicated in the graph.

Creating our first program in java then install an editor to start coding (in this

case Notepad + +) After that, create the following program and save it in the

directory "c: \ ProgramasJava"

Note that the name of the file must be named identical to the class, using case

sensitive.

Finally run the program, first compile the program with javac and then running

the java programm.

Interface (Java)

A Java interface is a collection of abstract methods and properties. They specify

what should be done but not its implementation. Will the classes that implement

these interfaces that describe the behavior logic methods.

The main difference between interface and abstract is an interface that provides

a mechanism for encapsulating protocols methods without forcing the user to

use inheritance.

Content

1 Benefits

2 Use

2.1 Example

3 External links

Methods in java

1. Statement methods.

2. The term void.

3. Using methods.

1 Declaration of methods

In Java all logic programming (algorithms) is grouped into functions or methods.

One method is:

A block of code that has a name,

receives some parameters or arguments (optionally)

contains statements or instructions to make something (optionally) and

returns a value of any known type (optionally).

The overall syntax is:

Tipo_Valor_devuelto nombre_método (lista_argumentos) {

bloque_de_codigo;

}

and the list of arguments is expressed by stating the type and name of the

same (as in variable declarations). If more than one are separated by commas.

For example:

sumaEnteros int (int a, int b) {

int c = a + b;

return c;

}

The method is called sumaEnteros.

Also receives two integer parameters. Their names are a and b.

Returns an integer.

In the example the return clause is used to finalize the method returning the

value of the variable c.

2. The term void

The fact that a method returns a value or not is optional. If that returns a value

is declared return type. But if you do not need a value, is declared return type,

the keyword void. For example:

haceAlgo void () {

. . .

}

When not return a value, the return clause is not necessary. Note that in this

example the method also does not receive any parameters haceAlgo. However

parentheses are mandatory.

3. Using methods

Methods are invoked by name, and passing the argument list in parentheses.

The set is used like a variable type returned by the method.

For example:

int x;

x = sumaEnteros (2.3);

Note: This syntax is not complete, but it serves our purposes at this time. The

full syntax will look when talking about objects.

Although the method does not receive any arguments, the parentheses in the

call are required. For example, to call the function haceAlgo, simply put:

haceAlgo ();

Note that since the function does not return a value is not assigned to any

variable. (There is nothing to assign).

Advantage

The use of interfaces provides the following advantages:

Organize your schedule (IAJU).

Forcing certain classes use the same methods (names and parameters).

Linking unrelated classes.

Use

Java provides two keywords to work with interfaces: interface and implements.

To declare an interface is used:

modificador_acceso NombreInterfaz interface {

....

}

modificador_acceso can be public or not exist, then the default package being.

The attributes that define the interface body type attributes are constant in

classes in which it is implemented.

To implement it in a class, use the form:

modificador_acceso NombreInterfaz1 implements class ClassName [,

NombreInterfaz2]

A class can implement multiple interfaces, separating the names with commas.

Example

Defining an interface:

Nave interface {

/ / Public static final int LIFE = 100, by definition, all attributes of an

interface are public, static

/ / And the end, and for that reason is redundant but if you write does not

generate any error

LIFE int end = 100;

public void moverPosicion (int x, int y);

public void shoot ();

.....

}

Using the interface defined:

public class Ship {NaveJugador implements

public void moverPosicion (int x, int y) {

/ / Implementation of the method

}

public void fire () {

/ / Implementation of the method

}

.....

}

BIBLIOGRAPHY

http://www.arrakis.es/~abelp/ApuntesJava/ElementosBasicosAlgoritmos.htm

http://es.wikipedia.org/wiki/Interfaz_(Java)

http://www.unav.es/SI/manuales/Java/indice.html

http://codigoprogramacion.com/java/87-curso-javautilizando-metodos-en-

java.html