Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
javaAssessEx1
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
elijah vasquez
javaAssessEx1
Commits
40867e73
Commit
40867e73
authored
Mar 08, 2022
by
Elijah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
b63a1eab
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
11 deletions
+9
-11
Complex.class
bin/Complex.class
+0
-0
Complex.java
src/Complex.java
+9
-11
No files found.
bin/Complex.class
View file @
40867e73
No preview for this file type
src/Complex.java
View file @
40867e73
// work out here
public
class
Complex
{
public
double
real
;
...
...
@@ -27,25 +26,24 @@ public class Complex {
{
return
real
;
}
public
double
magnitude
()
// magnitude = sqrt(a^2 + b^2)
// work out here
public
double
magnitude
()
//
problem 1
magnitude = sqrt(a^2 + b^2)
{
Math
.
sqrt
(
Math
.
pow
(
this
.
real
,
2
)
+
Math
.
pow
(
this
.
imag
,
2
));
return
1.0
;
return
Math
.
sqrt
(
Math
.
pow
(
real
,
2
)
+
Math
.
pow
(
imag
,
2
));
}
public
double
argument
()
// argument = tan-1(b/a)
public
double
argument
()
//
problem 2
argument = tan-1(b/a)
{
//Math.atan2(b,a);
return
1.0
;
return
Math
.
atan2
(
imag
,
real
);
}
public
String
toString
()
public
String
toString
()
// problem 3 format = a + jb
{
return
""
;
// employ if statement?
return
real
+
" + "
+
"j"
+
imag
;
}
public
Complex
add
(
Complex
complexNum
)
public
Complex
add
(
Complex
complexNum
)
// problem 4 addition (a + c) + j(b + d)
{
Complex
answer
=
new
Complex
(
0.0
,
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