Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
LAB_11
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
9533054
LAB_11
Commits
e7687a83
Commit
e7687a83
authored
Dec 17, 2018
by
9533054
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testing
parent
f43f583d
Pipeline
#63
failed with stages
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
0 deletions
+69
-0
LicensePlate.java
LicensePlate.java
+69
-0
testing.docx
testing.docx
+0
-0
No files found.
LicensePlate.java
0 → 100644
View file @
e7687a83
import
java.util.ArrayList
;
/**
* Class for modeling licensePlate of cars
* @author Ghazal Sadeghian
* @version 2018.10.19
*/
public
class
LicensePlate
{
private
String
number
;
private
boolean
validity
;
private
String
ownerFistName
;
private
String
ownerFamilyName
;
private
ArrayList
<
String
>
trafficTickets
;
/**
* Create a new licensePlate with given informations
* @param number number of licensePlate
* @param ownerFistName name of the owner of the car
* @param ownerFamilyName familyName of the owner of the car
*/
public
LicensePlate
(
String
number
,
String
ownerFistName
,
String
ownerFamilyName
)
{
this
.
number
=
number
;
this
.
ownerFistName
=
ownerFistName
;
this
.
ownerFamilyName
=
ownerFamilyName
;
validity
=
true
;
trafficTickets
=
new
ArrayList
<
String
>();
}
/**
* Print traffic offences of the licensePlate
*/
public
void
printTrafficTickets
()
{
System
.
out
.
println
(
"Traffic offences of this licenseplate :"
);
for
(
String
ticket
:
trafficTickets
)
{
System
.
out
.
println
((
trafficTickets
.
indexOf
(
ticket
))+
1
+
":"
+
ticket
);
}
}
/**
* Adding new ticket to the list of traffic offences and checking validity of the licensePlate
* @param newTicket title of new ticket to be added
*/
public
void
addTicket
(
String
newTicket
)
{
trafficTickets
.
add
(
newTicket
);
if
((
trafficTickets
.
size
())
>=
5
)
validity
=
false
;
}
/**
* Removing the selected ticket from the list and checking validity of the licensePlate
* @param ticket title of selected ticket to be removed
*/
public
void
removeTicket
(
String
ticket
)
{
trafficTickets
.
remove
(
ticket
);
if
((
trafficTickets
.
size
())
<=
5
)
validity
=
true
;
}
/**
* printing whether the license is valid or not.
*/
public
void
printValidity
()
{
if
(
this
.
validity
)
System
.
out
.
println
(
"this licensePlate is valid"
);
else
System
.
out
.
println
(
"this licensePlate is not valid"
);
}
}
testing.docx
0 → 100644
View file @
e7687a83
File added
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