mirror of
https://bitbucket.org/Mattrixwv/projecteulerjava.git
synced 2026-02-03 19:02:28 -05:00
Updated some results to be neater
This commit is contained in:
@@ -106,7 +106,7 @@ public class Problem14 extends Problem{
|
|||||||
if(!solved){
|
if(!solved){
|
||||||
throw new Unsolved();
|
throw new Unsolved();
|
||||||
}
|
}
|
||||||
return String.format("The number %d produced a chain of %d steps\n", maxNum, maxLength);
|
return String.format("The number %d produced a chain of %d steps", maxNum, maxLength);
|
||||||
}
|
}
|
||||||
//Returns the length of the requested chain
|
//Returns the length of the requested chain
|
||||||
public long getLength(){
|
public long getLength(){
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public class Problem16 extends Problem{
|
|||||||
if(!solved){
|
if(!solved){
|
||||||
throw new Unsolved();
|
throw new Unsolved();
|
||||||
}
|
}
|
||||||
return String.format("%d^%d = %s\nThe sum of the elements is %d\n", NUM_TO_POWER, POWER, num.toString(), sumOfElements);
|
return String.format("%d^%d = %s\nThe sum of the elements is %d", NUM_TO_POWER, POWER, num.toString(), sumOfElements);
|
||||||
}
|
}
|
||||||
//Returns the number that was calculated
|
//Returns the number that was calculated
|
||||||
public BigInteger getNumber(){
|
public BigInteger getNumber(){
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ public class Problem17 extends Problem{
|
|||||||
if(!solved){
|
if(!solved){
|
||||||
throw new Unsolved();
|
throw new Unsolved();
|
||||||
}
|
}
|
||||||
return String.format("The sum of all the letters in all the numbers %d-%d is %d\n", START_NUM, STOP_NUM, letterCount);
|
return String.format("The sum of all the letters in all the numbers %d-%d is %d", START_NUM, STOP_NUM, letterCount);
|
||||||
}
|
}
|
||||||
//Returns the number of letters asked for
|
//Returns the number of letters asked for
|
||||||
public long getLetterCount(){
|
public long getLetterCount(){
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ public class Problem8 extends Problem{
|
|||||||
if(!solved){
|
if(!solved){
|
||||||
throw new Unsolved();
|
throw new Unsolved();
|
||||||
}
|
}
|
||||||
return String.format("The greatest product is %d\nThe numbers are %d", maxProduct, maxNums);
|
return String.format("The greatest product is %d\nThe numbers are %s", maxProduct, maxNums);
|
||||||
}
|
}
|
||||||
//Returns the string of numbers that produces the largest product
|
//Returns the string of numbers that produces the largest product
|
||||||
public String getLargestNums(){
|
public String getLargestNums(){
|
||||||
|
|||||||
Reference in New Issue
Block a user