Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
lab10
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Анамария Морено
lab10
Commits
acf6d8ab
Commit
acf6d8ab
authored
Nov 26, 2023
by
Муратханов Тимурхан
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Добавил функции getInfo, вывел информацию в консоль
related #2
parent
f035f9cc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
Truck.ts
src/Truck.ts
+8
-0
index.ts
src/index.ts
+9
-1
No files found.
src/Truck.ts
View file @
acf6d8ab
...
@@ -21,4 +21,12 @@ export class Truck {
...
@@ -21,4 +21,12 @@ export class Truck {
changeState
(
state
:
TruckState
)
{
changeState
(
state
:
TruckState
)
{
this
.
_state
=
state
;
this
.
_state
=
state
;
};
};
getInfoAll
():
void
{
console
.
log
(
`
${
this
.
id
}
|
${
this
.
name
}
|
${
this
.
driver
.
name
}
|
${
this
.
_state
.
name
}
`
);
};
getInfoSolo
():
void
{
console
.
log
(
`Айди:
${
this
.
id
}
\nГрузовик:
${
this
.
name
}
\nВодитель:
${
this
.
driver
.
name
}
\nСостояние:
${
this
.
_state
.
name
}
`
);
};
};
};
\ No newline at end of file
src/index.ts
View file @
acf6d8ab
...
@@ -10,3 +10,11 @@ const volvo = new Truck(2, "Volvo FH12", jack);
...
@@ -10,3 +10,11 @@ const volvo = new Truck(2, "Volvo FH12", jack);
const
daf
=
new
Truck
(
3
,
"DAF XF"
,
jane
);
const
daf
=
new
Truck
(
3
,
"DAF XF"
,
jane
);
const
trucks
:
Truck
[]
=
[
renault
,
volvo
,
daf
];
const
trucks
:
Truck
[]
=
[
renault
,
volvo
,
daf
];
function
getTrucksIngo
(
truks
:
Truck
[]):
void
{
console
.
log
(
'№ | Грузовик | Водитель | Состояние'
);
for
(
let
i
=
0
;
i
<
trucks
.
length
;
i
++
)
{
trucks
[
i
].
getInfoAll
();
};
};
getTrucksIngo
(
trucks
);
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment