image.pn
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
String a=sc.next(),b=sc.next(),c=sc.next();
String res;
if("vertebrado".equals(a)){
if("mamifero".equals(b)){
if("onivoro".equals(c)){
res="homem";
}
else{
res="vaca";
}
}
else{
if("carnivoro".equals(c)){
res="aguia";
}
else{
res="pomba";
}
}
}
else{
if("inseto".equals(b)){
if("hematofago".equals(c)){
res="pulga";
}
else{
res="lagarta";
}
}
else{
if("hematofago".equals(c)){
res="sanguessuga";
}
else{
res="minhoca";
}
}
}
System.out.println(res);
}
}
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int a=sc.nextInt(),b=sc.nextInt();
int c=sc.nextInt(),d=sc.nextInt();
if(b>c&&d>a&&c+d>a+b&&c>0&&d>0&&a%2==0){
System.out.println("Valores aceitos");
}
else{
System.out.println("Valores nao aceitos");
}
}
}
~~~java
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
switch(n)
{
case 61:
System.out.println("Brasilia");
break;
case 71:
System.out.println("Salvador");
break;
case 11:
System.out.println("Sao Paulo");
break;
case 21:
System.out.println("Rio de Janeiro");
break;
case 32:
System.out.println("Juiz de Fora");
break;
case 19:
System.out.println("Campinas");
break;
case 27:
System.out.println("Vitoria");
break;
case 31:
System.out.println("Belo Horizonte");
break;
default:
System.out.println("DDD nao cadastrado");
break;
}
}
}
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
double x=sc.nextDouble(),y=sc.nextDouble();
if(x>0&&y>0){
System.out.println("Q1");
}
else if(x<0&&y>0){
System.out.println("Q2");
}
else if(x<0&&y<0){
System.out.println("Q3");
}
else if(x>0&&y<0){
System.out.println("Q4");
}
else if(x==0&&y!=0){
System.out.println("Eixo Y");
}
else if(x!=0&&y==0){
System.out.println("Eixo X");
}
else{
System.out.println("Origem");
}
}
}
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
double a=sc.nextDouble(),b=sc.nextDouble(),c=sc.nextDouble();
if (a < b) {
double t = a;
a = b;
b = t;
}
if (a < c) {
double t = a;
a = c;
c = t;
}
if (b < c) {
double t = b;
b = c;
c = t;
}
if (a >= b + c)
System.out.println("NAO FORMA TRIANGULO");
else {
if (a * a == b * b + c * c)
System.out.println("TRIANGULO RETANGULO");
if (a * a > b * b + c * c)
System.out.println("TRIANGULO OBTUSANGULO");
if (a * a < b * b + c * c)
System.out.println("TRIANGULO ACUTANGULO");
if (a == b && b == c)
System.out.println("TRIANGULO EQUILATERO");
else if (a == b || b == c || c == a)
System.out.println("TRIANGULO ISOSCELES");
}
}
}
标签:Java,Scanner,System,else,sc,println,打卡,out
From: https://www.cnblogs.com/gyg1222/p/17353548.html