Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
20_21-J03
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
20_21-J03
20_21-J03
Commits
c432c8f9
Commit
c432c8f9
authored
Jul 07, 2021
by
Vyshna-Sri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated FractionValue code
parent
44b8fe51
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
app/src/main/java/com/elearning/probabilityandstatisticsanalyserandeducator/dataExtraction/FractionValue.java
...ticsanalyserandeducator/dataExtraction/FractionValue.java
+7
-4
No files found.
app/src/main/java/com/elearning/probabilityandstatisticsanalyserandeducator/dataExtraction/FractionValue.java
View file @
c432c8f9
...
@@ -3,13 +3,16 @@ package com.elearning.probabilityandstatisticsanalyserandeducator.dataExtraction
...
@@ -3,13 +3,16 @@ package com.elearning.probabilityandstatisticsanalyserandeducator.dataExtraction
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.MathContext
;
import
java.math.MathContext
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
public
class
FractionValue
{
public
class
FractionValue
{
public
FractionValue
(){}
public
FractionValue
(){}
public
Double
fractionToDouble
(
String
question
){
public
List
<
Double
>
fractionToDouble
(
String
question
){
Double
value
=
null
;
List
<
Double
>
value
=
new
ArrayList
<
Double
>()
;
question
=
"4/52"
;
question
=
"4/52"
;
if
(
question
!=
null
)
{
if
(
question
!=
null
)
{
if
(
question
.
contains
(
"/"
))
{
if
(
question
.
contains
(
"/"
))
{
...
@@ -18,11 +21,11 @@ public class FractionValue {
...
@@ -18,11 +21,11 @@ public class FractionValue {
BigDecimal
d1
=
BigDecimal
.
valueOf
(
Double
.
valueOf
(
numbers
[
0
]));
BigDecimal
d1
=
BigDecimal
.
valueOf
(
Double
.
valueOf
(
numbers
[
0
]));
BigDecimal
d2
=
BigDecimal
.
valueOf
(
Double
.
valueOf
(
numbers
[
1
]));
BigDecimal
d2
=
BigDecimal
.
valueOf
(
Double
.
valueOf
(
numbers
[
1
]));
BigDecimal
response
=
d1
.
divide
(
d2
,
MathContext
.
DECIMAL128
);
BigDecimal
response
=
d1
.
divide
(
d2
,
MathContext
.
DECIMAL128
);
value
=
response
.
doubleValue
(
);
value
=
Collections
.
singletonList
(
response
.
doubleValue
()
);
}
}
}
}
else
{
else
{
value
=
Double
.
valueOf
(
question
);
value
=
Collections
.
singletonList
(
Double
.
valueOf
(
question
)
);
}
}
}
}
// if (value == null) {
// if (value == null) {
...
...
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