Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dont know some git issues i dont fully understand #53

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,15 @@
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
<filteredResources>
<filter>
<id>1676329080234</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
4 changes: 4 additions & 0 deletions .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/test/java=UTF-8
encoding/<project>=UTF-8
7 changes: 7 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"configurations": [
{
"type": "java",
"name": "Launch App",
"request": "launch",
"mainClass": "com.dsa.app.App",
"projectName": "my-app"
},
{
"type": "java",
"name": "Launch App",
Expand Down
9 changes: 9 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"version": "0.2",
"ignorePaths": ["src"],
"dictionaryDefinitions": [],
"dictionaries": [],
"words": [],
"ignoreWords": [],
"import": []
}
7 changes: 7 additions & 0 deletions src/main/java/com/dsa/app/AnioBisiesto.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.dsa.app;

public class AnioBisiesto{
public static boolean esBisiesto(int anio){
return (anio % 4 == 0 && anio % 400 == 0);
}
}
21 changes: 21 additions & 0 deletions src/main/java/com/dsa/app/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*----------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE in the project root for license information.
*---------------------------------------------------------------------------------------*/

package com.dsa.app;

public class App {
public static void main(String[] args) {
// System.out.println("Hello Remote World!");
// System.out.println(Factorial.getFactorial(5));
// System.out.println(NumeroFuerte.esNumeroFuerte(145));
// System.out.println(Primo.esPrimo(4));
// StarLadder.buildLadder(5);
Racional a = new Racional(7,9);
Racional suma = a.suma(new Racional(7,8));
System.out.println(suma.getString());
// a.getString();

}
}
14 changes: 14 additions & 0 deletions src/main/java/com/dsa/app/Factorial.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.dsa.app;


public class Factorial {
public static int getFactorial(int n){
if(n < 1){throw new Error();}
int i = 1, fact = 1;
while(i<=n){
fact *= i;
i++;
}
return fact;
}
}
15 changes: 15 additions & 0 deletions src/main/java/com/dsa/app/NumeroFuerte.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.dsa.app;

/**
* NumeroFuerte
*/
public class NumeroFuerte {
public static boolean esNumeroFuerte(int n){
int original = n, sum = 0;
while(n >= 1){
sum += Factorial.getFactorial(n%10);
n /= 10;
}
return original == sum;
}
}
14 changes: 14 additions & 0 deletions src/main/java/com/dsa/app/Primo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.dsa.app;

public class Primo {
public static boolean esPrimo(int n){
int i = 2;
if(n < i){return false;}
while(i < n/2+1 ){
if(n % i == 0)
return false;
i++;
}
return true;
}
}
27 changes: 27 additions & 0 deletions src/main/java/com/dsa/app/Racional.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.dsa.app;

public class Racional {
int num;
int den;
public Racional(){
this.num = 1;
this.den = 1;
}
public Racional(int num, int den){
this.num = num;
this.den = den;
}

public Racional suma(Racional a){
return new Racional(this.num*a.den + this.den*a.num, this.den*a.den);
}

public static Racional resta(Racional a, Racional b){
return new Racional(a.num*b.den - a.den * b.num, a.den * b.den);
}

public String getString(){
String string = new String(this.num + "/" + this.den);
return string;
}
}
39 changes: 39 additions & 0 deletions src/main/java/com/dsa/app/StarLadder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.dsa.app;

public class StarLadder {
public static void buildLadder(int n){
for (int i = 0; i < n; i++) {
for (int j = 0; j < n-i; j++) {
System.out.print("*");
}
System.out.println();
}

for (int i = 0; i < n; i++) {
for (int j = 1; j < n-i; j++) {
System.out.print(" ");
}
for (int j = 0; j < i+1; j++) {
System.out.print("*");
}
System.out.println();
}

for (int i = 0; i < n; i++) {
for (int j = 0; j < i+1; j++) {
System.out.print("*");
}
System.out.println();
}

for (int i = 0; i < n; i++) {
for (int j = 0; j < i; j++) {
System.out.print(" ");
}
for (int j = 0; j < n-i; j++) {
System.out.print("*");
}
System.out.println();
}
}
}
12 changes: 0 additions & 12 deletions src/main/java/com/mycompany/app/App.java

This file was deleted.