public static boolean again; //Key value that keeps the main loop going
public static boolean isValid; // checks if the entered value was valid
public static void wantMore(){ //Prompts the user if they would like to convert another?
boolean more;
char choice;
more = true; //more is initialized as true;
System.out.println("Would you like to convert another number?");
while(more){ //while more is true, the loop continues
System.out.print("Please enter your decision (Y\\N): ");
choice = Stdin.getChar(); //User enters in whether they would like to convert again.
switch(choice){
//If the user enters 'y' or 'Y', then breaks out of current loop & starts main loop again
case 'y': again = true; more = false; break;
case 'Y': again = true; more = false; break;
//If the user enters 'n' or 'N', then breaks out of current loop & ends program.
case 'n': again = false; more = false; break;
case 'N': again = false; more = false; break;
//If the user enters anything else, it displays an error message and prompts user to re-enter their choice.
default: {
System.out.println();
System.out.println("Good job stupid-face. You idiot.");
System.out.println("Please type in Y or N...");
more = true;
}//default
}//switchy-casey
}//while
}//wantMore
public static void main(String[] args){
int num;
System.out.println("The Roman Numeral Converter");
System.out.println("------------------------------");
System.out.println();
again = true; //again is initialized as true
while(again){ //while again is true, user is asked for a number to convert.
System.out.print("Please enter an integer to convert (0 to quit): ");
num = Stdin.getInt(); //User enters an integer to convert.
//If user enters 0, the main loop is broken and program ends.
if(num==0){
again = false;
break;
}
//If the user's number is valid by a function in the Numeral1 class,...
//...then it will convert the number.
if(Numeral1.validNum(num)==true){ //if boolean value returned by a function in Numeral1 class = true.
Numeral1.Converter(num); //Calling the converter function in the Numeral1 class to convert.
wantMore(); //calling a function whether the user would like to convert a number again.
}
//If the user's number is not valid, then the user will be prompted to re-enter.
else if(Numeral1.validNum(num)==false){ //if boolean value returned by a function in Numeral1 class = false.
System.out.println("You have entered an unauthorized request.");
System.out.println("Please re-renter...");
System.out.println();
}
}//while
//Friendly exit message.
System.out.println();
System.out.println("Thanks for using the Roman Numeral Converter!");
}//main
}//RomanA
public class RomanA {
public static boolean again; //Key value that keeps the main loop going
public static boolean isValid; // checks if the entered value was valid
public static void wantMore(){ //Prompts the user if they would like to convert another?
boolean more;
char choice;
more = true; //more is initialized as true;
System.out.println("Would you like to convert another number?");
while(more){ //while more is true, the loop continues
System.out.print("Please enter your decision (Y\\N): ");
choice = Stdin.getChar(); //User enters in whether they would like to convert again.
switch(choice){
//If the user enters 'y' or 'Y', then breaks out of current loop & starts main loop again
case 'y': again = true; more = false; break;
case 'Y': again = true; more = false; break;
//If the user enters 'n' or 'N', then breaks out of current loop & ends program.
case 'n': again = false; more = false; break;
case 'N': again = false; more = false; break;
//If the user enters anything else, it displays an error message and prompts user to re-enter their choice.
default: {
System.out.println();
System.out.println("Good job stupid-face. You idiot.");
System.out.println("Please type in Y or N...");
more = true;
}//default
}//switchy-casey
}//while
}//wantMore
public static void main(String[] args){
int num;
System.out.println("The Roman Numeral Converter");
System.out.println("------------------------------");
System.out.println();
again = true; //again is initialized as true
while(again){ //while again is true, user is asked for a number to convert.
System.out.print("Please enter an integer to convert (0 to quit): ");
num = Stdin.getInt(); //User enters an integer to convert.
//If user enters 0, the main loop is broken and program ends.
if(num==0){
again = false;
break;
}
//If the user's number is valid by a function in the Numeral1 class,...
//...then it will convert the number.
if(Numeral1.validNum(num)==true){ //if boolean value returned by a function in Numeral1 class = true.
Numeral1.Converter(num); //Calling the converter function in the Numeral1 class to convert.
wantMore(); //calling a function whether the user would like to convert a number again.
}
//If the user's number is not valid, then the user will be prompted to re-enter.
else if(Numeral1.validNum(num)==false){ //if boolean value returned by a function in Numeral1 class = false.
System.out.println("You have entered an unauthorized request.");
System.out.println("Please re-renter...");
System.out.println();
}
}//while
//Friendly exit message.
System.out.println();
System.out.println("Thanks for using the Roman Numeral Converter!");
}//main
}//RomanA
public class RomanA {
public static boolean again; //Key value that keeps the main loop going
public static boolean isValid; // checks if the entered value was valid
public static void wantMore(){ //Prompts the user if they would like to convert another?
boolean more;
char choice;
more = true; //more is initialized as true;
System.out.println("Would you like to convert another number?");
while(more){ //while more is true, the loop continues
System.out.print("Please enter your decision (Y\\N): ");
choice = Stdin.getChar(); //User enters in whether they would like to convert again.
switch(choice){
//If the user enters 'y' or 'Y', then breaks out of current loop & starts main loop again
case 'y': again = true; more = false; break;
case 'Y': again = true; more = false; break;
//If the user enters 'n' or 'N', then breaks out of current loop & ends program.
case 'n': again = false; more = false; break;
case 'N': again = false; more = false; break;
//If the user enters anything else, it displays an error message and prompts user to re-enter their choice.
default: {
System.out.println();
System.out.println("Good job stupid-face. You idiot.");
System.out.println("Please type in Y or N...");
more = true;
}//default
}//switchy-casey
}//while
}//wantMore
public static void main(String[] args){
int num;
System.out.println("The Roman Numeral Converter");
System.out.println("------------------------------");
System.out.println();
again = true; //again is initialized as true
while(again){ //while again is true, user is asked for a number to convert.
System.out.print("Please enter an integer to convert (0 to quit): ");
num = Stdin.getInt(); //User enters an integer to convert.
//If user enters 0, the main loop is broken and program ends.
if(num==0){
again = false;
break;
}
//If the user's number is valid by a function in the Numeral1 class,...
//...then it will convert the number.
if(Numeral1.validNum(num)==true){ //if boolean value returned by a function in Numeral1 class = true.
Numeral1.Converter(num); //Calling the converter function in the Numeral1 class to convert.
wantMore(); //calling a function whether the user would like to convert a number again.
}
//If the user's number is not valid, then the user will be prompted to re-enter.
else if(Numeral1.validNum(num)==false){ //if boolean value returned by a function in Numeral1 class = false.
System.out.println("You have entered an unauthorized request.");
System.out.println("Please re-renter...");
System.out.println();
}
}//while
//Friendly exit message.
System.out.println();
System.out.println("Thanks for using the Roman Numeral Converter!");
}//main
}//RomanA
public class RomanA {
public static boolean again; //Key value that keeps the main loop going
public static boolean isValid; // checks if the entered value was valid
public static void wantMore(){ //Prompts the user if they would like to convert another?
boolean more;
char choice;
more = true; //more is initialized as true;
System.out.println("Would you like to convert another number?");
while(more){ //while more is true, the loop continues
System.out.print("Please enter your decision (Y\\N): ");
choice = Stdin.getChar(); //User enters in whether they would like to convert again.
switch(choice){
//If the user enters 'y' or 'Y', then breaks out of current loop & starts main loop again
case 'y': again = true; more = false; break;
case 'Y': again = true; more = false; break;
//If the user enters 'n' or 'N', then breaks out of current loop & ends program.
case 'n': again = false; more = false; break;
case 'N': again = false; more = false; break;
//If the user enters anything else, it displays an error message and prompts user to re-enter their choice.
default: {
System.out.println();
System.out.println("Good job stupid-face. You idiot.");
System.out.println("Please type in Y or N...");
more = true;
}//default
}//switchy-casey
}//while
}//wantMore
public static void main(String[] args){
int num;
System.out.println("The Roman Numeral Converter");
System.out.println("------------------------------");
System.out.println();
again = true; //again is initialized as true
while(again){ //while again is true, user is asked for a number to convert.
System.out.print("Please enter an integer to convert (0 to quit): ");
num = Stdin.getInt(); //User enters an integer to convert.
//If user enters 0, the main loop is broken and program ends.
if(num==0){
again = false;
break;
}
//If the user's number is valid by a function in the Numeral1 class,...
//...then it will convert the number.
if(Numeral1.validNum(num)==true){ //if boolean value returned by a function in Numeral1 class = true.
Numeral1.Converter(num); //Calling the converter function in the Numeral1 class to convert.
wantMore(); //calling a function whether the user would like to convert a number again.
}
//If the user's number is not valid, then the user will be prompted to re-enter.
else if(Numeral1.validNum(num)==false){ //if boolean value returned by a function in Numeral1 class = false.
System.out.println("You have entered an unauthorized request.");
System.out.println("Please re-renter...");
System.out.println();
}
}//while
//Friendly exit message.
System.out.println();
System.out.println("Thanks for using the Roman Numeral Converter!");
}//main
}//RomanA
public class RomanA {
public static boolean again; //Key value that keeps the main loop going
public static boolean isValid; // checks if the entered value was valid
public static void wantMore(){ //Prompts the user if they would like to convert another?
boolean more;
char choice;
more = true; //more is initialized as true;
System.out.println("Would you like to convert another number?");
while(more){ //while more is true, the loop continues
System.out.print("Please enter your decision (Y\\N): ");
choice = Stdin.getChar(); //User enters in whether they would like to convert again.
switch(choice){
//If the user enters 'y' or 'Y', then breaks out of current loop & starts main loop again
case 'y': again = true; more = false; break;
case 'Y': again = true; more = false; break;
//If the user enters 'n' or 'N', then breaks out of current loop & ends program.
case 'n': again = false; more = false; break;
case 'N': again = false; more = false; break;
//If the user enters anything else, it displays an error message and prompts user to re-enter their choice.
default: {
System.out.println();
System.out.println("Good job stupid-face. You idiot.");
System.out.println("Please type in Y or N...");
more = true;
}//default
}//switchy-casey
}//while
}//wantMore
public static void main(String[] args){
int num;
System.out.println("The Roman Numeral Converter");
System.out.println("------------------------------");
System.out.println();
again = true; //again is initialized as true
while(again){ //while again is true, user is asked for a number to convert.
System.out.print("Please enter an integer to convert (0 to quit): ");
num = Stdin.getInt(); //User enters an integer to convert.
//If user enters 0, the main loop is broken and program ends.
if(num==0){
again = false;
break;
}
//If the user's number is valid by a function in the Numeral1 class,...
//...then it will convert the number.
if(Numeral1.validNum(num)==true){ //if boolean value returned by a function in Numeral1 class = true.
Numeral1.Converter(num); //Calling the converter function in the Numeral1 class to convert.
wantMore(); //calling a function whether the user would like to convert a number again.
}
//If the user's number is not valid, then the user will be prompted to re-enter.
else if(Numeral1.validNum(num)==false){ //if boolean value returned by a function in Numeral1 class = false.
System.out.println("You have entered an unauthorized request.");
System.out.println("Please re-renter...");
System.out.println();
}
}//while
//Friendly exit message.
System.out.println();
System.out.println("Thanks for using the Roman Numeral Converter!");
}//main
}//RomanA
public class RomanA {
public static boolean again; //Key value that keeps the main loop going
public static boolean isValid; // checks if the entered value was valid
public static void wantMore(){ //Prompts the user if they would like to convert another?
boolean more;
char choice;
more = true; //more is initialized as true;
System.out.println("Would you like to convert another number?");
while(more){ //while more is true, the loop continues
System.out.print("Please enter your decision (Y\\N): ");
choice = Stdin.getChar(); //User enters in whether they would like to convert again.
switch(choice){
//If the user enters 'y' or 'Y', then breaks out of current loop & starts main loop again
case 'y': again = true; more = false; break;
case 'Y': again = true; more = false; break;
//If the user enters 'n' or 'N', then breaks out of current loop & ends program.
case 'n': again = false; more = false; break;
case 'N': again = false; more = false; break;
//If the user enters anything else, it displays an error message and prompts user to re-enter their choice.
default: {
System.out.println();
System.out.println("Good job stupid-face. You idiot.");
System.out.println("Please type in Y or N...");
more = true;
}//default
}//switchy-casey
}//while
}//wantMore
public static void main(String[] args){
int num;
System.out.println("The Roman Numeral Converter");
System.out.println("------------------------------");
System.out.println();
again = true; //again is initialized as true
while(again){ //while again is true, user is asked for a number to convert.
System.out.print("Please enter an integer to convert (0 to quit): ");
num = Stdin.getInt(); //User enters an integer to convert.
//If user enters 0, the main loop is broken and program ends.
if(num==0){
again = false;
break;
}
//If the user's number is valid by a function in the Numeral1 class,...
//...then it will convert the number.
if(Numeral1.validNum(num)==true){ //if boolean value returned by a function in Numeral1 class = true.
Numeral1.Converter(num); //Calling the converter function in the Numeral1 class to convert.
wantMore(); //calling a function whether the user would like to convert a number again.
}
//If the user's number is not valid, then the user will be prompted to re-enter.
else if(Numeral1.validNum(num)==false){ //if boolean value returned by a function in Numeral1 class = false.
System.out.println("You have entered an unauthorized request.");
System.out.println("Please re-renter...");
System.out.println();
}
}//while
//Friendly exit message.
System.out.println();
System.out.println("Thanks for using the Roman Numeral Converter!");
}//main
//The String array contains the corresponding roman numerals.
public static String[] roman = { "m", "cm", "d", "cd", "c", "xc", "l", "xl", "x", "ix",
"v", "iv", "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" };
public static boolean isValid;
public static boolean validNum(int num){ //Checks num for validity
if((num>0)&&(num<=MAX)){ //If num is within range of 0 and the 3999999
isValid = true; //It is valid
}
else if((num<0)||(num>MAX)){ //If num is not in range
System.out.println("ERROR: Not within range of 1 - 3,999,999.");
isValid = false; //It is not valid
}
else{
System.out.println("ERROR: Must be an integer value.");
isValid = false;
}
return isValid;
}//validNum
public static void Converter(int num){ //Converts the Arabic numbers into Roman Numerals
//Declaring an 'empty' string
String StrRoman = "";
for(int x = 0; x < arabic.length; x++){ //From element 0 to the end of the array, keep going up
while(num>=arabic[x]){ //while num is greater/equal to numbers in the integer array
StrRoman+=roman[x]; //add the String array elements to the String variable
num-=arabic[x]; //subtract the numbers in the integer array from num
}//while---> does this again and again until num becomes zero
}//for
System.out.println();
System.out.println("The Roman Numeral is: " + StrRoman); //Prints out the Roman Numeral
System.out.println();
}//Converter
//The String array contains the corresponding roman numerals.
public static String[] roman = { "m", "cm", "d", "cd", "c", "xc", "l", "xl", "x", "ix",
"v", "iv", "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" };
public static boolean isValid;
public static boolean validNum(int num){ //Checks num for validity
if((num>0)&&(num<=MAX)){ //If num is within range of 0 and the 3999999
isValid = true; //It is valid
}
else if((num<0)||(num>MAX)){ //If num is not in range
System.out.println("ERROR: Not within range of 1 - 3,999,999.");
isValid = false; //It is not valid
}
else{
System.out.println("ERROR: Must be an integer value.");
isValid = false;
}
return isValid;
}//validNum
public static void Converter(int num){ //Converts the Arabic numbers into Roman Numerals
//Declaring an 'empty' string
String StrRoman = "";
for(int x = 0; x < arabic.length; x++){ //From element 0 to the end of the array, keep going up
while(num>=arabic[x]){ //while num is greater/equal to numbers in the integer array
StrRoman+=roman[x]; //add the String array elements to the String variable
num-=arabic[x]; //subtract the numbers in the integer array from num
}//while---> does this again and again until num becomes zero
}//for
System.out.println();
System.out.println("The Roman Numeral is: " + StrRoman); //Prints out the Roman Numeral
System.out.println();
}//Converter
//The String array contains the corresponding roman numerals.
public static String[] roman = { "m", "cm", "d", "cd", "c", "xc", "l", "xl", "x", "ix",
"v", "iv", "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" };
public static boolean isValid;
public static boolean validNum(int num){ //Checks num for validity
if((num>0)&&(num<=MAX)){ //If num is within range of 0 and the 3999999
isValid = true; //It is valid
}
else if((num<0)||(num>MAX)){ //If num is not in range
System.out.println("ERROR: Not within range of 1 - 3,999,999.");
isValid = false; //It is not valid
}
else{
System.out.println("ERROR: Must be an integer value.");
isValid = false;
}
return isValid;
}//validNum
public static void Converter(int num){ //Converts the Arabic numbers into Roman Numerals
//Declaring an 'empty' string
String StrRoman = "";
for(int x = 0; x < arabic.length; x++){ //From element 0 to the end of the array, keep going up
while(num>=arabic[x]){ //while num is greater/equal to numbers in the integer array
StrRoman+=roman[x]; //add the String array elements to the String variable
num-=arabic[x]; //subtract the numbers in the integer array from num
}//while---> does this again and again until num becomes zero
}//for
System.out.println();
System.out.println("The Roman Numeral is: " + StrRoman); //Prints out the Roman Numeral
System.out.println();
}//Converter
//The String array contains the corresponding roman numerals.
public static String[] roman = { "m", "cm", "d", "cd", "c", "xc", "l", "xl", "x", "ix",
"v", "iv", "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" };
public static boolean isValid;
public static boolean validNum(int num){ //Checks num for validity
if((num>0)&&(num<=MAX)){ //If num is within range of 0 and the 3999999
isValid = true; //It is valid
}
else if((num<0)||(num>MAX)){ //If num is not in range
System.out.println("ERROR: Not within range of 1 - 3,999,999.");
isValid = false; //It is not valid
}
else{
System.out.println("ERROR: Must be an integer value.");
isValid = false;
}
return isValid;
}//validNum
public static void Converter(int num){ //Converts the Arabic numbers into Roman Numerals
//Declaring an 'empty' string
String StrRoman = "";
for(int x = 0; x < arabic.length; x++){ //From element 0 to the end of the array, keep going up
while(num>=arabic[x]){ //while num is greater/equal to numbers in the integer array
StrRoman+=roman[x]; //add the String array elements to the String variable
num-=arabic[x]; //subtract the numbers in the integer array from num
}//while---> does this again and again until num becomes zero
}//for
System.out.println();
System.out.println("The Roman Numeral is: " + StrRoman); //Prints out the Roman Numeral
System.out.println();
}//Converter
//The String array contains the corresponding roman numerals.
public static String[] roman = { "m", "cm", "d", "cd", "c", "xc", "l", "xl", "x", "ix",
"v", "iv", "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" };
public static boolean isValid;
public static boolean validNum(int num){ //Checks num for validity
if((num>0)&&(num<=MAX)){ //If num is within range of 0 and the 3999999
isValid = true; //It is valid
}
else if((num<0)||(num>MAX)){ //If num is not in range
System.out.println("ERROR: Not within range of 1 - 3,999,999.");
isValid = false; //It is not valid
}
else{
System.out.println("ERROR: Must be an integer value.");
isValid = false;
}
return isValid;
}//validNum
public static void Converter(int num){ //Converts the Arabic numbers into Roman Numerals
//Declaring an 'empty' string
String StrRoman = "";
for(int x = 0; x < arabic.length; x++){ //From element 0 to the end of the array, keep going up
while(num>=arabic[x]){ //while num is greater/equal to numbers in the integer array
StrRoman+=roman[x]; //add the String array elements to the String variable
num-=arabic[x]; //subtract the numbers in the integer array from num
}//while---> does this again and again until num becomes zero
}//for
System.out.println();
System.out.println("The Roman Numeral is: " + StrRoman); //Prints out the Roman Numeral
System.out.println();
}//Converter
//The String array contains the corresponding roman numerals.
public static String[] roman = { "m", "cm", "d", "cd", "c", "xc", "l", "xl", "x", "ix",
"v", "iv", "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" };
public static boolean isValid;
public static boolean validNum(int num){ //Checks num for validity
if((num>0)&&(num<=MAX)){ //If num is within range of 0 and the 3999999
isValid = true; //It is valid
}
else if((num<0)||(num>MAX)){ //If num is not in range
System.out.println("ERROR: Not within range of 1 - 3,999,999.");
isValid = false; //It is not valid
}
else{
System.out.println("ERROR: Must be an integer value.");
isValid = false;
}
return isValid;
}//validNum
public static void Converter(int num){ //Converts the Arabic numbers into Roman Numerals
//Declaring an 'empty' string
String StrRoman = "";
for(int x = 0; x < arabic.length; x++){ //From element 0 to the end of the array, keep going up
while(num>=arabic[x]){ //while num is greater/equal to numbers in the integer array
StrRoman+=roman[x]; //add the String array elements to the String variable
num-=arabic[x]; //subtract the numbers in the integer array from num
}//while---> does this again and again until num becomes zero
}//for
System.out.println();
System.out.println("The Roman Numeral is: " + StrRoman); //Prints out the Roman Numeral
System.out.println();
}//Converter
//The String array contains the corresponding roman numerals.
public static String[] roman = { "m", "cm", "d", "cd", "c", "xc", "l", "xl", "x", "ix",
"v", "iv", "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" };
public static boolean isValid;
public static boolean validNum(int num){ //Checks num for validity
if((num>0)&&(num<=MAX)){ //If num is within range of 0 and the 3999999
isValid = true; //It is valid
}
else if((num<0)||(num>MAX)){ //If num is not in range
System.out.println("ERROR: Not within range of 1 - 3,999,999.");
isValid = false; //It is not valid
}
else{
System.out.println("ERROR: Must be an integer value.");
isValid = false;
}
return isValid;
}//validNum
public static void Converter(int num){ //Converts the Arabic numbers into Roman Numerals
//Declaring an 'empty' string
String StrRoman = "";
for(int x = 0; x < arabic.length; x++){ //From element 0 to the end of the array, keep going up
while(num>=arabic[x]){ //while num is greater/equal to numbers in the integer array
StrRoman+=roman[x]; //add the String array elements to the String variable
num-=arabic[x]; //subtract the numbers in the integer array from num
}//while---> does this again and again until num becomes zero
}//for
System.out.println();
System.out.println("The Roman Numeral is: " + StrRoman); //Prints out the Roman Numeral
System.out.println();
}//Converter
//The String array contains the corresponding roman numerals.
public static String[] roman = { "m", "cm", "d", "cd", "c", "xc", "l", "xl", "x", "ix",
"v", "iv", "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" };
public static boolean isValid;
public static boolean validNum(int num){ //Checks num for validity
if((num>0)&&(num<=MAX)){ //If num is within range of 0 and the 3999999
isValid = true; //It is valid
}
else if((num<0)||(num>MAX)){ //If num is not in range
System.out.println("ERROR: Not within range of 1 - 3,999,999.");
isValid = false; //It is not valid
}
else{
System.out.println("ERROR: Must be an integer value.");
isValid = false;
}
return isValid;
}//validNum
public static void Converter(int num){ //Converts the Arabic numbers into Roman Numerals
//Declaring an 'empty' string
String StrRoman = "";
for(int x = 0; x < arabic.length; x++){ //From element 0 to the end of the array, keep going up
while(num>=arabic[x]){ //while num is greater/equal to numbers in the integer array
StrRoman+=roman[x]; //add the String array elements to the String variable
num-=arabic[x]; //subtract the numbers in the integer array from num
}//while---> does this again and again until num becomes zero
}//for
System.out.println();
System.out.println("The Roman Numeral is: " + StrRoman); //Prints out the Roman Numeral
System.out.println();
}//Converter
}//Numeral
02-02-2006, 02:40 PM
Dale
It all makes sense now!
02-02-2006, 03:04 PM
Flip
good call on this one
02-05-2006, 03:47 PM
Afterburn
Being sick and help lifting a 250 lb. desk sucks.
02-05-2006, 04:10 PM
OpticoN
THIS TICKET ALLOWS YOU TO PURCHASE ONE TIE FOR THE PRICE OF TWO CONGRATULATIONS!