×
- 코드 및 콘솔 화면은 [ code ] 내용 [ /code ] 태그 처리하여 주세요.
- 강조하고자 하는 내용은 [ b ] 내용 [ /b ] 태그 처리하여 주세요.
- 강조하고자 하는 내용은 [ b ] 내용 [ /b ] 태그 처리하여 주세요.
자바 코드 작성 오류 .. 도와주세요 ㅠㅠ
-
ans312
(먀먕이97) - 이 글의 작성자
- Offline
- Newbie
덜보기
더보기
- Posts: 1
- Thank you received: 0
11 Apr 2019 23:09 #4552
작성자: ans312
ans312 님의 글: 자바 코드 작성 오류 .. 도와주세요 ㅠㅠ
월 하나를 예를들어 March를 입력햇을때 March가 아닌 march나 MaRch 등 대소문자가 섞여있어도 "봄입니다"가 나와야하는 건데요..
안되네요 ㅠㅠ 뭐가 잘못 된 거 일까요 ..?
import java.util.Scanner;
public class NumericTypeTest {
private static final char [] MtoS = null;
static void UpperCase(char [] month) {
for(int i = 0; i < month.length; i++)
if (month >= 'a' && month<='z')
month = (char)(month-('a'-'A'));
}
static void LowerCase(char [] month) {
for(int i = 0; i < month.length; i++)
if( month >= 'A' && month<='Z')
month = (char)(month+('a'-'A'));
}
static void printCharArray(char [] month) {
for(int i = 0; i < month.length; i++)
System.out.print( month);
System.out.println();
}
public static void main(String args[])
{
Scanner stdin = new Scanner(System.in);
System.out.print("월을 입력하세요(영문자) : ");
String month = stdin.next();
String MtoS;
switch (month)
{
case "December":
case "January":
case "February":
MtoS = "겨울입니다.";
break;
case "March":
case "April":
case "May":
MtoS = "봄입니다.";
break;
case "June":
case "July":
case "August":
MtoS = "여름입니다.";
break;
case "September":
System.out.print("멋진 9월과 ");
case "October":
System.out.print("아름다운 10월과 ");
case "November":
System.out.print("낙엽의 11월은 ");
MtoS = "가을입니다.";
break;
default:
MtoS = "1~12월을 벗어난 달입니다.";
break;
}
System.out.println(MtoS);
stdin.close();
}
}
안되네요 ㅠㅠ 뭐가 잘못 된 거 일까요 ..?
import java.util.Scanner;
public class NumericTypeTest {
private static final char [] MtoS = null;
static void UpperCase(char [] month) {
for(int i = 0; i < month.length; i++)
if (month >= 'a' && month<='z')
month = (char)(month-('a'-'A'));
}
static void LowerCase(char [] month) {
for(int i = 0; i < month.length; i++)
if( month >= 'A' && month<='Z')
month = (char)(month+('a'-'A'));
}
static void printCharArray(char [] month) {
for(int i = 0; i < month.length; i++)
System.out.print( month);
System.out.println();
}
public static void main(String args[])
{
Scanner stdin = new Scanner(System.in);
System.out.print("월을 입력하세요(영문자) : ");
String month = stdin.next();
String MtoS;
switch (month)
{
case "December":
case "January":
case "February":
MtoS = "겨울입니다.";
break;
case "March":
case "April":
case "May":
MtoS = "봄입니다.";
break;
case "June":
case "July":
case "August":
MtoS = "여름입니다.";
break;
case "September":
System.out.print("멋진 9월과 ");
case "October":
System.out.print("아름다운 10월과 ");
case "November":
System.out.print("낙엽의 11월은 ");
MtoS = "가을입니다.";
break;
default:
MtoS = "1~12월을 벗어난 달입니다.";
break;
}
System.out.println(MtoS);
stdin.close();
}
}
Time to create page: 0.050 seconds
- 현재 위치:
- 홈
- Forum
- 메인 게시판
- Question and Answer
- 자바 코드 작성 오류 .. 도와주세요 ㅠㅠ