judul modul sequential, data type dan operator · judul modul sequential, data type dan operator...

4
1/4 Praktikum Alpro Modul 1 Judul Modul Sequential, data type dan operator Ganjil 2014/2015 TIU Mahasiswa memahami Konsep Flowchart, type data, dan operator TIK 1. Mahasiswa mampu merancang dan membuat flowchart 2. Mahasiswa mampu merubah flowchart ke program 3. Mahasiswa mengenal berbagai type data di java Materi A variable is a placeholder. You can stick a number like 50.22 into a variable. After you place a number in the variable, you can change your mind and put a dif- ferent number into the variable. (That’s what varies in a variable.) Of course, when you put a new number in a variable, the old number is no longer there. The thing stored in a variable is called a value. A variable’s value can change during the run of a program. The value that’s stored in a variable isn’t necessarily a number. (You can, for instance, create a variable that always stores a letter.) The kind of value that’s stored in a variable is a variable’s type. amountInAccount is a variable name, and all the memory storage associated with amountInAccount (including the type that amountInAccount has and whatever value amountInAccount currently represents) is the variable itself Every variable name is an identifier — a name that you can make up in your own code. In an assignment statement, you assign a value to something. In many cases, this something is a variable. I recommend getting into the habit of reading assignment statements from right to left. For instance, the first line in Listing 4-1 says,

Upload: phunghuong

Post on 09-Jun-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

1/4 Praktikum Alpro – Modul 1

Judul Modul Sequential, data type dan operator Ganjil 2014/2015

TIU Mahasiswa memahami Konsep Flowchart, type data, dan operator TIK 1. Mahasiswa mampu merancang dan membuat flowchart

2. Mahasiswa mampu merubah flowchart ke program 3. Mahasiswa mengenal berbagai type data di java

Materi A variable is a placeholder. You can stick a number like 50.22 into a variable. After you place a number in the variable, you can change your mind and put a dif- ferent number into the variable. (That’s what varies in a variable.) Of course, when you put a new number in a variable, the old number is no longer there.

The thing stored in a variable is called a value. A variable’s value can change during the run of a program. The value that’s stored in a variable isn’t necessarily a number. (You can, for instance, create a variable that always stores a letter.) The kind of value that’s stored in a variable is a variable’s type. amountInAccount is a variable name, and all the memory storage associated with amountInAccount (including the type that amountInAccount has and whatever value amountInAccount currently represents) is the variable itself Every variable name is an identifier — a name that you can make up in your own code. In an assignment statement, you assign a value to something. In many cases, this something is a variable. I recommend getting into the habit of reading assignment statements from right to left. For instance, the first line in Listing 4-1 says,

2/4 Praktikum Alpro – Modul 1

This line is called a variable declaration. Putting this line in your program is like saying, “I’m declaring my intention to have a variable named amountIn Account in my program.” This line reserves the name amountInAccount for your use in the program. In this variable declaration, the word double is a Java keyword. This word double tells the computer what kinds of values you intend to store in amountInAccount. In particular, the word double stands for numbers between –1.8 × 10308 and 1.8 × 10308 . (These are enormous numbers with 308 zeros before the decimal point. Only the world’s richest people write checks with 308 zeros in them. The second of these numbers is one-point-eight gazazzo-zillion- kaskillion. The number 1.8 × 10308 , a constant defined by the International Bureau of Weights and Measures, is the number of eccentric computer programmers between Sunnyvale, California, and the M31 Andromeda Galaxy.) The Atoms: Java’s Primitive Types

3/4 Praktikum Alpro – Modul 1

The char type

The boolean type

4/4 Praktikum Alpro – Modul 1

Tugas Pendahuluan

1. Buatlah flowchart/pseudocode untuk menghitung luas lingkaran dan keliling lingkaran menggunakan persamaan

2* rLCircle

rKCircle **2 2. Buatlah flowchart/pseudocode untuk menghitung luas dan keliling persegi panjang

menggunakan persamaan

LPLPersegi *

LPK Persegi *2*2

Tugas Praktikum

Buat program dalam java untuk soal no 1 atau no 2 (di tentukan oleh asisten, setiap kelompok berbeda)

Waktu Praktikum

2 x 50 menit

Referensi 1. Java for Dummies, Barry Burd, Wiley Publishing, Inc, 2007 2. Sam Teach Yourselft, Java 6 in 21 Days, Rogers Cadenhead & Laura Lemay,

SAMS, 2007