Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
formativeSubmission
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
quinn.haigh
formativeSubmission
Commits
e8318647
Commit
e8318647
authored
Mar 09, 2020
by
quinn.haigh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
final
parent
3608fa81
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
Complex.java
formativeSubmission/src/Complex.java
+9
-4
No files found.
formativeSubmission/src/Complex.java
View file @
e8318647
public
class
Complex
{
// set values for numbers
double
real
;
double
imag
;
...
...
@@ -12,6 +12,7 @@ public class Complex
imag
=
0
;
}
//initiate numbers
public
Complex
(
double
_real
,
double
_imag
)
{
...
...
@@ -20,6 +21,7 @@ public class Complex
}
//return values
public
double
real
()
{
...
...
@@ -32,7 +34,9 @@ public class Complex
return
imag
;
}
//method to work out magnitude of the numbers
public
double
magnitude
()
{
double
answerA
=
Math
.
pow
(
real
,
2
);
...
...
@@ -46,7 +50,7 @@ public class Complex
}
//method for returning the arguement
public
double
argument
()
{
...
...
@@ -55,7 +59,7 @@ public class Complex
return
arg
;
}
//method to add complex numbers together
public
Complex
add
(
Complex
b
)
{
Complex
a
=
this
;
...
...
@@ -67,6 +71,7 @@ public class Complex
}
//printing complex numbers to a string output
public
String
toString
()
{
if
(
real
==
0.0
)
...
...
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