[Java] ํ‚ค๋ณด๋“œ์—์„œ ์ž…๋ ฅ๋œ ๋ฌธ์ž์—ด์„ ์ •์ˆ˜๋กœ ๋ฐ”๊พผ ๋’ค ๊ทธ ๊ฐ’์˜ ์ดํ•ฉ๊ณผ ํ‰๊ท  ๊ตฌํ•˜๊ธฐ

2021. 3. 8. 20:53ใ†๊ฐœ๋… ์ •๋ฆฌ ์ž‘์—…์‹ค/Java

728x90
๋ฐ˜์‘ํ˜•

์•ˆ๋…•ํ•˜์„ธ์š”? ์ฃผ๋‹ˆํ•˜๋ž‘ ์ž…๋‹ˆ๋‹ค.

03์›” 08์ผ ์ˆ™์ œ๋ฅผ ์˜ค๋Š˜์—์„œ์•ผ ํ’€ ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค ใ…  ๋„˜๋‚˜ ์–ด๋ ค์šด ์ž๋ฐ”

์ œ๊ฐ€ ํ˜ผ์ž์„œ ์ณ ๋ณธ ๊ธฐ๋…์œผ๋กœ ์—ฌ๋Ÿฌ๋ถ„๋“ค๊ณผ ํ•จ๊ป˜ ๋‚˜๋ˆ„๊ณ  ์‹ถ์–ด ์˜ฌ๋ฆฝ๋‹ˆ๋‹ค! ๊ณต๋ถ€ํ•˜์‹œ๋Š”๋ฐ, ๋งŽ์€ ๋„์›€ ๋˜์‹œ๊ธฐ ๋ฐ”๋ผ๊ฒ ์Šต๋‹ˆ๋‹ค!

๊ทธ๋Ÿผ ๋ฐ”๋กœ ์‹œ์ž‘ ํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค!

 

๐Ÿ“Œ ๊ต์œก ๊ณผ์ • ๊ด€๋ฆฌ ํ”„๋กœ๊ทธ๋žจ (๊ฐ์ฒด์™€ ์ปฌ๋ ‰์…˜ list ๋ฐฐ์—ด ์‚ฌ์šฉ)

   ๐Ÿ“ Homework_210308.java (๊ฐ์ฒด์™€ Method ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ ..)


package homework;

import java.util.Scanner;

public class Homework_210308 {

	public static void main(String[] args) {
		// ํ‚ค๋ณด๋“œ ์ž…๋ ฅ ๊ฐ’ ๋ฐ›๊ธฐ
		Scanner s = new Scanner(System.in);
        // ์ž…๋ ฅ ๋ฐ›์€ ๋ฌธ์ž์—ด์„ ํ•œ ๊ธ€์ž์”ฉ ๋‹ด์„ ๋ฐฐ์—ด ์„ ์–ธ
		char[] str = new char[20];
        // ๋ฌธ์ž์—ด ์ •์ˆ˜ ๋ณ€ํ™˜ ๊ฐ’ ๋ณ€์ˆ˜ ์„ ์–ธ
		int numstr = 0;
        // ๋Œ€๋ฌธ์ž ๊ฐœ์ˆ˜์šฉ ๋ณ€์ˆ˜ ์„ ์–ธ
		int bigCount = 0;
        // ์†Œ๋ฌธ์ž ๊ฐœ์ˆ˜์šฉ ๋ณ€์ˆ˜ ์„ ์–ธ
		int smallCount = 0;
        // ์ˆซ์ž ๊ฐœ์ˆ˜์šฉ ๋ณ€์ˆ˜ ์„ ์–ธ
		int numberCount = 0;
        // ๋ชจ๋“  ๋ฌธ์ž ํ†ตํ•ฉ ๊ฐœ์ˆ˜์šฉ ๋ณ€์ˆ˜ ์„ ์–ธ
		int totalCount = 0;

 			// ์‚ฌ์šฉ์ž์˜ ์ž…๋ ฅ๊ฐ’์„ ์ž…๋ ฅ ๋ฐ›์•„ input ๋ฌธ์ž์—ด ๋ณ€์ˆ˜์— ์ €์žฅ
			System.out.println("์ž…๋ ฅ๊ฐ’์„ ์ž…๋ ฅ ํ•ด ์ฃผ์„ธ์š”");
			String input = s.nextLine();
			
            // ์ž…๋ ฅ๋œ ๋ฌธ์ž์—ด ๊ธธ์ด ๋งŒํผ ๋ฐ˜๋ณต๋ฌธ ์‹œ์ž‘
			for (int i = 0; i < input.length(); ++i) {
            // ์‚ฌ์šฉ์ž๊ฐ€ ์ž…๋ ฅํ•œ ๋ฌธ์ž์—ด ์ค‘ i๋ฒˆ์งธ ๋ฌธ์ž ํ•˜๋‚˜๋ฅผ
            // ๋ฌธ์ž ์ž๋ฃŒ ๋ฐฐ์—ดํ˜• str i๋ฒˆ์งธ์— ์ €์žฅ
				str[i] = input.charAt(i);

					// str i๋ฒˆ์งธ ๋ฌธ์ž๊ฐ€ ์†Œ๋ฌธ์ž์ธ์ง€ ํŒ๋ณ„
					if ( str[i] >= 'a' && str[i] <= 'z') {
						// ํ‚ค๋ณด๋“œ ์ž…๋ ฅ๊ฐ’ ์ •์ˆ˜๋กœ ๋ณ€ํ™˜
						numstr += str[i];
                        // ์†Œ๋ฌธ์ž ๊ฐœ์ˆ˜ 1์”ฉ ์ฆ๊ฐ€
						++smallCount;
						
                    // ์‚ฌ์šฉ์ž ์ž…๋ ฅ๊ฐ’์ด ์†Œ๋ฌธ์ž๊ฐ€ ์•„๋‹ˆ๊ณ , ๋Œ€๋ฌธ์ž์ธ์ง€ ํŒ๋ณ„    
					} else if ( str[i] >= 'A' && str[i] <= 'Z') {
                    	// ํ‚ค๋ณด๋“œ ์ž…๋ ฅ๊ฐ’ ์ •์ˆ˜๋กœ ๋ณ€ํ™˜
						numstr += str[i];
                        // ๋Œ€๋ฌธ์ž ๊ฐœ์ˆ˜ 1์”ฉ ์ฆ๊ฐ€
						++bigCount; 

					// ์‚ฌ์šฉ์ž ์ž…๋ ฅ๊ฐ’์ด ์•ŒํŒŒ๋ฒณ์ด ์•„๋‹ˆ๊ณ , ์ˆซ์ž์ธ์ง€ ํŒ๋ณ„
					} else if (str[i] >= '0' && str[i] <= '9') {
                    	// ์ˆซ์ž(๋ฌธ์ž์—ด) ์ •์ˆ˜๋กœ ๋ณ€ํ™˜
						numstr += str[i];
                        // ์ˆซ์ž ๊ฐœ์ˆ˜ 1์”ฉ ์ฆ๊ฐ€
						++numberCount;
					}						
			}
            
		// ๋ฌธ์ž์—ด ์ •์ˆ˜๋กœ ๋ณ€ํ™˜ํ•œ ์ดํ•ฉ ๊ตฌํ•˜๊ธฐ
		int total = numstr;
        
        // ๋ฌธ์ž์—ด ๊ฐœ์ˆ˜ ์ดํ•ฉ ๊ตฌํ•˜๊ธฐ
		totalCount = smallCount + bigCount + numberCount;
        
		System.out.println("์†Œ๋ฌธ์ž๊ฐ€ " + smallCount + " ๊ฐœ ์ž…๋ ฅ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.");
		System.out.println("๋Œ€๋ฌธ์ž๊ฐ€ " + bigCount + " ๊ฐœ ์ž…๋ ฅ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.");
		System.out.println("์ˆซ์ž๊ฐ€ " + numberCount + " ๊ฐœ ์ž…๋ ฅ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.");
		System.out.println("์ž…๋ ฅ๋œ ๋ฌธ์ž์—ด์˜ ์ •์ˆ˜ ์ดํ•ฉ์€ " + total + " ์ž…๋‹ˆ๋‹ค.");
		// ํ‰๊ท  ๊ตฌํ•˜๊ธฐ
		System.out.println("ํ‰๊ท ์€ " + total / totalCount + "์ž…๋‹ˆ๋‹ค." );
	}
}

 

 

   ๐Ÿ“ Homework_Method_210308.java (Method๋งŒ ์‚ฌ์šฉ)


package homework;

import java.util.Scanner;

public class Homework_Method_210308 {
	static char[] str;		// ๋ฌธ์ž์—ด ํ•œ ๊ธ€์ž์”ฉ ๋‹ด์„ ๋ฐฐ์—ด ์„ ์–ธ
	static int numstr;		// ๋ฌธ์ž์—ด ์ •์ˆ˜ ๋ณ€ํ™˜ ๋ณ€์ˆ˜ ์„ ์–ธ
	static int bigCount;	// ๋Œ€๋ฌธ์ž ๊ฐœ์ˆ˜ ์ €์žฅ ๋ณ€์ˆ˜ ์„ ์–ธ
	static int smallCount;	// ์†Œ๋ฌธ์ž ๊ฐœ์ˆ˜ ์ €์žฅ ๋ณ€์ˆ˜ ์„ ์–ธ
	static int numberCount;	// ์ˆซ์ž ๊ฐœ์ˆ˜ ์ €์žฅ ๋ณ€์ˆ˜ ์„ ์–ธ
	static int totalCount;	// ๋ฌธ์ž์—ด ์ด ๊ฐœ์ˆ˜ ์ €์žฅ ๋ณ€์ˆ˜ ์„ ์–ธ

	public static void main(String[] args) {
		// ํ‚ค๋ณด๋“œ ์ž…๋ ฅ ๊ฐ’ ๋ฐ›๊ธฐ
		Scanner s = new Scanner(System.in);
        // ๊ธ€์ž ๋ฐฐ์—ด ์ดˆ๊ธฐํ™”(20๊ฐœ)
		str = new char[20];
		numstr = 0;
		number = 0;
		bigCount = 0;
		smallCount = 0;
		numberCount = 0;
		totalCount = 0;

 			// ์‚ฌ์šฉ์ž์—๊ฒŒ ๋ฌธ์ž์—ด์„ ์ž…๋ ฅ ๋ฐ›๊ธฐ
			System.out.println("์ž…๋ ฅ๊ฐ’์„ ์ž…๋ ฅ ํ•ด ์ฃผ์„ธ์š”");
			String input = s.nextLine();

			// ์ž…๋ ฅ ๋ฐ›์€ ๋ฌธ์ž์—ด ๊ธธ์ด ๋งŒํผ ๋ฐ˜๋ณต๋ฌธ ๋™์ž‘
			for (int i = 0; i < input.length(); ++i) {
            	// ์ž…๋ ฅ ๋ฐ›์€ ๋ฌธ์ž์—ด ์ค‘ ํ•œ ๊ธ€์ž i๋ฒˆ์งธ ๊ฒƒ์„ ๋ฝ‘์•„ ๊ธ€์ž ๋ฐฐ์—ด i๋ฒˆ์งธ์— ์ €์žฅ
				str[i] = input.charAt(i);

					// ์†Œ๋ฌธ์ž ํŒ๋ณ„
					if ( str[i] >= 'a' && str[i] <= 'z') {
						// loopForSmall ๋ฉ”์„œ๋“œ์— i๋ฒˆ์งธ ๊ธ€์ž๋ฅผ ์ž…๋ ฅ๊ฐ’์œผ๋กœ ์ „๋‹ฌ
                        loopForSmall(str[i]);
                        
                    // ๋Œ€๋ฌธ์ž ํŒ๋ณ„
					} else if ( str[i] >= 'A' && str[i] <= 'Z') {
                    // loopForBig ๋ฉ”์„œ๋“œ์— i๋ฒˆ์งธ ๊ธ€์ž๋ฅผ ์ž…๋ ฅ๊ฐ’์œผ๋กœ ์ „๋‹ฌ
						loopForBig(str[i]);
                        
                    // ์ˆซ์ž ํŒ๋ณ„
					} else if (str[i] >= '0' && str[i] <= '9') {
                    // loopForNum ๋ฉ”์„œ๋“œ์— i๋ฒˆ์งธ ๊ธ€์ž๋ฅผ ์ž…๋ ฅ๊ฐ’์œผ๋กœ ์ „๋‹ฌ
						loopForNum(str[i]);
					}						
				}
                // ์ •์ˆ˜๋กœ ๋ณ€ํ™˜๋œ ๋ฌธ์ž์—ด ์ดํ•ฉ total์— ์ €์žฅ
				int total = numstr;
                
                // ๋ฌธ์ž์—ด ๊ฐœ์ˆ˜ totalCount์— ์ €์žฅ
				totalCount = smallCount + bigCount + numberCount;
                
				System.out.println("์†Œ๋ฌธ์ž๊ฐ€ " + smallCount + " ๊ฐœ ์ž…๋ ฅ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.");
				System.out.println("๋Œ€๋ฌธ์ž๊ฐ€ " + bigCount + " ๊ฐœ ์ž…๋ ฅ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.");
				System.out.println("์ˆซ์ž๊ฐ€ " + numberCount + " ๊ฐœ ์ž…๋ ฅ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.");
				System.out.println("์ž…๋ ฅ๋œ ๋ฌธ์ž์—ด์˜ ์ •์ˆ˜ ์ดํ•ฉ์€ " + total + " ์ž…๋‹ˆ๋‹ค.");
				System.out.println("ํ‰๊ท ์€ " + total / totalCount + "์ž…๋‹ˆ๋‹ค." );
			} // Main ๋
            
	// ๋Œ€๋ฌธ์ž๋กœ ํŒ๋ณ„๋œ ๊ธ€์ž๋“ค ์ฒ˜๋ฆฌ ๋ฉ”์„œ๋“œ (์ž…๋ ฅ๊ฐ’์œผ๋กœ ํ•œ ๊ธ€์ž(i๋ฒˆ์งธ)์”ฉ ๋ฐ›์Œ)
	private static void loopForNum(char input) {
		// ์ž…๋ ฅ ๋ฐ›์€ ํ•œ ๊ธ€์ž(i๋ฒˆ์งธ)๋ฅผ ์ •์ˆ˜๋กœ ๋ณ€ํ™˜ํ•ด์„œ ์ €์žฅ
		numstr += input;
        // ์ˆซ์ž ๊ฐœ์ˆ˜ 1์”ฉ ์ฆ๊ฐ€
		++numberCount;
		
	}
	// ๋Œ€๋ฌธ์ž๋กœ ํŒ๋ณ„๋œ ๊ธ€์ž๋“ค ์ฒ˜๋ฆฌ ๋ฉ”์„œ๋“œ (์ž…๋ ฅ๊ฐ’์œผ๋กœ ํ•œ ๊ธ€์ž(i๋ฒˆ์งธ)์”ฉ ๋ฐ›์Œ)
	private static void loopForBig(char input) {
		// ์ž…๋ ฅ ๋ฐ›์€ ํ•œ ๊ธ€์ž(i๋ฒˆ์งธ)๋ฅผ ์ •์ˆ˜๋กœ ๋ณ€ํ™˜ํ•ด์„œ ์ €์žฅ 
		numstr += input;
        // ๋Œ€๋ฌธ์ž ๊ฐœ์ˆ˜ 1์”ฉ ์ฆ๊ฐ€
		++bigCount; 
		
	}
	// ์†Œ๋ฌธ์ž๋กœ ํŒ๋ณ„๋œ ๊ธ€์ž๋“ค ์ฒ˜๋ฆฌ ๋ฉ”์„œ๋“œ (์ž…๋ ฅ๊ฐ’์œผ๋กœ ํ•œ ๊ธ€์ž(i๋ฒˆ์งธ)์”ฉ ๋ฐ›์Œ)
	private static void loopForSmall(char input) {
		// ์ž…๋ ฅ ๋ฐ›์€ ํ•œ ๊ธ€์ž(i๋ฒˆ์งธ)๋ฅผ ์ •์ˆ˜๋กœ ๋ณ€ํ™˜ํ•ด์„œ ์ €์žฅ 
		numstr += input;
        // ์†Œ๋ฌธ์ž ๊ฐœ์ˆ˜ 1์”ฉ ์ฆ๊ฐ€
		++smallCount;
	}
	
} // Class ๋

 

 

   ๐Ÿ“ Homework_Object_210308.java (๊ฐ์ฒด์™€ Method ์‚ฌ์šฉ)


package homework;

import java.util.Scanner;

public class Homework_Oject_210308 {

	public static void main(String[] args) {
		// ํ‚ค๋ณด๋“œ ์ž…๋ ฅ ๊ฐ’ ๋ฐ›๊ธฐ
		Scanner s = new Scanner(System.in);
        // ์ž…๋ ฅ๊ฐ’ ํ•œ ๊ธ€์ž์”ฉ ๋ฐ›์„ ๋ฐฐ์—ด ์„ ์–ธ ๋ฐ ์ดˆ๊ธฐํ™”๋กœ 20๊ฐœ ์„ ์–ธ
		char[] str = new char[20];
        
        // LoopFor ์ฐธ์กฐ ์ž๋ฃŒํ˜• loop์— LoopFor ๊ฐ์ฒด ์ƒ์„ฑ
		LoopFor loop = new LoopFor();

 			// ์‚ฌ์šฉ์ž ์ž…๋ ฅ๊ฐ’ ๋ฐ›๊ธฐ
			System.out.println("์ž…๋ ฅ๊ฐ’์„ ์ž…๋ ฅ ํ•ด ์ฃผ์„ธ์š”");
			String input = s.nextLine();

			// ์‚ฌ์šฉ์ž ์ž…๋ ฅ๊ฐ’๋งŒํผ ๋ฐ˜๋ณต ์‹œ์ž‘
			for (int i = 0; i < input.length(); ++i) {
            	// ์‚ฌ์šฉ์ž ์ž…๋ ฅ๊ฐ’ ์ค‘ ํ•œ ๊ธ€์ž์”ฉ ๊ธ€์ž ๋‹ด๊ธฐ ์œ„ํ•œ ๋ฐฐ์—ด์— i๋ฒˆ์งธ๋ฅผ ๋‹ด์Œ.
				str[i] = input.charAt(i);

				// ๊ฐ์ฒด์ด๋ฏ€๋กœ, null ๊ฐ’ ํ™•์ธํ•˜๋Š” ์œ ํšจ์„ฑ ๊ฒ€์‚ฌ
				if ( !loop.equals(null)) {
                
                	// ์†Œ๋ฌธ์ž ํŒ๋ณ„
					if ( str[i] >= 'a' && str[i] <= 'z') {
						// LoopFor ๊ฐ์ฒด์— loopForSamll ๋ฉ”์„œ๋“œ์— i๋ฒˆ์งธ ๊ธ€์ž๋ฅผ ์ „๋‹ฌ
						loop.loopForSmall(str[i]);
                        
					// ๋Œ€๋ฌธ์ž ํŒ๋ณ„
				} else if ( str[i] >= 'A' && str[i] <= 'Z') {
                // LoopFor ๊ฐ์ฒด์— loopForBig ๋ฉ”์„œ๋“œ์— i๋ฒˆ์งธ ๊ธ€์ž๋ฅผ ์ „๋‹ฌ
						loop.loopForBig(str[i]);
					
                    // ์ˆซ์ž ํŒ๋ณ„
					} else if (str[i] >= '0' && str[i] <= '9') {
                    // LoopFor ๊ฐ์ฒด์— loopForNum ๋ฉ”์„œ๋“œ์— i๋ฒˆ์งธ ๊ธ€์ž๋ฅผ ์ „๋‹ฌ
						loop.loopForNum(str[i]);
					}						
				}
			}

				// LoopFor ๊ฐ์ฒด์— numstr ํ•„๋“œ์— ์ €์žฅ๋œ ๊ฐ’์„ total์— ์ €์žฅ
                // ๋ฌธ์ž์—ด์„ ์ •์ˆ˜๋กœ ๋ณ€ํ™˜ํ•œ ์ดํ•ฉ
				int total = loop.numstr;
                
                // LoopFor ๊ฐ์ฒด์— smallCount, bigCount, numberCount ํ•„๋“œ์— ์ €์žฅ๋œ ๊ฐ’ totalCount์— ์ €์žฅ
                // ๋ชจ๋“  ๋ฌธ์ž ๊ฐœ์ˆ˜ ์„ธ๊ธฐ
				int totalCount = loop.smallCount + loop.bigCount + loop.numberCount;
                
				System.out.println("์†Œ๋ฌธ์ž๊ฐ€ " + loop.smallCount + " ๊ฐœ ์ž…๋ ฅ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.");
				System.out.println("๋Œ€๋ฌธ์ž๊ฐ€ " + loop.bigCount + " ๊ฐœ ์ž…๋ ฅ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.");
				System.out.println("์ˆซ์ž๊ฐ€ " + loop.numberCount + " ๊ฐœ ์ž…๋ ฅ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.");
				System.out.println("์ž…๋ ฅ๋œ ๋ฌธ์ž์—ด์˜ ์ •์ˆ˜ ์ดํ•ฉ์€ " + total + " ์ž…๋‹ˆ๋‹ค.");
				System.out.println("ํ‰๊ท ์€ " + total / totalCount + "์ž…๋‹ˆ๋‹ค." );

	}
}

 

 

   ๐Ÿ“ LoopFor.java


package homework;

public class loopFor {
	int numstr;			// ๋ฌธ์ž๋ฅผ ์ •์ˆ˜๋กœ ๋ณ€ํ™˜ํ•œ ๊ฐ’ ์ €์žฅ ๋ณ€์ˆ˜ ์„ ์–ธ
	int bigCount;		// ๋Œ€๋ฌธ์ž ์„ธ๊ธฐ ๋ณ€์ˆ˜ ์„ ์–ธ
	int smallCount;		// ์†Œ๋ฌธ์ž ์„ธ๊ธฐ ๋ณ€์ˆ˜ ์„ ์–ธ
	int numberCount;	// ์ˆซ์ž ์„ธ๊ธฐ ๋ณ€์ˆ˜ ์„ ์–ธ
	int totalCount;		// ๋ฌธ์ž ์ด ๊ฐœ์ˆ˜ ๋ณ€์ˆ˜ ์„ ์–ธ

	// ์ƒ์„ฑ์ž ( ํ•„๋“œ ๊ฐ’ ์ดˆ๊ธฐํ™” )
	public loopFor() {
		this.numstr = 0;
		this.number = 0;
		this.bigCount = 0;
		this.smallCount = 0;
		this.numberCount = 0;
		this.totalCount = 0;
	}
	
    // Main Method์—์„œ ์†Œ๋ฌธ์ž ํŒ๋ณ„ if๋ฌธ์— ๊ฑธ๋ฆด ๊ฒฝ์šฐ ๊ทธ ๋‹จ์–ด๊ฐ€ ์ž…๋ ฅ๊ฐ’์œผ๋กœ ๋“ค์–ด์˜ด.
	public void loopForSmall(char input) {
    	// numstr ํ•„๋“œ์— ๊ธ€์ž๋ฅผ ์ •์ˆ˜๋กœ ๋ณ€ํ™˜ํ•˜์—ฌ ์ €์žฅ
		this.numstr += input;
        // ์†Œ๋ฌธ์ž ๊ฐœ์ˆ˜ 1์”ฉ ์ฆ๊ฐ€
		++smallCount;
	}
	
    // Main Method์—์„œ ๋Œ€๋ฌธ์ž ํŒ๋ณ„ if๋ฌธ์— ๊ฑธ๋ฆด ๊ฒฝ์šฐ ๊ทธ ๋‹จ์–ด๊ฐ€ ์ž…๋ ฅ๊ฐ’์œผ๋กœ ๋“ค์–ด์˜ด.
	public void loopForBig(char input) {
    // numstr ํ•„๋“œ์— ๊ธ€์ž๋ฅผ ์ •์ˆ˜๋กœ ๋ณ€ํ™˜ํ•˜์—ฌ ์ €์žฅ
		this.numstr += input;
        // ์†Œ๋ฌธ์ž ๊ฐœ์ˆ˜ 1์”ฉ ์ฆ๊ฐ€
		++bigCount; 
	}
	
    // Main Method์—์„œ ์ˆซ์ž ํŒ๋ณ„ if๋ฌธ์— ๊ฑธ๋ฆด ๊ฒฝ์šฐ ๊ทธ ๋‹จ์–ด๊ฐ€ ์ž…๋ ฅ๊ฐ’์œผ๋กœ ๋“ค์–ด์˜ด.
	public void loopForNum(char input) {
		this.numstr += input;
        // ์†Œ๋ฌธ์ž ๊ฐœ์ˆ˜ 1์”ฉ ์ฆ๊ฐ€
		++numberCount;
	}
	
}

 

 


์ฃผ๋‹ˆํ•˜๋ž‘์˜ ๊ธ€์ด ๋งˆ์Œ์— ๋“œ์…จ๋‚˜์š”? ๊ตฌ๋…๊ณผ ๊ณต๊ฐ! ๊ทธ๋ฆฌ๊ณ , ๋Œ“๊ธ€์€ ์ฃผ๋‹ˆํ•˜๋ž‘์—๊ฒŒ ๋งŽ์€ ํž˜์ด ๋ฉ๋‹ˆ๋‹ค!

728x90
๋ฐ˜์‘ํ˜•