#스마트인재개발원 #국비지원코딩교육 #취업준비 #자바 #자바 #명품자바 #코드리뷰, 그동안 배운 다양한 문법을 활용해 mp3플레이어 프로그램을 만들었다. #스마트인재개발원 #국비지원코딩교육 #취업준비 #자바 #자바 #명품자바 #코드리뷰, 그동안 배운 다양한 문법을 활용해 mp3플레이어 프로그램을 만들었다.
어떤 순서로 프로그램을 작성해야 하는지 참고하면 좋을 것 같아! 어떤 순서로 프로그램을 작성해야 하는지 참고하면 좋을 것 같아!
1. 기본적인 틀 설계 음악 플레이어를 만들기 전에 어떤 것이 필요한지, 그것들이 서로 어떻게 소통하는지 설계해본다. 1. 기본적인 틀 설계 음악 플레이어를 만들기 전에 어떤 것이 필요한지, 그것들이 서로 어떻게 소통하는지 설계해본다.
실행이 시작되는 Main 메서드 작성 > Code 실행이 시작되는 Main 메서드 작성 > Code
Music Player View-while문을 활용하여 [5] 종료 버튼이 눌릴 때까지 메뉴 선택을 반복할 수 있도록 한다 – if문을 통해 각 메뉴가 선택되었을 때 수행할 작업을 분류하고 실행하는 프로그램 설계 당시 Music Player View 클래스는 Music Player 클래스와 소통하도록 설계하였으므로 Music Player 클래스와 소통하는 객체(player)를 생성한다. Player 객체를 통해 Music Player 클래스에 있는 메서드를 호출하여 사용한다! Music Player View-while문을 활용하여 [5] 종료 버튼이 눌릴 때까지 메뉴 선택을 반복할 수 있도록 한다 – if문을 통해 각 메뉴가 선택되었을 때 수행할 작업을 분류하고 실행하는 프로그램 설계 당시 Music Player View 클래스는 Music Player 클래스와 소통하도록 설계하였으므로 Music Player 클래스와 소통하는 객체(player)를 생성한다. Player 객체를 통해 Music Player 클래스에 있는 메서드를 호출하여 사용한다!
새로운 클래스(Music Player) 메소드를 생성할 때 직접 해당 클래스 화면에 타이핑해도 되지만, 이클립스에서 제공하는 에러 메시지를 활용하면 보다 빠르고 오타 없이 메소드를 생성할 수 있다! ( 에러 메세지의 빨간 선에 마우스를 갖다댈 때 표시되는 ‘Create Method~’를 누르면 클래스의 메소드가 마음대로 생성된다!! >,< )> Console 새로운 클래스(Music Player) 메소드를 생성할 때 직접 해당 클래스 화면에 타이핑해도 되지만, 이클립스가 제공하는 에러 메시지를 활용하면 보다 빠르고 오타 없이 메소드를 생성할 수 있다! ( 에러 메세지의 빨간 선에 마우스를 갖다댈 때 표시되는 ‘Create Method~’를 누르면 클래스의 메소드가 마음대로 생성된다!! >,< )> Console
각 메뉴의 기능을 구현하기 전에 프로그램 종료를 입력할 때까지는 메뉴를 계속 선택하도록 반복! 각 메뉴의 기능을 구현하기 전에 프로그램 종료를 입력할 때까지는 메뉴를 계속 선택하도록 반복!
2. 기능별 상세 내용 추가 (1) 노래 재생 사용자가 1번 메뉴를 선택하여 노래를 재생하고자 할 때 Array List에 노래를 생성한다. 초기값을 0으로 설정하고 최초 저장된 노래를 재생한다. 또한 사용자에게 현재 재생되고 있는 노래의 제목과 가수명을 출력해 준다. > Code 2. 기능별 상세 내용 추가 (1) 노래 재생 사용자가 1번 메뉴를 선택하여 노래를 재생하고자 할 때 Array List에 노래를 생성한다. 초기값을 0으로 설정하고 최초 저장된 노래를 재생한다. 또한 사용자에게 현재 재생되고 있는 노래의 제목과 가수명을 출력해 준다. > Code
No language detected.
Please check the input language, no language detected.
Please check the input language.
* When the MusicPlayer class is created, a list of songs is also created. – Declare an ArrayList that contains a list of songs under the name Music and add song information to the ArrayList through the .add() method used to add values to the ArrayList. – When the number 1 menu is selected in the Music Player View class and the song is played, the song information is read through the .get() method, which reads the value stored in the Array List. * When the MusicPlayer class is created, a list of songs is also created. – Declare an ArrayList that contains a list of songs under the name Music and add song information to the ArrayList through the .add() method used to add values to the ArrayList. – When the number 1 menu is selected in the Music Player View class and the song is played, the song information is read through the .get() method, which reads the value stored in the Array List.
감지된 언어가 없습니다.
입력 언어를 확인해 주세요.
Music class with song information! Declared the title and singer name of the song as private access restrictors so that it cannot be arbitrarily touched by the outside, and created a getter method in case you need to retrieve the information from the outside. > Music class with Console song information! We declared the title and singer name of the song as private access restrictors so that they could not be arbitrarily touched by the outside, and created a getter method in case they needed to get information from the outside. > Console
– When you select the number one menu to play a song, the first saved song is played. (3) When you press Playback of the previous song, the song stored in index 0 is executed. Next, when you try to play an old song, there is no song before number 0, so you run the last saved song on the Array List. > Code – When you select the first menu to play a song, the first saved song is played. (3) When you press Playback of the previous song, the song stored in index 0 is executed. Next, when you try to play an old song, there is no song before number 0, so you run the last saved song on the Array List. > Code
If the index is 0 and the previous song is ordered to be executed, an index smaller than the ArrayList size is substituted for the index to be played. (Since the index starts at 0, a value smaller than the ArrayList size is ordered to be executed.)
If the order to play the previous song comes in while the first song [Butter-BTS] is running, it can be confirmed that the last song [Heize] is executed. (4) Play the next song > Code When the first song [Butter-BTS] is running and the command to play the previous song comes in, it can be confirmed that the last song [Heize] is executed. (4) Play the next song > Code
Like previous music playback algorithms, if you are told to play the next song with the index value already at its maximum, change the index to zero to play the first song. > Similar to the pre-Console song playback algorithm, if you are told to play the next song with the index value already at its maximum, change the index to zero to play the first song. > Console
3. After setting up a program to look back on the program, I looked back on the code as a whole. It was found that the program that was created had overlapping parts that output information about the song selected by the user for each method. These duplicates were removed by creating a method. (*) Deduplication 3. After setting up a program to look back on the program, I looked back on the code as a whole. It was found that the program that was created had overlapping parts that output information about the song selected by the user for each method. These duplicates were removed by creating a method. (*) Deduplication
->Create method and deduplication ->Create method and deduplication
It can be said that the reason why methods are created and duplicated is because of the efficiency of maintenance. For example, if you want to change the information output format of a song in the future, you can modify it with just one integrated method. It can be said that the reason why methods are created and duplicated is because of the efficiency of maintenance. For example, if you want to change the information output format of a song in the future, you can modify it with just one integrated method.
Actually, I organized it like this, but I still don’t know if I understood the back and forth between this class and the object. TT I repeat and repeat. OK ……… !!~!! Actually, I organized it like this, but I still don’t know if I understood the back and forth between this class and the object. TT I repeat and repeat. OK ……… !!~!!
Smart Human Resources Development Institute’s “0 Won” job-linked education institution www.smhrd.or.kr Smart Human Resources Development Institute’s “0 Won” job-linked education institution that leads the era of the 4th Industrial Revolution www.smhrd.or.kr