Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
assessment 1
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
jinny.wilkin
assessment 1
Commits
fb5043b0
Commit
fb5043b0
authored
May 11, 2022
by
jinny.wilkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
assessment upload
parent
de95c2bd
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
237 additions
and
223 deletions
+237
-223
settings.json
.vscode/settings.json
+0
-7
README.md
README.md
+18
-18
Instructions.md
bin/Instructions.md
+81
-81
App.java
src/App.java
+5
-5
AppTest.java
src/AppTest.java
+60
-60
Complex.java
src/Complex.java
+73
-52
No files found.
.vscode/settings.json
deleted
100644 → 0
View file @
de95c2bd
{
"java.project.sourcePaths"
:
[
"src"
],
"java.project.outputPath"
:
"bin"
,
"java.project.referencedLibraries"
:
[
"lib/**/*.jar"
]
}
README.md
View file @
fb5043b0
bin/Instructions.md
View file @
fb5043b0
src/App.java
View file @
fb5043b0
src/AppTest.java
View file @
fb5043b0
src/Complex.java
View file @
fb5043b0
...
@@ -14,7 +14,7 @@ public class Complex {
...
@@ -14,7 +14,7 @@ public class Complex {
{
{
real
=
r
;
real
=
r
;
imag
=
i
;
imag
=
i
;
double
d
=
Math
.
atan2
(
i
,
r
);
//double d = Math.atan2(i,r);
}
}
public
double
imag
()
public
double
imag
()
...
@@ -29,23 +29,44 @@ public class Complex {
...
@@ -29,23 +29,44 @@ public class Complex {
public
double
magnitude
()
public
double
magnitude
()
{
{
return
1.0
;
return
Math
.
sqrt
((
Math
.
pow
(
real
,
2
))+(
Math
.
pow
(
imag
,
2
)));
}
}
public
double
argument
()
public
double
argument
()
{
{
return
1.0
;
return
Math
.
atan2
(
imag
,
real
);
}
}
public
String
toString
()
public
String
toString
()
{
{
return
""
;
String
result
;
String
realStr
=
""
;
String
imagStr
=
""
;
if
(
real
!=
0
){
realStr
=
Double
.
toString
(
real
);
}
if
(
imag
!=
0
){
imagStr
=
imag
>
0
?
" + j"
+
imag:
" - j"
+(-
imag
);
}
if
((
real
!=
0
)
&&
(
imag
==
0
)){
result
=
realStr
;
}
else
if
((
real
==
0
)&&
(
imag
!=
0
)){
result
=
imagStr
.
substring
(
3
);
}
else
{
result
=
realStr
+
imagStr
;
}
return
result
;
}
}
public
Complex
add
(
Complex
complexNum
)
public
Complex
add
(
Complex
complexNum
)
{
{
double
realAdd
=
real
+
complexNum
.
real
;
double
imagAdd
=
imag
+
complexNum
.
imag
;
Complex
answer
=
new
Complex
(
0.0
,
0.0
);
Complex
answer
=
new
Complex
(
0.0
,
0.0
);
answer
.
real
=
realAdd
;
answer
.
imag
=
imagAdd
;
return
answer
;
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