forked from KukuhSanddi/Task_3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSmartPhone.java
More file actions
95 lines (78 loc) · 2.65 KB
/
SmartPhone.java
File metadata and controls
95 lines (78 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package task3exercise1;
public class SmartPhone{
//
// 1. Declare your private attributes here:
// NIM : 1301154544,
// NAMA : NISA NURHARDINI,
//
//------------------- your code here-----------------------
//---------------------------------------------------------
private Application appList[10];
private int totalApp;
private int memory;
//
// 2. Declare your Setter and Getter method here:
// NIM : 1301154544,
// NAMA : NISA NURHARDINI,
//
//------------------- your code here-----------------------
//---------------------------------------------------------
//
// 3. method addApplication( appStore , appId ) here:
// NIM : 1301154544,
// NAMA : NISA NURHARDINI,
//
// get an Application object from array appList of an appStore
// with array index = appId, an Application can be installed
// if Application size is less than remaining memory size
//
//------------------- your code here-----------------------
//---------------------------------------------------------
public addApplication (Appstore appStore, int appId){
appStore apps = new appStore();
if (appSize < remain){
apps.getApp(appId);
}
}
//
// 4. method method getRemainingSize() : integer here:
// NIM : 1301154544,
// NAMA : NISA NURHARDINI,
//
// returns the remaining memory size of the smart phone
//
//------------------- your code here-----------------------
//---------------------------------------------------------
public int getRemainingSize(){
int remain;
memory = remain;
remain = remain - appSize;
return remain;
}
//
// 5. Create method toString() : String here:
// NIM : 1301154544,
// NAMA : NISA NURHARDINI,
//
// returns String that contains the smart phone total memory size,
// number of application installed, and remaining memory size
//
// example : "memory size 100MB, 5 application installed,
// remaining memory size: 60MB"
//
public setMemory (int memory){
this.memory = 2000;
}
public Application getApp(int id){
return appList[id];
}
public int getTotalApp(){
return totalApp;
}
public String toString() {
//------------------- your code here-----------------------
String a = "Memory Size "+memory+", "+totalApp+" application installed "+"remaining memory size : "+remain;
return a;
//---------------------------------------------------------
}
}