Traditional Culture Encyclopedia - Weather forecast - Java weather query
Java weather query
Public class to Chinese {
Public static void main(String[] args) {
//Instantiate the scanner
Scanner sc = new scanner (system. in);
//Prompt the user for input
System.out.println ("Please enter the weather initials (d, m, r, S)");");
//receive
string weather = sc . next();
//Call the method to be converted.
String chinese=toCn (weather);
//output
System.out.print (Chinese);
}
//Method of converting Chinese
Public static string toCn (string weather)
{
//D stands for drying.
if(weather.equals("D "))
{
Return to "dry";
}
else if(weather.equals("M "))
{
Return to "wet";
}
else if(weather.equals("R "))
{
Return to Rainy Days;
}
else if(weather.equals("S "))
{
Return to Sunny Day;
}
other
{
Return "You entered it incorrectly!" ;
}
}
}
- Previous article:Good morning, sexy love words, high emotional intelligence short sentence 2022
- Next article:Monday to Sunday short sentences
- Related articles
- The weather in the last ten days
- Tiny Age 3.0 Golden Age July Serial
- I want to go to Baihua Mountain in Mentougou this week.
- Today's weather forecast for Macao
- Tour guide words of Tibet Lianbaoye Zeshenshan Tianhu Group
- How did hurricanes form in the United States?
- 3 17 Tibet Introduction 3 17 Tibet Entry Route
- How are the five districts of Shijiazhuang (Chang 'an District, Yuhua District, Qiaodong District, qiaoxi district District and Xinhua District) divided?
- What is the function of Momo vip?
- What time is there a boat from Zhuanghe to Wang Jiadao every day? How much is the charge?