fork(1) download
  1. package numerosRomans;
  2.  
  3. /**
  4.  *
  5.  * @author Porque
  6.  */
  7. import java.util.Scanner;
  8. public class NumerosRomans {
  9. public static void main(String[] args) {
  10. Scanner in = new Scanner (System.in);
  11. System.out.print("Introdueix any(hasta año actual): ");
  12. int any= in.nextInt();
  13. int anyActual=2013;
  14. double cambio=0;
  15. while(any>anyActual){
  16. System.out.print("Introdueix any correcto: ");
  17. any= in.nextInt();
  18. }
  19. int i=String.valueOf(any).length();
  20. int cola=i;
  21. cambio=any;
  22. while(any!=0){
  23. while(i>=1){
  24. cambio=cambio/10;
  25. i--;
  26. }
  27. System.out.print("Numero Romano es:");
  28. i=0;
  29. int dec=1;
  30. int cola3=cola-1;
  31. while(i<=cola-1){
  32. cambio=cambio*10;
  33. int cola2=cola3;
  34. while(cola2-1>=0){
  35. dec=dec*10;
  36. cola2--;
  37. }
  38. cola3--;
  39. int rok=(int)cambio;
  40. cambio=cambio-rok;
  41. rok=rok*dec;
  42. dec=1;
  43. int rotation=0;
  44. System.out.println("rok: "+rok);
  45. if(rok>=1000){
  46. rotation=rok/1000;
  47. while(rotation>=1){
  48. System.out.print("M");
  49. rotation--;
  50. }
  51. }
  52. else if(rok==900){
  53. System.out.print("CM");
  54. }
  55. else if(rok>=500 && rok<900){
  56. int rotation2=rok/100;
  57. System.out.println(rotation2);
  58. System.out.print("D");
  59. while(rotation2>=5){
  60. System.out.print("C");
  61. rotation2--;
  62. }
  63. }
  64. i++;
  65. }
  66. any=0;
  67.  
  68. System.out.println();
  69. }
  70. }
  71. }
  72.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:8: error: class NumerosRomans is public, should be declared in a file named NumerosRomans.java
public class NumerosRomans {
       ^
1 error
stdout
Standard output is empty