Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
JavaAssess1
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
antony.adewunmi-jones
JavaAssess1
Commits
88767af1
Commit
88767af1
authored
May 09, 2022
by
antony.adewunmi-jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first commit
parent
de95c2bd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
4 deletions
+39
-4
App.class
bin/App.class
+0
-0
AppTest.class
bin/AppTest.class
+0
-0
Complex.class
bin/Complex.class
+0
-0
Complex.java
src/Complex.java
+39
-4
No files found.
bin/App.class
View file @
88767af1
No preview for this file type
bin/AppTest.class
View file @
88767af1
No preview for this file type
bin/Complex.class
View file @
88767af1
No preview for this file type
src/Complex.java
View file @
88767af1
...
...
@@ -2,6 +2,7 @@ public class Complex {
public
double
real
;
public
double
imag
;
public
double
r
,
i
;
public
Complex
()
{
...
...
@@ -26,20 +27,54 @@ public class Complex {
{
return
real
;
}
////////////////////////////
public
double
magnitude
()
{
return
1.0
;
double
r2
=
Math
.
pow
(
real
,
2
);
double
i2
=
Math
.
pow
(
imag
,
2
);
double
ri
=
r2
+
i2
;
double
risqrt
=
Math
.
sqrt
(
ri
);
return
risqrt
;
}
public
double
argument
()
{
return
1.0
;
double
arg_tan
=
Math
.
atan2
(
imag
,
real
);
return
arg_tan
;
}
public
String
toString
()
{
return
""
;
String
words
;
if
(
imag
==
0
){
words
=
Double
.
toString
(
real
);
}
else
if
(
real
==
0
){
words
=
(
"j"
+
imag
);
}
else
if
(
imag
<
0
){
imag
=
0
-
imag
;
words
=
(
real
+
" - j"
+
imag
);
}
else
{
words
=
(
real
+
" + j"
+
imag
);
}
return
words
;
}
public
Complex
add
(
Complex
complexNum
)
...
...
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