Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

info023_01b_sem2

No description
by

Erick Araya

on 28 February 2014

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of info023_01b_sem2

Java Data Types
INFO 023
Sem. II - 2013
Para comenzar...
Primitve Data Types
Numeric Integers
(according to length in bits)
false
true
Example
int x ;
Calculation of an arc?
Let's go to the Java editor (for example, DrJava)
Write a program in Java to calculate the length of the arc of a circumference of radio 50 for an angle of 30º
Lenguaje Compilado
How to do an interactive program?
Shall we use IO class?
Very complex!!
Better use the Scanner class
Scanner class
We need an statement "import" ( one of the two showed next)
Implement the "jalisco". Let's observe an example!
Numeric decimal
(according to length in bits)
Booleans
Variables
int z = 100 ;
First, we ALWAYS need to write....
Did you write the code? Let's compare..
import java.util.Scanner;
import java.util.*;
We need to create an instance (copy) of the Scanner class: an OBJECT
Scanner keyboard = new Scanner(System.in);
"keyboard", example of an instance, inherits all the Scanner class's methods
int nextInt()
double nextDouble()
boolean nextBoolean()
byte nextByte()
float nextFloat() 
short nextShort()  
long nextLong()
String next()
String nextLine()
Exercise
Solution
EXERCISE
Write a program to read 3 integers, store tthem in different variables and print a list with each number followed by 0 if the number is even, or followed by 1 if the number is odd.
Print one number per line, and DO NOT USE decision statements (i.e., if statements)
The dialog between the program and the user should be the following:

Enter the first number: 10

Enter the second number: 20

Enter the third number: 15

10 0
20 0
15 1
PROGRAMMING 2013
LECTURE 01-B
What do we use to request the user to enter his/her age?
Two Options:
Input-Output (IO) Class
Scanner Class
A Java program NEVER uses the original class (auto-protection)
Using "keyboard", it is possible to read data from the input... but we need to use an appropriate method (in this case, the age is an INTEGER data type)
The program:
Currence Converter
A citizen of the European Community need to convert Euros into Chilean pesos. Write a program to perform the conversion, assuming that, today, the official conversion is: 1 Euro = 603,900
Full transcript