Menu
Question Index
...


Write a program to parse the given SWIFT payment message and create the corresponding payment object. For display purposes new lines are shown as $.

Input (String) Output (Payment)

:20:1000
:23B:HYD
:32A:130524INR2000,22
:50K:CERONE
:59:/502664959
22-13-41 LALPET
HYDERABAD 101290
:71A:SHA

Sender Reference=1000
Bank Operation Code=HYD
Value Date=24-May-2013
Currency=INR
Inter Bank Settled Amount=2000.22
Ordering Customer=CERONE
Beneficiary Account Number=502664959
Beneficiary Customer=22-13-41 LALPET$HYDERABAD 101290
Details Of Charges=SHA

:32A:090227INR978789,42
:50K:KUMAR
:59:/89567989
11-31-18 PULLARREDDY NAGAR
KAVALI
NELLORE 524201
:23B:DLH
:71A:BIF
:20:96785685

Sender Reference=96785685
Bank Operation Code=DLH
Value Date=27-Feb-2009
Currency=INR
Inter Bank Settled Amount=978789.42
Ordering Customer=KUMAR
Beneficiary Account Number=89567989
Beneficiary Customer=11-31-18 PULLARREDDY NAGAR$KAVALI$NELLORE 524201
Details Of Charges=BIF

:20:9678678
:23B:SRT
:32A:020418USD989769,23
:50K:VARDHAN
:59:15 MYLAPORE
CHENNAI
TAMIL NADU
INDIA 6787689
:71A:SHA

Sender Reference=9678678
Bank Operation Code=SRT
Value Date=18-Apr-2002
Currency=USD
Inter Bank Settled Amount=989769.23
Ordering Customer=VARDHAN
Beneficiary Account Number=null
Beneficiary Customer=15 MYLAPORE$CHENNAI$TAMIL NADU$INDIA 6787689
Details Of Charges=SHA

class ParseSWIFTPaymentMessage

{    public static void main(String s[])
    {
        String input = ":20:1000\n:23B:HYD\n:32A:130524INR2000,22\n:50K:CERONE\n:59:/502664959\n22-13-41 LALPET\nHYDERABAD 101290\n:71A:SHA";
        Payment payment = getPayment(input);
        System.out.println("The payment details are : " + payment);

    }


public static Payment getPayment(String input) {
//Write code here to parse the SWIFT message and create the payment details
}

//Write additional methods here if required
}
class Payment {

String senderReference;
String bankOperationCode;
Date valueDate;
String currency;
Double interBankSettledAmount;
String orderingCustomer;
String beneficiaryAccountNumber;
String beneficiaryCustomer;
String detailsOfCharges;

@Override
public String toString() {
return "Payment [senderReference=" + senderReference + ", bankOperationCode=" + bankOperationCode + ", valueDate=" + valueDate + ", currency=" + currency + ", interBankSettledAmount=" + interBankSettledAmount + ", orderingCustomer=" + orderingCustomer + ", beneficiaryAccountNumber=" + beneficiaryAccountNumber + ", beneficiaryCustomer=" + beneficiaryCustomer + ", detailsOfCharges="
+ detailsOfCharges + "]";
}
}

Doubts

Problems

Topic: Locale Class In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App