Traditional Culture Encyclopedia - Weather inquiry - Intelligent weather query java
Intelligent weather query java
Public? Class? The weather? {
Public? Static electricity String? getWeatherInChinese(char? c)? {
Switch? (3)? {
Case? d ':
Return? "drying";
Case? m ':
Return? "wet"
Case? h ':
Return? "hot";
Case? r ':
Return? "rain"
Default value:
Return? "Input error, unable to convert";
}
}
Public? Static electricity Invalid? main(String[]? args)? {
Bull? Pending? =? True;
Do what? {
System.out.print ("Please enter the first English letter of the weather:");
Scanner? Scanner? =? New? Scanner (system. in);
String? Input? =? scanner.next()。 trim();
What if? (input.length()? ! =? 1)? {
System.out.println ("input error, unable to convert!" );
}? Or what? {
system . out . println(getWeatherInChinese(input . charat(0)));
}
System.out.print ("Do you want to continue? (y/n)");
String? sta? =? scanner . next();
Pending? =? sta.equals("y ")? Really? :? Fake;
}? What time? (to be determined);
System.out.println ("Exit the system!" );
}
} Run the screenshot:
- Previous article:English composition for the second grade of junior high school
- Next article:What causes the cockscomb to turn purple?
- Related articles
- When is the best time to play Maoer Hutong?
- Can Gaudi record the trajectory?
- Excellent composition of Baicao Garden
- Beautiful poems in winter morning
- How do girls who like to wear boots look better?
- The weather is dry and it is easy to get many diseases. What are the eight high-risk diseases that health tips can prevent?
- 10 Is it cold in Kashgar?
- What should I wear when going to Changbai Mountain in mid-September?
- Hai Lufeng's Folk Art
- What's the matter with cold weather and endless urine?