Tugas Assignment 2 - muhamadgunawanccti.files.wordpress.com · Pembuktian : LV 2. 3. Level 3...

14
Assignment 2 Nama : Muhamad Gunawan Nim : 1133468609 1. Level 1 Dengan menggunakan xcode, create new project, lalu pilih iOS Application dan pilih Single View Application, beri nama applikasi ini <nama kamu>Calc. Challenge: Pertama kali menggunakan xcode untuk iOS Application, dapat navigasi awal didalam applikasi xcode. Status : Tercapai. Keterangan : Saya telah berhasil menjalankan navigasi awal didalam applikasi xcode. Pembuktian : LV 1

Transcript of Tugas Assignment 2 - muhamadgunawanccti.files.wordpress.com · Pembuktian : LV 2. 3. Level 3...

Assignment 2 Nama : Muhamad Gunawan Nim : 1133468609 1. Level 1

Dengan menggunakan xcode, create new project, lalu pilih iOS Application dan pilih Single View Application, beri nama applikasi ini <nama kamu>Calc. Challenge: Pertama kali menggunakan xcode untuk iOS Application, dapat navigasi awal didalam applikasi xcode. Status : Tercapai. Keterangan :

• Saya telah berhasil menjalankan navigasi awal didalam applikasi xcode.

Pembuktian : LV 1

2. Level 2 Pilih View Controller ipad, taruh sebuah label, beri nama label tersebut myLabel, letakan tepat ditengah view ipad dan label itu diberi nama Hello <nama kamu>. Selanjutnya di Run simulatornya, dan lihat hasilnya. Warna myLabel hijau dengan font Helvetica 25. Challenge: Berhasil membuat program iOS yang pertama menggunakan xcode, dengan singkat dan mudah. Juga penggunaan object Label Status : Tercapai. Keterangan :

• Saya telah berhasil membuat program iOS yang pertama menggunakan xcode, dengan singkat dan mudah. Juga penggunaan object Label.

Pembuktian : LV 2

3. Level 3 Buatlah sebuah tombol OK yang diberi nama myButton, diletakan diatas label, saat ditekan merubah tampilan myLabel menjadi Green Campus. Challenge: Dapat menggunakan fungsi tombol, dikombinasikan dengan text Status : Tercapai. Keterangan :

• Saya telah berhasil membuat sebuah tombol OK yang diberi nama myButton, diletakan diatas label, saat ditekan merubah tampilan myLabel menjadi Green Campus

Pembuktian :

LV 3 ViewController.m // // ViewController.m // Fakhri Calc (Lv3) // // Created by iLearning on 12/12/12. // Copyright (c) 2012 iLearning. All rights reserved. // #import "ViewController.h" @interface ViewController () @end @implementation ViewController -(IBAction)myButton:(id)sender { myLabel.text=@"Green Campus"; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end ViewController.h // // ViewController.h // Muhamad Gunawan Level 3 // // Created by iLearning on 12/3/12. // Copyright (c) 2012 iLearning. All rights reserved. //

#import <UIKit/UIKit.h> @interface ViewController : UIViewController { IBOutlet UILabel*myLabel; } -(IBAction)myButton:(id)sender; @end 4. Level 4

Buatlah sebuah text field yang diberi nama myText1, dan kalau kita tekan tombol OK, isi dari myText1 akan tampil pada myLabel. Test programnya dengan memberi nim anda pada myText1, dan ketika tombol OK ditekan, myLabel akan menampilkan nim tersebut. Challenge Dapat memadukan label button dan text Status : Tercapai. Keterangan :

• Saya telah berhasil membuat sebuah text field yang diberi nama myText1, dan kalau kita tekan tombol OK, isi dari myText1 akan tampil pada myLabel. Test programnya dengan memberi nim anda pada myText1, dan ketika tombol OK ditekan, myLabel akan menampilkan nim tersebut.

Pembuktian :

LV 4 ViewController.h // // ViewController.h // Muhamad Gunawan Level 4 // // Created by iLearning on 12/3/12. // Copyright (c) 2012 iLearning. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController { IBOutlet UILabel*myLabel; IBOutlet UITextField*myText1; } -(IBAction)myButton:(id)sender; @end ViewController.m // // ViewController.m // Fakhri Calc (Lv4) // // Created by iLearning on 12/6/12. // Copyright (c) 2012 iLearning. All rights reserved. // #import "ViewController.h" @interface ViewController () @end @implementation ViewController -(IBAction)myButton:(id)sender{ myLabel.text=myText1.text; } - (void)viewDidLoad

{ [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end 5. Level 5

Tambah satu text field yang baru, ubah tombol ok menjadi tombol +, sehingga bisa melakukan penjumlahan dari myText1 dan myText2, dan taruh hasilnya di myLabel. Challenge Dapat menggunakan 2 text field dan menaruh hasilnya di label. Memahami dan dapat melakukan konversi dari string ke integer.

Status : Tercapai. Keterangan :

• Saya telah berhasil menambah satu text field yang baru, ubah tombol ok menjadi tombol +, sehingga bisa melakukan penjumlahan dari myText1 dan myText2, dan taruh hasilnya di myLabel.

Pembuktian :

LV 5 ViewController.m // // ViewController.m // Muhamad Gunawan Level 5 // // Created by iLearning on 12/6/12. // Copyright (c) 2012 iLearning. All rights reserved. // #import "ViewController.h" @interface ViewController () @end @implementation ViewController -(IBAction)plusbutton{ float x =([myText1.text floatValue]); float c = x+([myText2.text floatValue]); myLabel.text=[NSString stringWithFormat:@"%2.f", c]; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end

ViewController.h // // ViewController.h // Muhamad Gunawan Level 5 // // Created by iLearning on 12/6/12. // Copyright (c) 2012 iLearning. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController { IBOutlet UILabel*myLabel; IBOutlet UITextField*myText1; IBOutlet UITextField*myText2; } -(IBAction)plusbutton; @end 6. Level 6

Tambahkan 3 tombol lagi yaitu -, x, /, yang dapat melakukan pengurangan, perkalian dan pembagian. Challenge Dapat menggunakan lebih dari satu tombol dengan fungsi control yang berbeda.

Status : Tercapai. Keterangan :

• Saya telah berhasil menambah 3 tombol lagi yaitu -, x, /, yang dapat melakukan pengurangan, perkalian dan pembagian.

Pembuktian :

LV 6 ViewController.m // // ViewController.m // Muhamad Gunawan Level 6 // // Created by iLearning on 12/6/12. // Copyright (c) 2012 iLearning. All rights reserved. // #import "ViewController.h"

@interface ViewController () @end @implementation ViewController -(IBAction)plusbutton{ float x =([myText1.text floatValue]); float c = x+([myText2.text floatValue]); myLabel.text=[NSString stringWithFormat:@"%2.f", c]; } -(IBAction)minusbutton{ float x =([myText1.text floatValue]); float c = x-([myText2.text floatValue]); myLabel.text=[NSString stringWithFormat:@"%2.f", c]; } -(IBAction)multiplybutton{ float x =([myText1.text floatValue]); float c = x*([myText2.text floatValue]); myLabel.text=[NSString stringWithFormat:@"%2.f", c]; } -(IBAction)dividebutton{ float x =([myText1.text floatValue]); float c = x/([myText2.text floatValue]); myLabel.text=[NSString stringWithFormat:@"%2.f", c]; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end

ViewController.h // // ViewController.h // Muhamad Gunawan Level 6 // // Created by iLearning on 12/6/12. // Copyright (c) 2012 iLearning. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController { IBOutlet UILabel*myLabel; IBOutlet UITextField*myText1; IBOutlet UITextField*myText2; } -(IBAction)plusbutton; -(IBAction)minusbutton; -(IBAction)multiplybutton; -(IBAction)dividebutton; @end