Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
Maths Sem1
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
jack.templeman
Maths Sem1
Commits
4176483b
Commit
4176483b
authored
Nov 28, 2018
by
jackt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save
parent
9a87b765
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
13 deletions
+22
-13
.classpath
Maths assessment/.classpath
+2
-2
Program.java
Maths assessment/src/Program.java
+20
-11
No files found.
Maths assessment/.classpath
View file @
4176483b
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpath>
<classpathentry
kind=
"con"
path=
"org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"
/>
<classpathentry
exported=
"true"
kind=
"con"
path=
"org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"
/>
<classpathentry
kind=
"con"
path=
"org.eclipse.jdt.junit.JUNIT_CONTAINER/5"
/>
<classpathentry
exported=
"true"
kind=
"con"
path=
"org.eclipse.jdt.junit.JUNIT_CONTAINER/5"
/>
<classpathentry
kind=
"src"
path=
"src"
/>
<classpathentry
kind=
"src"
path=
"src"
/>
<classpathentry
kind=
"src"
path=
"maths"
/>
<classpathentry
kind=
"src"
path=
"maths"
/>
<classpathentry
excluding=
"src/|maths/"
kind=
"src"
path=
""
/>
<classpathentry
excluding=
"src/|maths/"
kind=
"src"
path=
""
/>
...
...
Maths assessment/src/Program.java
View file @
4176483b
...
@@ -30,14 +30,14 @@ public class Program {
...
@@ -30,14 +30,14 @@ public class Program {
String
character
=
""
;
String
character
=
""
;
int
total
=
0
;
int
total
=
0
;
int
b
=
binary
.
length
()
-
1
;
int
b
=
binary
.
length
()
-
1
;
int
c
=
l
-
1
;
int
c
=
l
;
int
d
=
resultsArray
[
0
];
int
e
=
resultsArray
[
1
];
int
f
=
resultsArray
[
2
];
int
g
=
resultsArray
[
3
];
resultsArray
[
c
]
=
total
;
for
(
int
a
=
0
;
a
<=
b
;
a
++)
{
for
(
int
a
=
0
;
a
<=
b
;
a
++)
{
if
(
a
==
0
)
if
(
a
==
0
)
{
{
total
=
0
;
total
=
0
;
...
@@ -46,11 +46,12 @@ public class Program {
...
@@ -46,11 +46,12 @@ public class Program {
char
theChar
=
binary
.
charAt
(
a
);
char
theChar
=
binary
.
charAt
(
a
);
character
=
Character
.
toString
(
theChar
);
character
=
Character
.
toString
(
theChar
);
if
(
a
==
0
&&
character
.
equals
(
"1"
))
{
if
(
a
==
0
&&
character
.
equals
(
"1"
))
{
total
=
total
++;
total
=
total
++;
continue
;
}
}
else
if
(
character
.
equals
(
"0"
)
&&
a
==
0
)
if
(
character
.
equals
(
"0"
)
&&
a
==
0
)
{
{
continue
;
continue
;
}
}
...
@@ -59,54 +60,62 @@ public class Program {
...
@@ -59,54 +60,62 @@ public class Program {
case
1
:
case
1
:
if
(
character
.
equals
(
"1"
))
{
if
(
character
.
equals
(
"1"
))
{
total
=
total
+
2
;
total
=
total
+
2
;
resultsArray
[
l
]
=
total
;
continue
;
continue
;
}
}
case
2
:
case
2
:
if
(
character
.
equals
(
"1"
))
{
if
(
character
.
equals
(
"1"
))
{
total
=
total
+
4
;
total
=
total
+
4
;
resultsArray
[
l
]
=
total
;
continue
;
continue
;
}
else
}
else
continue
;
continue
;
case
3
:
case
3
:
if
(
character
.
equals
(
"1"
))
{
if
(
character
.
equals
(
"1"
))
{
total
=
total
+
8
;
total
=
total
+
8
;
resultsArray
[
l
]
=
total
;
continue
;
continue
;
}
else
}
else
continue
;
continue
;
case
4
:
case
4
:
if
(
character
.
equals
(
"1"
))
{
if
(
character
.
equals
(
"1"
))
{
total
=
total
+
16
;
total
=
total
+
16
;
resultsArray
[
l
]
=
total
;
continue
;
continue
;
}
else
}
else
continue
;
continue
;
case
5
:
case
5
:
if
(
character
.
equals
(
"1"
))
{
if
(
character
.
equals
(
"1"
))
{
total
=
total
+
32
;
total
=
total
+
32
;
resultsArray
[
l
]
=
total
;
continue
;
continue
;
}
else
}
else
continue
;
continue
;
case
6
:
case
6
:
if
(
character
.
equals
(
"1"
))
{
if
(
character
.
equals
(
"1"
))
{
total
=
total
+
64
;
total
=
total
+
64
;
resultsArray
[
l
]
=
total
;
continue
;
continue
;
}
else
}
else
continue
;
continue
;
case
7
:
case
7
:
if
(
character
.
equals
(
"1"
))
{
if
(
character
.
equals
(
"1"
))
{
total
=
total
+
128
;
total
=
total
+
128
;
resultsArray
[
l
]
=
total
;
continue
;
continue
;
}
else
}
else
break
;
break
;
case
8
:
case
8
:
if
(
character
.
equals
(
"1"
))
{
if
(
character
.
equals
(
"1"
))
{
total
=
total
+
256
;
total
=
total
+
256
;
resultsArray
[
l
]
=
total
;
continue
;
continue
;
}
}
}
}
resultsArray
[
l
-
1
]
=
total
;
resultsArray
[
l
-
1
]
=
total
;
}
}
}
}
return
resultsArray
;
return
resultsArray
;
}
}
...
...
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