0% found this document useful (0 votes)
25 views4 pages

Escuela Profesional de Ingeniería de Sistemas

The document contains code for a card game simulation that defines classes for a deck of cards, players, and card distribution. It includes methods for shuffling the deck, dealing cards to players, and displaying the cards in the deck and those dealt to each player. The main method initializes a deck, shuffles it, deals cards to two players named "ElPueblo" and "Ana", and displays the cards dealt to each player.

Uploaded by

Crystal Woodward
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views4 pages

Escuela Profesional de Ingeniería de Sistemas

The document contains code for a card game simulation that defines classes for a deck of cards, players, and card distribution. It includes methods for shuffling the deck, dealing cards to players, and displaying the cards in the deck and those dealt to each player. The main method initializes a deck, shuffles it, deals cards to two players named "ElPueblo" and "Ana", and displays the cards dealt to each player.

Uploaded by

Crystal Woodward
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

ESCUELA PROFESIONAL

DE INGENIERA DE
SISTEMAS
ELECTRO MAGNETISMO
EJERCICIOS DE CARGA
ELCTRICA Y RESISTENCIA
ING. SISTEMAS
ALUMNO:
CHURA SANO ALVARO



Arequip!Per"
#$%&
import java.util.*;
public class Baraja {
private static ArrayList<Carta> lascartas = new
ArrayList<Carta>();
private static String [] palos={"cra!n"s"#"$ia%ant"
"#""s&a$a"#"tr"'l"(;
private ArrayList<)uga$r> "ljuga$r = new ArrayList<)uga$r>();
private ArrayList<Carta> r"&art*= new ArrayList<Carta>();
private ArrayList<Carta> r"&art+= new ArrayList<Carta>();
public Baraja(){
CrearCarta();
(
public static void Cr"arCarta(){
for (int i = ,; i < -; i..) {
for(int j=*;j<=*/ ; j..){
lascartas.a$$(new Carta(j#palos[i]));
(
(
(
public void Baraj"ar(){
0an$% ran$ = new 0an$%();
for(int i=,; i</; i..)
for(int j=,; j<+1; j..){
int in$"2&ri%"raCarta = ran$.n"2t3nt(+1);
int in$"2s"gun$aCarta = ran$.n"2t3nt(4+);
Carta t"%& =
lascartas.g"t(in$"2&ri%"raCarta);
lascartas.s"t(in$"2&ri%"raCarta#
lascartas.g"t(in$"2s"gun$aCarta));
lascartas.s"t(in$"2s"gun$aCarta# t"%&);
(
(
public void 0"&artir(){
0an$% ran = new 0an$%();
55ArrayList<Carta> r"&art = n"6 ArrayList<Carta>();
for (int i = ,; i < -; i..) {
int 7u%"rala!ar = ran.n"2t3nt(4+8i);
Carta t"%&*=lascartas.r"%v"(7u%"rala!ar);
r"&art*.a$$(t"%&*);
(
(
public void 0"&artir+(){
0an$% ran = new 0an$%();
for (int i = ,; i < -; i..) {
int 7u%"rala!ar = ran.n"2t3nt(4+8i);
Carta t"%&*=lascartas.r"%v"(7u%"rala!ar);
r"&art+.a$$(t"%&*);
((
public void 9strarCartas(){
for (Carta %isCartas :lascartas) {
%isCartas.9strar();
(
(
public void 9strar0"&artr(){
for(Carta r"* : r"&art*){
r"*.9strar();
(
(
public void 9strar0"&arr+(){
for(Carta r"+ : r"&art+){
r"+.9strar();
(
(
(
public class Carta {
private int nu%"r;
private String &al;
private String Clr;
public Carta(){
(
public Carta(int n #String &){
nu%"r =n;
55s"t7u%"r(n);
&al=&;
(
public void s"t7u%"r(int nu%){
55i;(nu%>=*<<nu%<=*/)
55nu%"r=nu%;
55"ls"
55nu%"r=,;
(
public int g"t7u%"r(){
return nu%"r;
(
public String g"t=al(){
return &al;
(
public void 9strar(){
Syst"%.out.&rintln(nu%"r." $" " . &al);
(
(
import java.util.*;
public class )uga$r {
private String na%";
private final static int NumeroArepartir=-;
public )uga$r(){
(
public )uga$r(String n){
na%" = n;
(
public String g"t7a%"(){
return na%";
(
public void 9strar)uga$r(){
Syst"%.out.&rintln(">l juga$r :" .na%");
(
(
import java.util.*;
public class )u"gCarta {
public static void %ain(String[] args) {
Baraja lascartas= new Baraja();
lascartas.Baraj"ar();
lascartas.9strarCartas();
Syst"%.out.&rintln(" ");
)uga$r &ri%"r = new )uga$r(?;"l&u$"nci");
&ri%"r.9strar)uga$r();
lascartas.0"&artir();
lascartas.9strar0"&artr();
Syst"%.out.&rintln(" ");
)uga$r s"gun$=new )uga$r("ana");
s"gun$.9strar)uga$r();
lascartas.0"&artir+();
lascartas.9strar0"&arr+();
(
(

You might also like