Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,330 --> 00:00:02,430
Now we're going to set up the dealership class.
2
00:00:04,650 --> 00:00:10,050
From the requirements, we identified two types of objects, we already created the car class and we
3
00:00:10,050 --> 00:00:13,920
found that a car class needs to blueprint five fields and one action.
4
00:00:14,490 --> 00:00:18,210
The car class was the blueprint from which we can create car objects.
5
00:00:24,410 --> 00:00:28,490
Also, from the requirements, we classified another type of object dealership.
6
00:00:29,790 --> 00:00:32,610
So in this lesson, we're going to create the dealership clot's.
7
00:00:36,060 --> 00:00:41,880
The dealership class is a manager class, the manager class manages objects of another class.
8
00:00:44,640 --> 00:00:49,410
The dealership class is a manager class because it will manage objects of the car class.
9
00:00:58,760 --> 00:01:03,380
We're going to start by creating the class inside the project, create another file named dealership
10
00:01:03,620 --> 00:01:04,160
Java.
11
00:01:05,360 --> 00:01:07,700
And inside a dealership class.
12
00:01:09,700 --> 00:01:13,070
The dealership class needs to model every field and every action.
13
00:01:13,720 --> 00:01:19,300
Looking back at the requirements, the dealership is identified by the cars that it manages cars, it's
14
00:01:19,300 --> 00:01:19,840
plural.
15
00:01:19,840 --> 00:01:22,840
So the field is going to be an array of car objects.
16
00:01:26,100 --> 00:01:31,920
And making an array of objects is the same as making any other array play square brackets next to the
17
00:01:31,920 --> 00:01:34,620
class type and set the array size.
18
00:01:38,640 --> 00:01:41,640
This creates an array that can store three car objects.
19
00:01:43,610 --> 00:01:46,430
So we can define this field in the dealership class.
20
00:01:55,010 --> 00:02:01,520
And from a diagram standpoint, this is what our class looks like, the dealership also has two important
21
00:02:01,520 --> 00:02:03,500
actions, which we're going to add later.
22
00:02:08,889 --> 00:02:11,120
We're going to create an object of the dealership class.
23
00:02:11,140 --> 00:02:12,820
We're going to call the variable dealership.
24
00:02:16,230 --> 00:02:19,050
And we'll set it equal to a new dealership object.
25
00:02:21,720 --> 00:02:24,980
And that's all you just created an object of the dealership class.
26
00:02:25,230 --> 00:02:29,370
The object has one field cars, which by default is going to be No.
27
00:02:30,810 --> 00:02:35,160
We need to update the cars field as soon as we create the object, and that's what a constructor is
28
00:02:35,160 --> 00:02:35,460
for.
29
00:02:36,060 --> 00:02:40,980
So we need to start by applying the big three steps, constructor getters and setters.
30
00:02:43,280 --> 00:02:46,130
In this lesson, you made an object of the dealership class.
31
00:02:47,230 --> 00:02:52,510
So far, the dealership class blueprint's one field, and as you know, whenever a class has fields,
32
00:02:52,510 --> 00:02:56,710
you need to apply the big three steps at a constructor getters and setters.
3286
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.