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

Se agregan las prácticas 6 - 14 #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/src/main/java/ralvhe/practices/06-ObjectsClasses_Practice1/build/
/src/main/java/ralvhe/practices/06-ObjectsClasses_Practice1/nbproject/private/
/src/main/java/ralvhe/practices/06-ObjectsClasses_Practice2/06-ObjectsClasses_Practice2/build/
/src/main/java/ralvhe/practices/06-ObjectsClasses_Practice2/06-ObjectsClasses_Practice2/nbproject/private/
/src/main/java/ralvhe/practices/07-ManipulateFormat_Practice1/build/
/src/main/java/ralvhe/practices/07-ManipulateFormat_Practice1/nbproject/private/
/src/main/java/ralvhe/practices/08-Methods_Practice1/build/
/src/main/java/ralvhe/practices/08-Methods_Practice1/nbproject/private/
/src/main/java/ralvhe/practices/08-Methods_Practice2/build/
/src/main/java/ralvhe/practices/08-Methods_Practice2/nbproject/private/
/src/main/java/ralvhe/practices/08-Methods_Practice3/build/
/src/main/java/ralvhe/practices/08-Methods_Practice3/nbproject/private/
/src/main/java/ralvhe/practices/09-EncapConstructors_Practice1/build/
/src/main/java/ralvhe/practices/09-EncapConstructors_Practice1/nbproject/private/
/src/main/java/ralvhe/practices/09-EncapConstructors_Practice2/build/
/src/main/java/ralvhe/practices/09-EncapConstructors_Practice2/nbproject/private/
/src/main/java/ralvhe/practices/10-Conditions_Practice1/build/
/src/main/java/ralvhe/practices/10-Conditions_Practice1/nbproject/private/
/src/main/java/ralvhe/practices/10-Conditions_Practice2/build/
/src/main/java/ralvhe/practices/10-Conditions_Practice2/nbproject/private/
/src/main/java/ralvhe/practices/11-ArraysLoopsDates_Practice1/build/
/src/main/java/ralvhe/practices/11-ArraysLoopsDates_Practice1/nbproject/private/
/src/main/java/ralvhe/practices/11-ArraysLoopsDates_Practice2/build/
/src/main/java/ralvhe/practices/11-ArraysLoopsDates_Practice2/nbproject/private/
/src/main/java/ralvhe/practices/12-UsingInheritance_Practice1/build/
/src/main/java/ralvhe/practices/12-UsingInheritance_Practice1/nbproject/private/
/src/main/java/ralvhe/practices/12-UsingInheritance_Practice2/build/
/src/main/java/ralvhe/practices/12-UsingInheritance_Practice2/nbproject/private/
/src/main/java/ralvhe/practices/13-UsingInterfaces_Practice1/build/
/src/main/java/ralvhe/practices/13-UsingInterfaces_Practice1/nbproject/private/
/src/main/java/ralvhe/practices/13-UsingInterfaces_Practice2/build/
/src/main/java/ralvhe/practices/13-UsingInterfaces_Practice2/nbproject/private/
/src/main/java/ralvhe/practices/13-UsingInterfaces_Practice3/build/
/src/main/java/ralvhe/practices/13-UsingInterfaces_Practice3/nbproject/private/
/src/main/java/ralvhe/practices/14-Exceptions_Practice1/build/
/src/main/java/ralvhe/practices/14-Exceptions_Practice1/nbproject/private/
4 changes: 4 additions & 0 deletions src/main/java/ralvhe/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.class
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Este archivo debe de ir en la raiz del proyecto

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checa la siguiente pagina para mas informacion: https://help.github.com/articles/ignoring-files/

*.xml
*.properties
*.mf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package soccer;

/**
*
* @author ralhe
*/
public class Game {
public Team homeTeam;
public Team awayTeam;
public Goal[] goals;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package soccer;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

la estructura del paquete debería ser algo como lo que sigue:
package ralvhe.practices.practice_06_objectsclasses_1.soccer;
verificar las clases y hacer el ajuste de paquetes


/**
*
* @author ralhe
*/
public class Goal {
public Team theTeam;
public Player thePlayer;
public double theTime;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package soccer;

/**
*
* @author ralhe
*/
public class League {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Player player1 = new Player();
player1.playerName = "George Eliot";
Player player2 = new Player();
player2.playerName = "Graham Greene";
Player player3 = new Player();
player3.playerName = "Geoffrey Chaucer";
Player[] thePlayers = {player1,player2,player3};
Team team1 = new Team();
team1.teamName = "The Greens";
team1.playerArray = thePlayers;
player1.playerName = "Robert Service";

Team team2 = new Team();
team2.teamName = "The Reds";
team2.playerArray = new Player[3];
team2.playerArray[0] = new Player();
team2.playerArray[0].playerName = "Robert Service";
team2.playerArray[1] = new Player();
team2.playerArray[1].playerName = "Robbie Burns";
team2.playerArray[2] = new Player();
team2.playerArray[2].playerName = "Rafael Sabatini";

for(Player thePlayer:team1.playerArray){
System.out.println(thePlayer.playerName);
}

for(Player thePlayer : team2.playerArray){
System.out.println(thePlayer.playerName);
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package soccer;

/**
*
* @author ralhe
*/
public class Player {
public String playerName;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package soccer;

/**
*
* @author ralhe
*/
public class Team {
public String teamName;
public Player[] playerArray;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package soccer;

/**
*
* @author Administrator
*/
public class Game {

public Team homeTeam;
public Team awayTeam;
public Goal[] goals;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package soccer;

/**
*
* @author Administrator
*/
public class Goal {

public Team theTeam;
public Player thePlayer;
public double theTime;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package soccer;

/**
*
* @author Administrator
*/
public class League {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {

// Create team1
Player player1 = new Player();
player1.playerName = "George Eliot";
Player player2 = new Player();
player2.playerName = "Graham Greene";
Player player3 = new Player();
player3.playerName = "Geoffrey Chaucer";
Player[] thePlayers = {player1, player2, player3 };

Team team1 = new Team();
team1.teamName = "The Greens";
team1.playerArray = thePlayers;


// Create team2
Team team2 = new Team();
team2.teamName = "The Reds";
team2.playerArray = new Player[3];
team2.playerArray[0] = new Player();
team2.playerArray[0].playerName = "Robert Service";
team2.playerArray[1] = new Player();
team2.playerArray[1].playerName = "Robbie Burns";
team2.playerArray[2] = new Player();
team2.playerArray[2].playerName = "Rafael Sabatini";

Game currGame = new Game();
currGame.awayTeam = team1;
currGame.homeTeam = team2;

Goal goal1 = new Goal();
goal1.thePlayer = currGame.homeTeam.playerArray[2];
goal1.theTeam = currGame.homeTeam;
goal1.theTime = 55;

Goal[] theGoals = {goal1};
currGame.goals = theGoals;

System.out.println("Goal scored after " + currGame.goals[0].theTime + " mins by " + currGame.goals[0].thePlayer.playerName + " of " +currGame.goals[0].theTeam.teamName);

/* Practice 6-2. Create a Game here */

/* Practice 6-2. Create a Goal object here */

/* Practice 6-2. Put Goal object in a Goal array and assign Goal array to goals attribute of Game object */

/* Practice 6-2. Print out the score of the Game */



}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package soccer;

/**
*
* @author Administrator
*/
public class Player {

public String playerName;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package soccer;

/**
*
* @author Administrator
*/
public class Team {

public String teamName;
public Player[] playerArray;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package soccer;

/**
*
* @author Administrator
*/
public class Game {

public Team homeTeam;
public Team awayTeam;
public Goal[] goals;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package soccer;

/**
*
* @author Administrator
*/
public class Goal {

public Team theTeam;
public Player thePlayer;
public double theTime;

}
Loading