MisterCarenioso.findtalk.biz

This is a Free and Open Source Forum that allows student to Copy and Use the Codes Embeded.Please keep This Site Secretly as Much as Possible do not Share This Site to anyone.Thank you By: MisterCarenioso.
 
HomeCalendarFAQSearchMemberlistUsergroupsRegisterLog in

Share | 
 

 Programming (CaseStudy)

View previous topic View next topic Go down 
AuthorMessage
Admin
Admin


Posts: 67
Join date: 2009-11-24
Age: 20
Location: Philippines

PostSubject: Programming (CaseStudy)   Sat Nov 28, 2009 2:38 am

import java.io.*;
class caseStudy{
public static void main(String []args)throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader (System.in));

int choice;
System.out.println("Select Menu Here !!!");
System.out.println("1 - Arabic Format to Roman Numeral");
System.out.println("2 - Roman Numeral to Arabic Format");
System.out.println("0 - Quit ") ;
System.out.print("Choice:");
choice=Integer.parseInt(br.readLine());


switch(choice){


case 0 :{
System.out.println("Thank You");
break;
}


case 1: {
int entered;

System.out.println("You have selected Arabic Format to Roman Numeral");
System.out.print("Enter a Number : ");
entered=Integer.parseInt(br.readLine());

System.out.println();

String[] toRomanFormat = {"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};
int[] RomanNumber={1000,900,500,400,100,90,50,40,10,9,5,4,1};
String num="";

do {
for (int n=0;n<toRomanFormat.length;++n){

if (entered>=RomanNumber[n]){
entered = entered - RomanNumber[n];
num = num + toRomanFormat[n];
break;
}
}
}while(entered>0);
System.out.print(num);
break;
}

case 2: {
String entered;

System.out.println("You have selected Roman Numeral to Arabic Format");
System.out.print("Enter a Roman Numeral : ");
entered=br.readLine();

System.out.println();

String[] toArabicFormat = {"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};
int[] ArabicNumber={1000,900,500,400,100,90,50,40,10,9,5,4,1};
String num="";

for(int n=0;n<toArabicFormat.length;n++){

if (n>=ArabicNumber[n]){

}


}


}


}


}
}
Back to top Go down
View user profile http://mistercarenioso.findtalk.biz
 

Programming (CaseStudy)

View previous topic View next topic Back to top 
Page 1 of 1

 Similar topics

-
» C++ programming vol:1
» Stanford Computer Programming I, II and II (OCW)
» You've been programming too long when
» DNA as a programming language
» Batch File Programming

Permissions in this forum:You cannot reply to topics in this forum
MisterCarenioso.findtalk.biz :: Your first category :: Your first forum-