Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Activity One Assessment
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
aurian.foulner
Activity One Assessment
Commits
52facc68
Commit
52facc68
authored
May 11, 2022
by
aurian.foulner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
origin
parent
de95c2bd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
10 deletions
+20
-10
Complex.class
bin/Complex.class
+0
-0
Complex.class
src/Complex.class
+0
-0
Complex.java
src/Complex.java
+20
-10
No files found.
bin/Complex.class
View file @
52facc68
No preview for this file type
src/Complex.class
0 → 100644
View file @
52facc68
File added
src/Complex.java
View file @
52facc68
...
...
@@ -29,25 +29,35 @@ public class Complex {
public
double
magnitude
()
{
return
1.0
;
return
Math
.
sqrt
(
real
*
real
+
imag
*
imag
)
;
}
public
double
argument
()
{
return
1.0
;
return
Math
.
atan2
(
imag
,
real
)
;
}
public
String
toString
()
{
return
""
;
}
String
answer
=
""
;
if
(
real
==
0
){
answer
=
"j"
+
imag
;}
else
if
(
imag
==
0
){
answer
=
Double
.
toString
(
real
);}
else
if
(
imag
<
0
){
answer
=
Double
.
toString
(
real
)+
" - "
+
"j"
+
Math
.
abs
(
imag
);}
else
{
answer
=
Double
.
toString
(
real
)
+
" + "
+
"j"
+
imag
;}
return
answer
;
};
public
Complex
add
(
Complex
complexNum
)
{
Complex
answer
=
new
Complex
(
0.0
,
0.0
);
answer
.
imag
=
complexNum
.
imag
()
+
this
.
imag
;
answer
.
real
=
complexNum
.
real
()
+
this
.
real
;
return
answer
;
}
}
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