Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
602f4a9
besouro automatic message
Sep 29, 2016
797b20d
besouro automatic message
Sep 29, 2016
b477c56
besouro automatic message
Sep 29, 2016
5090ae5
besouro automatic message
Sep 29, 2016
1211f2a
besouro automatic message
Sep 29, 2016
faf7670
besouro automatic message
Sep 29, 2016
c608d08
besouro automatic message
Sep 29, 2016
d3cba11
besouro automatic message
Sep 29, 2016
e331946
besouro automatic message
Sep 29, 2016
f031347
besouro automatic message
Sep 29, 2016
dfbb440
besouro automatic message
Sep 29, 2016
8d2ce0f
besouro automatic message
Sep 29, 2016
a37fd7c
besouro automatic message
Sep 29, 2016
66aa3d9
besouro automatic message
Sep 29, 2016
fc8ab2a
besouro automatic message
Sep 29, 2016
bb3c326
besouro automatic message
Sep 29, 2016
0351cb5
besouro automatic message
Sep 29, 2016
f4a8152
besouro automatic message
Sep 29, 2016
0f0f563
besouro automatic message
Sep 29, 2016
3fd71d7
besouro automatic message
Sep 29, 2016
58bd795
besouro automatic message
Sep 29, 2016
57eee36
besouro automatic message
Sep 29, 2016
52ad541
besouro automatic message
Sep 29, 2016
792918d
besouro automatic message
Sep 29, 2016
937e8e8
besouro automatic message
Sep 29, 2016
f4bec70
besouro automatic message
Sep 29, 2016
8c11205
besouro automatic message
Sep 29, 2016
e973b97
besouro automatic message
Sep 29, 2016
9248d5f
version X
Sep 29, 2016
b821913
besouro automatic message
Oct 6, 2016
b315a19
besouro automatic message
Oct 6, 2016
f2a438a
besouro automatic message
Oct 6, 2016
a7e8c66
besouro automatic message
Oct 6, 2016
8b0d128
besouro automatic message
Oct 6, 2016
870b0c6
besouro automatic message
Oct 6, 2016
7dbbea6
besouro automatic message
Oct 6, 2016
c69ba15
besouro automatic message
Oct 6, 2016
e765dfd
besouro automatic message
Oct 6, 2016
6a48ec7
besouro automatic message
Oct 6, 2016
a7e2ca4
besouro automatic message
Oct 6, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 198 additions & 0 deletions .besouro/20160929153653315/actions.txt

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .besouro/20160929153653315/besouroEpisodes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1475152939536 test-first 2 325 true
1475152939537 test-first 2 325 true
Empty file.
1 change: 1 addition & 0 deletions .besouro/20160929153653315/randomHeuristicEpisodes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1475152939536 test-first 2 325 true
Empty file.
1 change: 1 addition & 0 deletions .besouro/20160929153653315/zorroEpisodes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1475152939536 test-first 2 325 true
53 changes: 53 additions & 0 deletions .besouro/20161006150244533/actions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
FileOpenedAction 1475755364932 RomanNumerals.java 4224 19 47 0
EditAction 1475755810552 TestRomanNumerals.java 4449 14 28 14
UnitTestCaseAction 1475755814154 TestRomanNumerals.java FAIL
UnitTestSessionAction 1475755814155 TestRomanNumerals.java FAIL
EditAction 1475755837577 RomanNumerals.java 4985 19 48 0
UnitTestCaseAction 1475755838548 TestRomanNumerals.java FAIL
UnitTestSessionAction 1475755838549 TestRomanNumerals.java FAIL
UnitTestCaseAction 1475755871700 TestRomanNumerals.java FAIL
UnitTestSessionAction 1475755871700 TestRomanNumerals.java FAIL
UnitTestCaseAction 1475755884541 TestRomanNumerals.java FAIL
UnitTestSessionAction 1475755884542 TestRomanNumerals.java FAIL
EditAction 1475755911201 RomanNumerals.java 5017 19 48 0
UnitTestCaseAction 1475755912205 TestRomanNumerals.java FAIL
UnitTestSessionAction 1475755912206 TestRomanNumerals.java FAIL
CompilationAction 1475755945334 RomanNumerals.java
CompilationAction 1475755945335 RomanNumerals.java
CompilationAction 1475755952198 RomanNumerals.java
CompilationAction 1475755952313 RomanNumerals.java
CompilationAction 1475755964261 RomanNumerals.java
UnitTestCaseAction 1475755966108 TestRomanNumerals.java FAIL
UnitTestSessionAction 1475755966109 TestRomanNumerals.java FAIL
EditAction 1475755984363 RomanNumerals.java 5025 19 48 0
UnitTestCaseAction 1475755985232 TestRomanNumerals.java FAIL
UnitTestSessionAction 1475755985232 TestRomanNumerals.java FAIL
EditAction 1475755998614 RomanNumerals.java 5025 19 48 0
UnitTestCaseAction 1475755999543 TestRomanNumerals.java FAIL
UnitTestSessionAction 1475755999543 TestRomanNumerals.java FAIL
UnitTestCaseAction 1475756079607 TestRomanNumerals.java FAIL
UnitTestSessionAction 1475756079607 TestRomanNumerals.java FAIL
UnitTestCaseAction 1475756106045 TestRomanNumerals.java FAIL
UnitTestSessionAction 1475756106046 TestRomanNumerals.java FAIL
UnitTestCaseAction 1475756111503 TestRomanNumerals.java FAIL
UnitTestSessionAction 1475756111503 TestRomanNumerals.java FAIL
UnitTestCaseAction 1475756370589 TestRomanNumerals.java FAIL
UnitTestSessionAction 1475756370589 TestRomanNumerals.java FAIL
UnitTestCaseAction 1475756466555 TestRomanNumerals.java FAIL
UnitTestSessionAction 1475756466556 TestRomanNumerals.java FAIL
UnitTestCaseAction 1475756505917 TestRomanNumerals.java FAIL
UnitTestSessionAction 1475756505918 TestRomanNumerals.java FAIL
UnitTestCaseAction 1475756945365 TestRomanNumerals.java FAIL
UnitTestSessionAction 1475756945366 TestRomanNumerals.java FAIL
UnitTestCaseAction 1475756993610 TestRomanNumerals.java FAIL
UnitTestSessionAction 1475756993610 TestRomanNumerals.java FAIL
UnitTestCaseAction 1475757046048 TestRomanNumerals.java FAIL
UnitTestSessionAction 1475757046049 TestRomanNumerals.java FAIL
UnitTestCaseAction 1475757122310 TestRomanNumerals.java FAIL
UnitTestSessionAction 1475757122311 TestRomanNumerals.java FAIL
CompilationAction 1475757204489 RomanNumerals.java
CompilationAction 1475757214645 RomanNumerals.java
CompilationAction 1475757214730 RomanNumerals.java
CompilationAction 1475757222140 RomanNumerals.java
UnitTestCaseAction 1475757222780 TestRomanNumerals.java FAIL
UnitTestSessionAction 1475757222780 TestRomanNumerals.java FAIL
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
13 changes: 13 additions & 0 deletions .besouro/20161006160552135/actions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FileOpenedAction 1475759152309 RomanNumerals.java 6083 19 48 0
UnitTestCaseAction 1475760721216 TestRomanNumerals.java FAIL
UnitTestSessionAction 1475760721217 RomanNumerals.java FAIL
UnitTestCaseAction 1475760812760 TestRomanNumerals.java OK
UnitTestSessionAction 1475760812760 RomanNumerals.java OK
EditAction 1475760857210 TestRomanNumerals.java 4446 14 26 13
CompilationAction 1475760857541 TestRomanNumerals.java
EditAction 1475760863070 TestRomanNumerals.java 4445 14 28 14
UnitTestCaseAction 1475760863897 TestRomanNumerals.java OK
UnitTestSessionAction 1475760863897 TestRomanNumerals.java OK
EditAction 1475760876284 TestRomanNumerals.java 4449 14 28 14
UnitTestCaseAction 1475760877100 TestRomanNumerals.java OK
UnitTestSessionAction 1475760877100 TestRomanNumerals.java OK
3 changes: 3 additions & 0 deletions .besouro/20161006160552135/besouroEpisodes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1475760812760 regression 2 1660 true
1475760863897 test-addition 1 6 true
1475760877100 regression 1 0 true
Empty file.
3 changes: 3 additions & 0 deletions .besouro/20161006160552135/randomHeuristicEpisodes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1475760812760 regression 2 1660 true
1475760863897 test-addition 1 6 true
1475760877100 regression 1 0 false
Empty file.
3 changes: 3 additions & 0 deletions .besouro/20161006160552135/zorroEpisodes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1475760812760 regression 2 1660 false
1475760863897 test-addition 1 51 false
1475760877100 regression 1 13 false
300 changes: 298 additions & 2 deletions src/RomanNumerals.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,303 @@
public class RomanNumerals {
public int convertToInteger(String romanNum) {
// To be Implemented
return 0;

//1984 = MCMLXXXIV
int num=0, tempNum=0, tempNum2=0, tempNum3=0, sigNum=0;
char tempChar;
if (checkFor3C(romanNum)&&checkFor3I(romanNum)&&checkFor3M(romanNum)&&checkFor3X(romanNum)) {
if (checkForNorepeatD(romanNum)&&checkForNorepeatL(romanNum)&&checkForNorepeatV(romanNum)) {
for (int i = romanNum.length()-1; i>=0 ; i--) {
tempNum=0;
tempNum2=0;
tempNum3=0;
if(sigNum==0){
System.out.println("iep sumo");

tempChar= romanNum.charAt(i);
tempNum= convertCharToNum(tempChar);
if(i==1) {

tempNum2=convertCharToNum(romanNum.charAt(i-1));
if (tempNum>tempNum2) {
System.out.println(tempNum + "el sig es menor"+tempNum2);

num= num+(tempNum-tempNum2);
sigNum=-1;
} else{
num= num+tempNum;
}

}else if(i==0){

num= num+tempNum;


}else if(i!=0 && i !=1){
tempNum2=convertCharToNum(romanNum.charAt(i-1));
tempNum3=convertCharToNum(romanNum.charAt(i-2));
System.out.println("elnorma"+ tempNum+','+tempNum2+','+tempNum3);

if (tempNum>tempNum2&&tempNum<=tempNum3) {
System.out.println(tempNum + "el sig es menor"+tempNum2);
num= num+(tempNum-tempNum2);
sigNum=-1;
System.out.println("sig"+sigNum);
} else if (tempNum>tempNum2&&tempNum>tempNum3) {
System.out.println(tempNum + "el sig y el sig es menor"+tempNum2+','+tempNum3);

num= num+(tempNum-tempNum2-tempNum3);
sigNum=-2;
}else {
num= num+tempNum;
}


}
}else if (sigNum==-1) {
sigNum=0;
System.out.println("iep No sumo 1");


}else if (sigNum==-2) {
sigNum=-1;
System.out.println("iep No sumo2");

}
System.out.println(num +" y "+sigNum);
}
}
}
return num;


}

public int convertCharToNum(Character a){
int num=0;

if (a=='I') {
num=1;

}else if(a=='V') {
num=5;

}else if(a=='X') {
num=10;

}else if(a=='L') {
num=50;

}else if (a=='C') {
num=100;

}else if(a=='M') {
num=1000;

}
return num;

}
//1 rule
public boolean checkFor3I(String num) {
// TODO Auto-generated method stub
int numOfThatChar=0;
for (int i = 0; i < num.length(); i++) {
if (num.charAt(i)=='I') {
numOfThatChar++;
}

}


if (numOfThatChar<=3) {
return true;
}else return false;
}

public boolean checkFor3X(String num) {
// TODO Auto-generated method stub
int numOfThatChar=0;
for (int i = 0; i < num.length(); i++) {
if (num.charAt(i)=='X') {
numOfThatChar++;
}

}


if (numOfThatChar<=3) {
return true;
}else return false; }

public boolean checkFor3C(String num) {
// TODO Auto-generated method stub
int numOfThatChar=0;
for (int i = 0; i < num.length(); i++) {
if (num.charAt(i)=='C') {
numOfThatChar++;
}

}


if (numOfThatChar<=3) {
return true;
}else return false;
}

public boolean checkFor3M(String num) {
// TODO Auto-generated method stub
int numOfThatChar=0;
for (int i = 0; i < num.length(); i++) {
if (num.charAt(i)=='M') {
numOfThatChar++;
}

}


if (numOfThatChar<=3) {
return true;
}else return false;
}


//2rule

public boolean checkForNorepeatV(String num) {
int numOfThatChar=0;
for (int i = 0; i < num.length(); i++) {
if (num.charAt(i)=='V') {
numOfThatChar++;
}
}
if (numOfThatChar>1) {
return false;
}else return true;
}
public boolean checkForNorepeatL(String num) {
// TODO Auto-generated method stub
int numOfThatChar=0;
for (int i = 0; i < num.length(); i++) {
if (num.charAt(i)=='L') {
numOfThatChar++;
}
}
if (numOfThatChar>1) {
return false;
}else return true;
}
public boolean checkForNorepeatD(String num) {
// TODO Auto-generated method stub
int numOfThatChar=0;
for (int i = 0; i < num.length(); i++) {
if (num.charAt(i)=='D') {
numOfThatChar++;
}
}
if (numOfThatChar>1) {
return false;
}else return true;
}
public int wahtIsIVis4(String num) {

for (int i = 0; i < num.length(); i++) {
if (num.charAt(i)=='I' &&(num.charAt(i+1)=='V')) {
return 4;
}else return -1;


}
return -1;
}
public Object wahtIsIXis9(String num) {
for (int i = 0; i < num.length(); i++) {
if (num.charAt(i)=='I' &&(num.charAt(i+1)=='X')) {
return 9;
}else return -1;


}
return -1;
}
public Object wahtIsILis49(String num) {
for (int i = 0; i < num.length(); i++) {
if (num.charAt(i)=='I' &&(num.charAt(i+1)=='L')) {
return 49;
}else return -1;


}
return -1;
}
public Object wahtIsICis99(String num) {
for (int i = 0; i < num.length(); i++) {
if (num.charAt(i)=='I' &&(num.charAt(i+1)=='C')) {
return 99;
}else return -1;


}
return -1;
}
public Object wahtIsIDis499(String num) {
for (int i = 0; i < num.length(); i++) {
if (num.charAt(i)=='I' &&(num.charAt(i+1)=='D')) {
return 499;
}else return -1;


}
return -1;
}
public Object wahtIsXLis40(String num) {
for (int i = 0; i < num.length(); i++) {
if (num.charAt(i)=='X' &&(num.charAt(i+1)=='L')) {
return 40;
}else return -1;


}
return -1;
}
public Object wahtIsXCis90(String num) {
for (int i = 0; i < num.length(); i++) {
if (num.charAt(i)=='X' &&(num.charAt(i+1)=='C')) {
return 90;
}else return -1;


}
return -1;
}
public Object wahtIsXDis490(String num) {
for (int i = 0; i < num.length(); i++) {
if (num.charAt(i)=='X' &&(num.charAt(i+1)=='D')) {
return 490;
}else return -1;


}
return -1;
}
public Object wahtIsCDis400(String num) {
for (int i = 0; i < num.length(); i++) {
if (num.charAt(i)=='C' &&(num.charAt(i+1)=='D')) {
return 400;
}else return -1;


}
return -1;
}
public Object wahtIsCMis900(String num) {
for (int i = 0; i < num.length(); i++) {
if (num.charAt(i)=='C' &&(num.charAt(i+1)=='M')) {
return 900;
}else return -1;


}
return -1;
}
}
Loading