Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wu-e002
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jose Figueredo
wu-e002
Commits
3c665578
Commit
3c665578
authored
Sep 04, 2020
by
Jose Figueredo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Detalles arreglados
parent
1f050df5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
7 deletions
+42
-7
VacasToros.java
+42
-7
No files found.
VacasToros.java
View file @
3c665578
...
@@ -23,7 +23,23 @@ public class VacasToros {
...
@@ -23,7 +23,23 @@ public class VacasToros {
}
}
public
VacasToros
(){
this
.
numero
=
null
;
}
public
void
NumeroAdivinar
(
String
n
){
this
.
numero
=
n
;
a
=
n
.
toCharArray
();
// verificar(a); esta demas
}
public
boolean
verificar
(
char
a
[]){
public
boolean
verificar
(
char
a
[]){
int
bandera
=
0
;
int
bandera
=
0
;
for
(
int
i
=
0
;
i
<
4
;
i
++)
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
{
...
@@ -55,6 +71,12 @@ public class VacasToros {
...
@@ -55,6 +71,12 @@ public class VacasToros {
}
}
public
boolean
verificar
(
String
c
){
public
boolean
verificar
(
String
c
){
if
(
c
.
length
()!=
4
){
System
.
out
.
println
(
"El nro debe tener 4 digitos"
);
return
false
;
}
char
d
[]=
new
char
[
4
];
char
d
[]=
new
char
[
4
];
for
(
int
i
=
0
;
i
<
4
;
i
++)
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
{
...
@@ -145,15 +167,24 @@ public static void main(String[] args) {
...
@@ -145,15 +167,24 @@ public static void main(String[] args) {
Scanner
teclado
=
new
Scanner
(
System
.
in
);
Scanner
teclado
=
new
Scanner
(
System
.
in
);
String
a
=
teclado
.
nextLine
()
;
String
a
;
// String b= teclado.nextLine();
// String b= teclado.nextLine();
VacasToros
juego
=
new
VacasToros
(
a
);
VacasToros
juego
=
new
VacasToros
();
int
intento
=
0
;
int
intento
=
0
;
String
b
;
String
b
;
if
(
juego
.
verificar
(
a
))
do
{
{
System
.
out
.
println
(
"Ingrese el nro que adivinara el jugador B"
);
a
=
teclado
.
nextLine
();
juego
.
verificar
(
a
);
}
while
(
!
juego
.
verificar
(
a
));
juego
.
NumeroAdivinar
(
a
);
do
do
{
{
intento
++;
intento
++;
...
@@ -165,17 +196,21 @@ public static void main(String[] args) {
...
@@ -165,17 +196,21 @@ public static void main(String[] args) {
}
while
(!
juego
.
Fin
()
&&
intento
<
=
12
);
}
while
(!
juego
.
Fin
()
&&
intento
<
12
);
if
(
intento
>
12
)
if
(!
juego
.
Fin
())
{
System
.
out
.
println
(
"Se acabaron los intentos,El ganador es A , el numero era: "
+
a
);
System
.
out
.
println
(
"Se acabaron los intentos,El ganador es A , el numero era: "
+
a
);
else
}
else
{
System
.
out
.
println
(
"El ganador es B con "
+
intento
+
" intentos"
);
System
.
out
.
println
(
"El ganador es B con "
+
intento
+
" intentos"
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment