# Jython Programming Examples

## Execute Jython Online

First_Shift = 17
Second_Shift = 18.5
Third_Shift = 22
hours = float(input('How many hours did you work: '));
shift = int(input("Which shift did you work: 1, 2 or 3. "));
if hours > 40:
overtimeHours = hours - 40
if shift == 1:
if hours > 40:
regularPay = First_Shift * 40
overtimePay = overtimeHours * (First_Shift * 1.5)
else:
regularPay = First_Shift * hours
grossPay = regularPay + overtimePay
netPay = grossPay
print('You have worked ', hours);
print('You were on shift ', shift);
print('You earned an hourly wage of ', First_Shift, 'dollars per hour.');
print('Your regular pay is ', regularPay);
print('Your total pay is ', netPay);
if shift == 2:
retirement = input('Do you want to participate in the retirement plan ("Y" for Yes)? ');
if hours > 40:
regularPay = Second_Shift * 40
overtimePay = overtimeHours * (Second_Shift * 1.5)
else:
regularPay = Second_Shift * hours
grossPay = regularPay + overtimePay
if retirement == 'Y' or retirement == 'y':
deduction = grossPay * 0.03
netPay = grossPay - deduction
print('You have worked ', hours);
print('You were on shift ', shift);
print('You earned an hourly wage of ', Second_Shift, 'dollars per hour.');
print('Your regular pay is ', regularPay);
print('Your total pay before deductions is ', grossPay);
print('Your total pay after deductions is ', netPay);
if shift == 3:
retirement = input('Do you want to participate in the retirement plan ("Y" for Yes)? ');
if hours > 40:
regularPay = Third_Shift * 40
overtimePay = overtimeHours * (Third_Shift * 1.5)
else:
regularPay = Third_Shift * hours
grossPay = regularPay + overtimePay
if retirement == 'Y' or retirement == 'y':
deduction = grossPay * 0.03
netPay = grossPay - deduction
print('You have worked ', hours);
print('You were on shift ', shift);
print('You earned an hourly wage of ', Third_Shift, 'dollars per hour.');
print('Your regular pay is ', regularPay);
print('Your total pay before deductions is ', grossPay);
print('Your total pay after deductions is ', netPay);
if shift < 0 or shift > 3:
print('Invalid shift.');

## lllll

#each letter in string
for letter in 'Python':
print 'Current Letter :', letter

## dr01

entity ActivityArea(t_activity_area) {
active Boolean required,
label String required maxlength(100),
version Integer
}

entity Beneficiary(t_beneficiary) {
active Boolean required,
aliasBankAccount String required maxlength(50),
baccAccountNumber String maxlength(50),
baccBankCode String maxlength(10),
baccBranchCode String maxlength(10),
baccRibKey String maxlength(5),
cardCvv2 String maxlength(5),
cardPan String maxlength(20),
cardValidityDate String maxlength(8),
firstname String maxlength(50),
lastname String maxlength(50),
ribmoneyAccountNumber String maxlength(50),
hasRibmoneyAccount Boolean required,
number String required maxlength(10),
pushOrPull Boolean required,
mobileMoneyAccountNumber String maxlength(20)
}

relationship ManyToOne {
Beneficiary{beneficiaryRelationship} to BeneficiaryRelationship,
Beneficiary{beneficiaryType} to BeneficiaryType,
Beneficiary{customer} to Customer
}

entity BeneficiaryRelationship(t_beneficiary_relationship) {
active Boolean required,
label String  required maxlength(100),
version Integer
}

entity BeneficiaryType(t_beneficiary_type) {
active Boolean required,
label String  required maxlength(100),
version Integer
}

entity Contract(t_contract) {
active Boolean required,
creationDate Instant required,
filename String  required maxlength(100),
isMerchantContract Boolean required,
modificationDate Instant required,
number String  maxlength(25),
validationDate Instant,
version Integer
}

relationship ManyToOne {
Contract{customer} to Customer
}

entity ContractDetail(t_contract_detail) {
active Boolean required,
comment String maxlength(255),
version Integer
}

relationship ManyToOne {
ContractDetail{contract} to Contract
}

entity ContractOpposition(t_contract_opposition) {
active Boolean required,
comment String maxlength(255),
isCustomerInitiative Boolean required,
oppositionDate Instant required,
oppositionReason String maxlength(255),
version Integer
}

relationship ManyToOne {
ContractOpposition{contract} to Contract
}

entity Country(t_country) {
active Boolean required,
code String  required maxlength(5),
longLabel String  required maxlength(50),
shortLabel String maxlength(20),
version Integer
}

relationship ManyToOne {
Country{currency} to Currency
}

entity Currency(t_currency) {
active Boolean required,
code String  required maxlength(5),
longLabel String  required maxlength(50),
shortLabel String maxlength(25),
version Integer
}

entity Question(t_question) {
active Boolean required,
label String  required maxlength(150),
version Integer
}

entity Customer(t_customer) {
active Boolean required,
corporateName String maxlength(50),
gpsLatitude Double min(0),
gpsLongitude Double min(0),
homePhone String maxlength(20),
mobilePhone String maxlength(20),
number String  maxlength(25),
otherQuestion String maxlength(150),
responses String maxlength(150),
version Integer,
workPhone String maxlength(20)
}

relationship ManyToOne {
Customer{activityArea} to ActivityArea,
Customer{customerType} to CustomerType,
Customer{person} to Person,
Customer{digiRemitUser} to DigiRemitUser,
Customer{question} to Question
}

entity CustomerBlacklist(t_customer_blacklist) {
active Boolean required,
comment String maxlength(255),
insertionDate Instant required,
modificationDate Instant,
version Integer
}

relationship ManyToOne {
CustomerBlacklist{customer} to  Customer
}

entity CustomerType(t_customer_type) {
active Boolean required,
label String  required maxlength(100),
version Integer
}

entity DocumentType(t_document_type) {
active Boolean required,
label String  required maxlength(100),
version Integer
}

entity EmployeeType(t_document_type) {
active Boolean required,
label String  required maxlength(100),
version Integer
}

entity Employee(t_employee) {
active Boolean required,
matricule String  maxlength(20),
mobilePhone String maxlength(20),
version Integer
}

relationship ManyToOne {
Employee{person} to Person,
Employee{partner} to Partner,
Employee{employeeType} to EmployeeType,
Employee{digiRemitUser} to DigiRemitUser,
}

entity Forex(t_forex) {
rate Double,
creationDate Instant,
active Boolean required
}

relationship ManyToOne {
Forex{fromCurrency} to Currency,
Forex{toCurrency} to Currency
}

entity Meansofpayment(t_meansofpayment) {
active Boolean required,
aliasBankAccount String required maxlength(50),
baccAccountNumber String maxlength(50),
baccBankCode String maxlength(10),
baccBranchCode String maxlength(10),
baccRibKey String maxlength(5),
cardCvv2 String maxlength(5),
cardPan String maxlength(20),
cardValidityDate String maxlength(8),
number String required maxlength(10),
momoAccountNumber String maxlength(20),
pushOrPull Boolean
}

relationship ManyToOne {
Meansofpayment{meansofpaymentType} to MeansofpaymentType,
Meansofpayment{customer } to Customer
}

entity MeansofpaymentType(t_meansofpayment_type) {
active Boolean required,
label String  required maxlength(100),
version Integer
}
//====Emmanuel Don 26/11/2018
relationship ManyToOne {
MeansofpaymentType{partnerType} to PartnerType,
}

entity Partner(t_partner) {
active Boolean required,
city String maxlength(100),
code String  required maxlength(10),
gpsLatitude Double min(0),
gpsLongitude Double min(0),
name String  required maxlength(50),
postalCode String maxlength(10),
version Integer
}

relationship ManyToOne {
Partner{country} to Country,
Partner{partnerType} to PartnerType
}

entity PartnerType(t_partner_type) {
active Boolean required,
description String maxlength(255),
label String  required maxlength(100),
version Integer
}

entity Periodicity(t_periodicity) {
active Boolean required,
label String  required maxlength(100),
version Integer
}

entity Person(t_person) {
active Boolean required,
birthdate String maxlength(10),
city String maxlength(50),
email String pattern(/^[^@\s]+@[^@\s]+\.[^@\s]+\$/),
firstname String maxlength(50),
name String maxlength(50),
postalCode String maxlength(10),
version Integer
}

relationship ManyToOne {
Person{country} to Country,
Person{personType} to PersonType
}

entity PersonDocument(t_person_document) {
active Boolean required,
documentNumber String maxlength(50),
expirationDate String maxlength(10),
isValid Boolean required,
version Integer
}

relationship ManyToOne {
PersonDocument{document} to DocumentType,
PersonDocument{person} to Person
}

entity PersonType(t_person_type) {
active Boolean required,
label String  required maxlength(100),
version Integer
}

entity Plafond(t_plafond) {
active Boolean required,
comment String maxlength(255),
value Double,
version Integer
}

relationship ManyToOne {
Plafond{customerType} to CustomerType,
Plafond{plafondType} to PlafondType
}

entity PlafondMeasure(t_plafond_measure) {
active Boolean required,
code String maxlength(10),
label String  required maxlength(100),
version Integer
}

entity PlafondType(t_plafond_type) {
active Boolean required,
label String  required maxlength(100),
version Integer
}

relationship ManyToOne {
PlafondType{periodicity} to Periodicity,
PlafondType{plafondMeasure} to PlafondMeasure
}

entity PlafondUser(t_plafond_user) {
active Boolean required,
comment String maxlength(255),
value Double,
version Integer
}

relationship ManyToOne {
PlafondUser{customer} to Customer,
PlafondUser{customerType} to CustomerType,
PlafondUser{plafondType} to PlafondType
}

entity Price(t_price) {
active Boolean required,
amount Double min(0),
amountInPercent Boolean required,
amountTransactionMax Double min(0),
amountTransactionMin Double min(0),
description String maxlength(255),
label String maxlength(100),
modificationDate Instant,
percent Double min(0),
version Integer
}

relationship ManyToOne {
Price{currency} to Currency,
Price{pricePlan} to PricePlan,
Price{service} to DigiRemitService,
Price{fromCountry} to Country,
Price{toCountry} to Country
}

entity PriceCommission(t_price_commission) {
active Boolean required,
amount Double min(0),
amountInPercent Boolean required,
dateCreation Instant required,
percent Double min(0),
version Integer
}

relationship ManyToOne {
PriceCommission{currency} to Currency,
PriceCommission{partner} to Partner,
PriceCommission{price} to Price
}

entity PricePlan(t_price_plan) {
active Boolean required,
endDate Instant required,
label String maxlength(100),
startDate Instant required,
version Integer
}
relationship ManyToOne {
PricePlan{service} to DigiRemitService,

}

//=====Emmanuel Don 26-11-2018
//update Service to DigiRemitService
entity DigiRemitService(t_service) {
description String maxlength(255),
code String  required maxlength(10),
label String  required maxlength(100),
subscription Boolean required
}

relationship ManyToOne {
DigiRemitService{serviceAuthentication} to ServiceAuthentication,
DigiRemitService{transactionType} to TransactionType,
DigiRemitService{partner} to Partner
}

entity ServiceAuthentication(t_service_authentication) {
active Boolean required,
label String  required maxlength(100),
version Integer
}

entity SubscriptionPrice(t_subscription_price) {
active Boolean required,
amount Double min(0),
description String maxlength(255),
label String maxlength(100),
modificationDate Instant,
version Integer
}

relationship ManyToOne {
SubscriptionPrice{pricePlan} to PricePlan,
SubscriptionPrice{service} to DigiRemitService,
SubscriptionPrice{fromCountry} to Country,
SubscriptionPrice{toCountry} to Country
}

entity Transaction(t_transaction) {
active Boolean required,
comment String maxlength(255),
feesSupported Boolean required,
changeFeesSupported Boolean required,
label String maxlength(100),
transactionAmount Double min(0),
transactionDate Instant required,
transactionFees Double min(0),
transactionChangeFees Double min(0),
transactionNumber String maxlength(50),
version Integer
}

relationship ManyToOne {
Transaction{beneficiary} to Beneficiary,
Transaction{transactionChannel} to TransactionChannel,
Transaction{currency} to Currency,
Transaction{customer} to Customer,
Transaction{sender} to Sender,

Transaction{fromPartner} to Partner,
Transaction{meansofpayment} to Meansofpayment,
Transaction{agence} to Partner,
Transaction{agent} to Employee,

Transaction{service} to DigiRemitService,
Transaction{toPartner} to Partner,
Transaction{transactionStatus} to TransactionStatus,

Transaction{transactionType} to TransactionType,
Transaction{price} to Price,
Transaction{workflow} to Workflow,
Transaction{workflowStep} to WorkflowStep
}

entity TransactionChannel(t_transaction_channel) {
active Boolean required,
label String  required maxlength(100),
version Integer
}

entity TransactionStatus(t_transaction_status) {
active Boolean required,
label String  required maxlength(100),
version Integer
}

entity TransactionType(t_transaction_type) {
active Boolean required,
label String  required maxlength(100),
version Integer
}

entity DigiRemitUser(t_digiremit_user) {
creationDate Instant required,
email String  required pattern(/^[^@\s]+@[^@\s]+\.[^@\s]+\$/),
firstname String maxlength(50),
msisdn String maxlength(20),
name String maxlength(50),
updateDate Instant
}

relationship ManyToOne {
DigiRemitUser{userProfile} to UserProfile
}

entity UserConnection(t_user_connection) {
logoutDate Instant
}

relationship ManyToOne {
UserConnection{digiRemitUser} to DigiRemitUser
}

entity UserProfile(t_user_profile) {
creationDate Instant required,
description String maxlength(255),
name String maxlength(100),
updateDate Instant
}

entity Workflow(t_workflow) {
comment String maxlength(255),
name String  required maxlength(100),
active Boolean required,
version Integer
}

entity WorkflowAction(t_workflow_action) {
active Boolean required,
label String  required maxlength(100),
name String  required maxlength(100),
version Integer
}

entity WorkflowCondition(t_workflow_condition) {
active Boolean required,
label String  required maxlength(100),
name String  required maxlength(100),
version Integer
}

entity WorkflowEvent(t_workflow_event) {
active Boolean required,
label String  required maxlength(100),
version Integer
}

entity WorkflowSelection(t_workflow_selection) {
active Boolean required,
label String  required maxlength(100),
comment String maxlength(255)
}

relationship ManyToOne {
WorkflowSelection{beneficiaryType} to BeneficiaryType,
WorkflowSelection{meansofpaymentType} to MeansofpaymentType,
WorkflowSelection{merchant} to Customer           ,

WorkflowSelection{partner} to Partner,
WorkflowSelection{service} to DigiRemitService,
WorkflowSelection{transactionType} to TransactionType,
WorkflowSelection{workflow} to Workflow
}

entity WorkflowStep(t_workflow_step) {
comment String maxlength(50),
priority Integer
}

relationship ManyToOne {
WorkflowStep{workflowAction} to WorkflowAction,
WorkflowStep{workflowCondition} to WorkflowCondition,
WorkflowStep{workflowEvent} to WorkflowEvent,
WorkflowStep{finalTransactionStatus} to TransactionStatus,
WorkflowStep{initialTransactionStatus} to TransactionStatus,
WorkflowStep{workflow} to Workflow
}

//-----------------------------------------------------------------------------------

entity ConfigFileData(t_config_file_data) {
extension String,
active Boolean
}

relationship ManyToOne {
ConfigFileData{ftp} to ConfigFTP
}

entity ConfigFTP(t_config_ftp) {
ftpHost String,
ftpPort String,
ftpUser String,
ftpPathIn String,
ftpPathout String,
dateCreation Instant,
active Boolean
}

relationship ManyToOne {
ConfigFTP{partner} to Partner,
ConfigFTP{service} to DigiRemitService
}

entity ConfigService(t_config_service) {
externalLimite Boolean,
externalFees Boolean,
externalSecurity Boolean,
dateCreation Instant,
dateUpdate Instant,
active Boolean
}

relationship ManyToOne {
ConfigService{apiExternalLimite} to ExternalApi,
ConfigService{configFileData} to ConfigFileData,
ConfigService{apiExternalSecurity} to ExternalApi,
ConfigService{apiExternalFees} to ExternalApi,
ConfigService{serviceAuthenticationLocal} to ServiceAuthentication
ConfigService{service} to DigiRemitService
}

entity ExternalApi(t_external_api) {
code String,
label String,
url String,
urlAuthentication String,
pathKey String,
methodSendingData Method,
parameter String,
active Boolean
}

relationship ManyToOne {
ExternalApi{partner} to Partner
}

entity GeneralConfig(t_general_config) {
urlExchangeRate String
}

enum Method {
REST, POST
}

entity Sender(t_sender) {
active Boolean required,
number String  maxlength(25),
firstname String,
lastname String,
mobilePhone String maxlength(20),
homePhone String maxlength(20),
workPhone String maxlength(20)
}

entity SenderDocument(t_person_document) {
active Boolean required,
documentNumber String maxlength(50),
expirationDate String maxlength(10),
isValid Boolean required,
version Integer
}

relationship ManyToOne {
SenderDocument{document} to DocumentType,
SenderDocument{person} to Sender
}

entity ServiceChannel(t_service_channel) {
active Boolean,
version	Integer
}

relationship ManyToOne {
ServiceChannel{service} to DigiRemitService,
ServiceChannel{channel} to TransactionChannel
}

entity ServiceCountrySource(t_service_country_source) {
active Boolean,
dateCreation Instant,
dateLastEdit Instant
}

relationship ManyToOne {
ServiceCountrySource{service} to DigiRemitService,
ServiceCountrySource{country} to Country,
ServiceCountrySource{currency} to Currency
}

entity ServiceCountryRecipient(t_service_country_recipient) {
active Boolean,
dateCreation Instant,
dateLastEdit Instant
}

relationship ManyToOne {
ServiceCountryRecipient{service} to DigiRemitService,
ServiceCountryRecipient{country} to Country
}

entity ServiceMeansOfPayment(t_service_means_of_paie) {
active Boolean,
version Integer
}

relationship ManyToOne {
ServiceMeansOfPayment{service} to DigiRemitService,
ServiceMeansOfPayment{meansofpaymentType} to MeansofpaymentType
}

///======== Emmanuel Don

entity ConfigPolicyUser(t_config_policy_user_service){

dateCreation Instant,
dateUpdate Instant,
nbreTentativePpossible Integer,

}
relationship ManyToOne {
ConfigPolicyUser{caractereType} to CaractereType,
ConfigPolicyUser{tapplication} to TApplication
}

entity TApplication(t_application){
label String,
active Boolean,
version Integer,
dateCreation Instant,
dateUpdate Instant
}

entity CaractereType(t_caractere_type){
label String,
valeur String,
active Boolean,
version Integer,
dateCreation Instant,
dateUpdate Instant
}

microservice Contract, ContractDetail, ContractOpposition, Meansofpayment, Beneficiary with FrontOfficeService

dto * with mapstruct
service * with serviceImpl
paginate * with pagination
//paginate B, C with infinite-scroll
//filter A, B

## ajay

# Conventional Hello World in Jython
print "Hello World!"

## JDK-releases-v1

m=('January','February','December','May','September','July','March')
y=1995
i=0
c=(1,4,2,5)
for i in range(43):
y+=1 if i<3 else 2 if i<7 else 5 if i<8 else 3 if i<10 else 0 if i%2 else 1
q=i if i<4 else c[i-4] if i<8 else 4 if i%2 else 6
print 'JDK %s %s released in %s %s' % ('1.%d'%i if i<5 else i,'was' if i<11 else 'will be',m[q],y)

## tutu

from java.util import Date
d = Date()
print d

# Conventional Hello World in Jython
print "Hello World!"

## Execute Jython Online

# Conventional Hello World in Jython
print "Hello World!"

## Execute Jython Online

# Conventional Hello World in Jython
print "Hello World!"

## 1234

# Conventional Hello World in Jython
print "Hello World!"