CodeGym/행동/자바 컬렉션/중요한 작업: ATM 소프트웨어

중요한 작업: ATM 소프트웨어

사용 가능

"안녕, 아미고!"

"안녕하세요, 다람쥐 선장입니다."

"넌 좋은 학생이야. 잘했어, 병사!"

"오늘 당신은 새로운 비밀 임무를 가지고 있습니다: 마스터 재정."

"만세!!! 내가 돈을 어디에 쓸지 이미 알고있어!!!"

"아직 긴장하지 마세요, 병사! 재정을 마스터한다는 것은 새로운 비밀 ATM 프로그램을 작성하는 것을 의미합니다.

큰 작업: ATM 소프트웨어 - 1

"비밀 요원 IntelliJ IDEA를 만나러 가십시오. 거기에서 모든 지침을 받을 수 있습니다."

"끝내겠습니다, 함장님!"

10
과제
자바 컬렉션,  레벨 9레슨 15
잠금
CashMachine (part 1)
Let's write an ATM emulator. We will support the following operations: deposit money, withdraw money, and show the status of the ATM. We will also support multiple currencies. The ATM will operate using the banknotes we put into it.
10
과제
자바 컬렉션,  레벨 9레슨 15
잠금
CashMachine (part 2)
1. Create two static methods in ConsoleHelper: 1.1 writeMessage(String message), which will write our message to the console. 1.2 String readString(), which will read a string from the console and return it.
20
과제
자바 컬렉션,  레벨 9레슨 15
잠금
CashMachine (part 3)
1. Create CurrencyManipulator class that stores all the information about the selected currency. The class must have: 1.1 String currencyCode — currency code, i.e. USD. It consists of three letters. 1.2 Map denominations is a map of (denomination, quantity) pairs.
40
과제
자바 컬렉션,  레벨 9레슨 15
잠금
CashMachine (part 4)
1. Let's decide what operation to start with. Think about it. The ATM doesn't have money yet, so we can't test INFO and WITHDRAW. We'll start with the DEPOSIT operation. We read the currency code from the console. Then we read the denomination and number of banknotes.
20
과제
자바 컬렉션,  레벨 9레슨 15
잠금
CashMachine (part 5)
1. In the previous task, we implemented the basic logic of the DEPOSIT operation. But we couldn't see the results. So, in the manipulator, create an int getTotalAmount() method that calculates the total amount for the selected currency. 2. Call the getTotalAmount() method in the main method.
20
과제
자바 컬렉션,  레벨 9레슨 15
잠금
CashMachine (part 6)
To refactor the code according to the Command pattern, you need to extract several logical blocks of code. For now, we have two such blocks: 1) code for the DEPOSIT operation, 2) code for the INFO operation. This code is in the main method. We need to get rid of it.
20
과제
자바 컬렉션,  레벨 9레슨 15
잠금
CashMachine (part 7)
Let's return to the Command pattern. 1. Create a command package. It will contain all classes with relevant logic. Think about the access modifier for each class in this package. 2. Create a Command interface with a void execute() method.
40
과제
자바 컬렉션,  레벨 9레슨 15
잠금
CashMachine (part 8)
It's time to whip our main method into shape. It already has a bunch of stuff that shouldn't be there. 1. Move the logic from main to DepositCommand and InfoCommand. So what's happened to main? We have a loop, in which we ask the user for an operation and then call a method on the CommandExecutor.
40
과제
자바 컬렉션,  레벨 9레슨 15
잠금
CashMachine (part 9)
Today we're going to tackle ExitCommand. 1. Implement the following logic in ExitCommand: 1.1. Ask whether the user really wants to exit. Provide the following options: yes (y) or no (n). 1.2. If the user confirms, then say goodbye.
40
과제
자바 컬렉션,  레벨 9레슨 15
잠금
CashMachine (part 10)
Today we'll tackle WithdrawCommand. It's the most complex operation. 1. Implement the following algorithm for WithdrawCommand: 1.1. Read the currency code (the method already exists). 1.2. Get a manipulator for the specified currency.
40
과제
자바 컬렉션,  레벨 9레슨 15
잠금
CashMachine (part 11)
Congratulations! You implemented WithdrawCommand! The main functionality is finished. Next you can do some polishing and make things pretty. Let's implement one sweet feature. We can get by without it, but it will make things more beautiful. I'm talking about verification of the user's credit card.
40
과제
자바 컬렉션,  레벨 9레슨 15
잠금
CashMachine (part 12)
In part 11, we hardcoded the credit card number and PIN code used to allow working with our ATM. But we could have lots of users. We certainly won't hardcode them all! If we need to add another user, we would have to redeploy our application. There is a solution to this problem.
40
과제
자바 컬렉션,  레벨 9레슨 15
잠금
CashMachine (part 13)
You've already figured out ResourceBundle! Cool! Now we can add localization, i.e. support for multiple languages. 1. In DepositCommand, ExitCommand, and InfoCommand, add a private ResourceBundle res field and initialize it with the appropriate resource.
40
과제
자바 컬렉션,  레벨 9레슨 15
잠금
CashMachine (part 14)
1. In LoginCommand and WithdrawCommand, add a private ResourceBundle res field and initialize it with the appropriate resource. For LoginCommand, use login_en.properties. For WithdrawCommand, use withdraw_en.properties. 2. Use common_en.properties to replace all the strings in ConsoleHelper.
10
과제
자바 컬렉션,  레벨 9레슨 15
잠금
CashMachine (part 15)
1. In CashMachine, create a constant for the path to the resources. public static final String RESOURCE_PATH; Refactor the loading of all the ResourceBundles to use RESOURCE_PATH. 2. The CashMachine class should have no initialization of ResourceBundles.
코멘트
  • 인기
  • 신규
  • 이전
코멘트를 남기려면 로그인 해야 합니다
이 페이지에는 아직 코멘트가 없습니다