This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Problema_OMA_3 { | |
/** | |
* @param args | |
*/ | |
public static void main(String[] args) { | |
/* | |
a) ¿Cuántos números formados exclusivamente por los dígitos 3 y 7, y divisibles por 3 y por 7, son menores a 100000? | |
b) ¿Cuántos números formados exclusivamente por los dígitos 3 y 7, y divisibles por 3 y por 7, son menores a 100000000?*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. | |
Find the sum of all the multiples of 3 or 5 below 1000. */ | |
public class Problema_EULER_1{ | |
public static void main (String[] args) { | |
int sum_3 = 0, | |
sum_5 = 0; | |
for (int x =1; x<=1000; x++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Solution { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
System.out.println("================================"); | |
for(int i = 0; i < 3; i++) { | |
String s1 = sc.next(); | |
int x = sc.nextInt(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Solution { | |
public static void main(String[] args) { | |
Scanner sc=new Scanner(System.in); | |
System.out.println("================================"); | |
for(int i=0;i<3;i++) | |
{ | |
String s1=sc.next(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.LocalDateTime; | |
import java.time.format.DateTimeFormatter; | |
public class Item { | |
private String name; | |
private LocalDateTime createdAt; | |
public Item(String name) { | |
this.name = name; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
src/main/java/IsItInTheFile.java | |
import java.nio.file.Paths; | |
import java.util.Scanner; | |
public class IsItInTheFile { | |
public static void main(String[] args) { | |
Scanner scanner = new Scanner(System.in); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int[] addOneIntToArray(int[] initialArray , int newValue) { | |
int[] newArray = new int[initialArray.length + 1]; | |
for (int index = 0; index < initialArray.length; index++) { | |
newArray[index] = initialArray[index]; | |
} | |
newArray[newArray.length - 1] = newValue; | |
return newArray; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// we create a scanner for reading the file | |
try (Scanner scanner = new Scanner(Paths.get("henkilot.csv"))) { | |
// we read all the lines of the file | |
while (scanner.hasNextLine()) { | |
String line = scanner.nextLine(); | |
// if the line is blank we do nothing | |
if (line.isEmpty()) { | |
continue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try (Scanner scanner = new Scanner(Paths.get("records.txt"))) { | |
while (scanner.hasNextLine()) { | |
String line = scanner.nextLine(); | |
String[] parts = line.split(","); | |
String name = parts[0]; | |
int age = Integer.valueOf(parts[1]); | |
System.out.println("Name: " + name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Solution for part05-Part05_01.OneMinute | |
src/main/java/ClockHand.java | |
public class ClockHand { | |
private int value; | |
private int limit; | |
public ClockHand(int limit) { | |
this.limit = limit; |
OlderNewer