Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
java-e001
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
Juan Cristaldo
java-e001
Commits
b074d048
Commit
b074d048
authored
Sep 08, 2020
by
Juan Cristaldo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ejercicio 10 Realizado
parent
a171c156
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
0 deletions
+62
-0
JavaApplication/src/javaapplication/Ejercicio10.java
+62
-0
No files found.
JavaApplication/src/javaapplication/Ejercicio10.java
0 → 100644
View file @
b074d048
/*
* 10. Crea una aplicación que nos pida un día de la semana y que nos diga si es un dia
* laboral o no (“De lunes a viernes consideramos dias laborales”).
*/
package
javaapplication
;
import
java.util.Scanner
;
/**
*
* @author Juan Cristaldo
*/
public
class
Ejercicio10
{
public
static
void
main
(
String
[]
args
)
{
Scanner
entrada
=
new
Scanner
(
System
.
in
);
System
.
out
.
println
(
"***Operaciones de día laboral***"
);
System
.
out
.
println
(
"Ingrese un día de la semana: "
);
String
dia
=
entrada
.
nextLine
();
if
(
dia
.
equalsIgnoreCase
(
"Lunes"
)
||
dia
.
equalsIgnoreCase
(
"Martes"
)
||
dia
.
equalsIgnoreCase
(
"Miercoles"
)
||
dia
.
equalsIgnoreCase
(
"Jueves"
)
||
dia
.
equalsIgnoreCase
(
"Viernes"
))
{
System
.
out
.
printf
(
"El día %s, es un día laboral\n"
,
dia
);
}
else
if
(
dia
.
equalsIgnoreCase
(
"Sabado"
)
||
dia
.
equalsIgnoreCase
(
"Domingo"
)){
System
.
out
.
printf
(
"El dia %s no es un día laboral\n"
,
dia
);
}
else
{
System
.
err
.
printf
(
"El dato ingresado no es un día\n"
);
}
// También se pude hacer como el siguiente codigo pero me quedo con lo de arriba xD :)
// switch (dia){
// case "Lunes" :
// System.out.println("El día Lunes es un día laboral");
// break;
// case "Martes" :
// System.out.println("El día Martes es un día laboral");
// break;
// case "Miercoles" :
// System.out.println("El día Miercoles es un día laboral");
// break;
// case "Jueves" :
// System.out.println("El día Jueves es un día laboral");
// break;
// case "Viernes" :
// System.out.println("El día Viernes es un día laboral");
// break;
// case "Sabado" :
// System.out.println("El día Sabado no es un día laboral");
// break;
// case "Domingo" :
// System.out.println("El día Domingo no es un día laboral");
// break;
// default:
// System.err.printf("El dato ingresado no es un día\n");
// break;
// }
}
}
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