-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMethodandclass.java
More file actions
368 lines (284 loc) · 8.84 KB
/
Copy pathMethodandclass.java
File metadata and controls
368 lines (284 loc) · 8.84 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
package Introduction;
public class Methodandclass {
//Class is a blueprint or template of an object
//Object is anything present e
/* class account, car , human, phone, computer, food, house, school, employee, student,
* A class is defined by its xtics, variables or data types
* Method in a class means actions or functions
*
* class Human(){
*
* String name;
* String colour
* String race
* String leg
* String origin
* String eyes
*
* void move()
* void run()
* void smile()
* void desires()
*
* }
*
* Class Student()
*
* {
* String name
* String course
* int age
* String address
* int phone number
*
* void Takeexams()
* void learn()
* void interact()
*
* }
*
*
* Class Car(){
* String name
* String colour
* String model
* int yearmodel
*
*
*
* void accelerate()
* void speed()
* void slowdown()
* void reverse()
*
* }
* Class Food(){
* String name2
* String type2
* String colour2
* int bestbeforedate
* int expirydate
*
*
* void nutrition
* void energy
* void growth
* void allergy
*
* }
*
* Class Account(){
* String name3;
* String type3;
* String address2;
* int accountnumber;
* double accountbalance;
*
* void transfer()
* void open()
* void close()
* void deactivate()
* void activate()
*
* }
* Class Phone(){
* String name
* String model
* int phonenumber
*
* void playingvideo
* void receivingcalls
* void chargingbattery
* void callingout
*
* }
* Class House(){
* String name
* String address3
* int number
* String type
*
* void sale
* void rent
* void lease
* void auction
*
* }Class School(){
* String name;
* String address;
* int numberofstudents;
* int numberofteachers;
*
*
* void teaching()
* void learning()
* void takingexams()
* void playing
*
* }Class Employee(){
* String name;
* String address;
* int phonenumber;
* String NInumber;
*
* void claimincentitives
* void claimexpenses
* void claimpension
* void vacation
*
*
*
*
*
* }
*
*
*
*
*
*
*
*
*
*
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
// To use this class Student, call and instantiate a new class student()
Student student1 = new Student();
Student student2 = new Student();
student1.name = " Stephen";
System.out.println("This student name is==========" + student1.name );
student1.address = "2 clampton,London";
System.out.println("This student adress is=========== " + student1.address );
student1.age = 30;
System.out.println("This student age is======= " + student1.age);
student1.course = "Pharmacy";
System.out.println("This student course is======= " + student1.course);
student1.phonenumber = 07457625657;
System.out.println("This student phonenumber is========== " + student1.phonenumber);
student1.interract();
student1.learn();
student1.takeexams();
Car Car1 = new Car();
Car Car2 = new Car();
Car Car3 = new Car();
Car Car4 = new Car();
Car1.name = "Toyota";
System.out.println("This is Car name======== " + Car1.name);
Car1.model = "corrolla";
System.out.println("This is Car model============= " + Car1.model);
Car1.colour = "Blue";
System.out.println("This is Car colour=========== " + Car1.colour);
Car1.yearmodel = 2015;
System.out.println("This is Car yearmodel======== " + Car1.yearmodel);
Car2.name = "Honda";
System.out.println("This is Car name======= " + Car2.name);
Car2.model = "prelude";
System.out.println("This is Car model======= " + Car2.model);
Car2.colour = "Black";
System.out.println("This is Car colour======= " + Car2.colour);
Car2.yearmodel = 2017;
System.out.println("This is Car yearmodel======= " + Car2.yearmodel);
Car1.accelerate();
Car1.brake();
Car1.slowdown();
Car1.reverse();
Car2.accelerate();
Car2.brake();
Car2.slowdown();
Car2.reverse();
Food Food1 = new Food();
Food Food2 = new Food();
Food Food3 = new Food();
Food1.name2 = "Tomato";
System.out.println("This is Food name======= " + Food1.name2);
Food1.type2 = "vegetables";
System.out.println("This is Food type=======" + Food1.type2);
Food1.colour2 = "red";
System.out.println("This is Food colour====== " + Food1.colour2);
Food1.bestbeforedate= 01/01/2015;
System.out.println("This is best before date=====" + Food1.bestbeforedate);
Food1.expirydate = 01/01/2018;
System.out.println("This is best before date====== " + Food1.expirydate);
Food1.allergy();
Food1.energy();
Food1.nutrition();
Food1.growth();
Account Account1 = new Account();
Account Account2 = new Account();
Account Account3 = new Account();
Account Account4 = new Account();
Account1.name3 = "Victor" + "" + "" + "" + "Adesina";
System.out.println("This is the account name====== " + Account1.name3 );
Account1.type3 = "Current" + "" + "Account";
System.out.println("This is the account type======= " + Account1.type3);
Account1.address2 = "22 Water Lane, London";
System.out.println("This is the account address=====" + Account1.address2);
Account1.accountnumber = 121398234;
System.out.println("This is the account number======= " + Account1.accountnumber);
Account1.balance = 10000;
System.out.println("This is the account balance=======" + Account1.balance);
Account1.transfer();
Account1.open();
Account1.close();
Account1.deactivate();
Account1.activate();
Phone Phone1 = new Phone();
Phone Phone2 = new Phone();
Phone1.name3 = "Samsung galaxy";
System.out.println("This is the phone name==== " + Phone1.name3 );
Phone1.model2 = "S8";
System.out.println("This is the phone model==== " + Phone1.model2 );
Phone1.colour3 = "White";
System.out.println("This is the phone colour===== " +Phone1.colour3);
Phone1.phonenumber2 = 07544123456;
System.out.println("This is the phone number====== " + Phone1.phonenumber2);
Phone1.chargingbattery();
Phone1.playingvideo();
Phone1.callingout();
Phone1.receivingcalls();
House House1 = new House();
House House2 = new House();
House1.name4 = "Vintage House";
System.out.println("This is the name of House===== " + House1.name4);
House1.number3 = 20;
System.out.println("This is the number of House =====" + House1.number3);
House1.address3 = "Vintage close";
System.out.println("This is the address of House==== " + House1.address3);
House1.type3 = "Terraced House";
System.out.println("This is the type of House==== " + House1.type3);
House1.rent();
House1.sale();
House1.lease();
House1.auction();
School School1 = new School();
School School2 = new School();
School1.name = "Browney Academy";
System.out.println("This is the name of school===== " + School1.name);
School1.address = "30 Browney close";
System.out.println("This is the address of school =====" + School1.address);
School1.numberofstudents = 2500;
System.out.println("This is the number of students==== " + School1.numberofstudents);
School1.numberofteachers = 50;
System.out.println("This is the number of teachers==== " + School1.numberofteachers);
School1.learning();
School1.takingexams();
School1.playing();
School1.teaching();
Employee Employee1 = new Employee();
Employee Employee2 = new Employee();
Employee1.name = "Nelson Smith";
System.out.println("This is the name of the employee========" + Employee1.name);
Employee1.address = "120 Shields road";
System.out.println("This is the address of employee========" + Employee1.address);
Employee1.NInumber = "AB245312B";
System.out.println("This is the employee NI number======" + Employee1.NInumber);
Employee1.phonenumber = 07456433215;
System.out.println("This is the employee phone number======" + Employee1.phonenumber);
Employee1.claimexpenses();
Employee1.claimpension();
Employee1.claimincentives();
Employee1.vacation();
}
}