Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
ClassAssessment1
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
a-j.towse
ClassAssessment1
Commits
7bb37aed
Commit
7bb37aed
authored
Mar 14, 2022
by
a-j.towse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
toString completed
parent
c97f3029
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
11 deletions
+12
-11
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
+12
-11
No files found.
bin/App.class
View file @
7bb37aed
No preview for this file type
bin/AppTest.class
View file @
7bb37aed
No preview for this file type
bin/Complex.class
View file @
7bb37aed
No preview for this file type
src/Complex.java
View file @
7bb37aed
...
...
@@ -37,19 +37,20 @@ public class Complex {
return
Math
.
atan2
(
imag
,
real
);
}
public
String
toString
()
//Current W.I.P
{
String
StringReal
=
""
;
if
(
real
!=
0
){
StringReal
=
Double
.
toString
(
real
);}
if
(
imag
>
0
){
return
StringReal
+
" + "
+
'j'
+
Double
.
toString
(
imag
);
}
else
if
(
imag
<
0
){
return
StringReal
+
" - "
+
'j'
+
Double
.
toString
(
imag
+
Math
.
abs
(-
1
));
public
String
toString
(){
if
(
real
==
0
){
return
'j'
+
Double
.
toString
(
Math
.
abs
(
imag
));
}
else
{
return
StringReal
;
if
(
imag
>
0
){
return
Double
.
toString
(
real
)
+
" + "
+
'j'
+
Double
.
toString
(
imag
);
}
else
if
(
imag
<
0
){
return
Double
.
toString
(
real
)
+
" - "
+
'j'
+
Double
.
toString
(
Math
.
abs
(
imag
));
}
else
{
return
Double
.
toString
(
real
);
}
}
}
...
...
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