Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
IDATT2003_gr43-Programmering 2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
August Reitan Bøgseth
IDATT2003_gr43-Programmering 2
Commits
e9d88a79
Commit
e9d88a79
authored
1 year ago
by
augustrb
Browse files
Options
Downloads
Patches
Plain Diff
Added getters, setters and add and subtract functions
parent
14c9a332
No related branches found
No related tags found
1 merge request
!1
Added getters, setters and add and subtract functions
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/edu/ntnu/stud/Vector2D.java
+33
-0
33 additions, 0 deletions
src/main/java/edu/ntnu/stud/Vector2D.java
with
33 additions
and
0 deletions
src/main/java/edu/ntnu/stud/Vector2D.java
+
33
−
0
View file @
e9d88a79
package
edu.ntnu.stud
;
package
edu.ntnu.stud
;
public
class
Vector2D
{
public
class
Vector2D
{
private
double
x0
;
private
double
x1
;
public
Vector2D
(
double
x0
,
double
x1
)
{
this
.
x0
=
x0
;
this
.
x1
=
x1
;
}
public
double
getX0
()
{
return
x0
;
}
public
double
getX1
()
{
return
x1
;
}
public
void
setX0
(
double
x0
)
{
this
.
x0
=
x0
;
}
public
void
setX1
(
double
x1
)
{
this
.
x1
=
x1
;
}
public
void
add
(
Vector2D
v
)
{
x0
+=
v
.
x0
;
x1
+=
v
.
x1
;
}
public
void
subtract
(
Vector2D
v
)
{
x0
-=
v
.
x0
;
x1
-=
v
.
x1
;
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment