What would be the transient attribute’s value if it was written in Groovy?

You want to display a calculation of the total compensation for an employee. The total
compensation is the salary plus the salary multiplied by any commission percentage. The salary
and commission percentage are stored in the database, but the total compensation is not. A
transient attribute has been defined in the employee entity object to display the total
compensation. What would be the transient attribute’s value if it was written in Groovy?

You want to display a calculation of the total compensation for an employee. The total
compensation is the salary plus the salary multiplied by any commission percentage. The salary
and commission percentage are stored in the database, but the total compensation is not. A
transient attribute has been defined in the employee entity object to display the total
compensation. What would be the transient attribute’s value if it was written in Groovy?

A.
(Salary!=null ? Salary: 0) + (Salary* (CommissionPct ! =null : CommissionPct ? 0))

B.
(Salary! =null ? Salary : 0) +- (Salary* (CommissionPct:) )

C.
(Salary! =null : Salary*? 0) + (Salary* (CommissionPct !=null ? CommissionPct : 0) )

D.
(Saiary!=null ? Salary: 0) +(Salary* (CommissionPct ==null ? CommissionPct : 0) )

E.
(Salary !=null 7 Salary: 0) + (Salary* (CommissionPct !=null ? CommissionPct ; 0))

Explanation:
http://st-curriculum.oracle.com/obe/jdev/obe11jdev/ps1/adfbc_new_features/adfbc.html
(topic: creating calculated attributes; second point)



Leave a Reply 5

Your email address will not be published. Required fields are marked *


Abdullah

Abdullah

All answers as wrong. Maybe because of copy process.
If answer A
(Salary!=null ? Salary: 0) + (Salary* (CommissionPct ! =null : CommissionPct ? 0))
actually is:
(Salary!=null ? Salary: 0) + (Salary* (CommissionPct ! =null ? CommissionPct : 0))
it could be right answer

achilles

achilles

C.
(Salary! =null : Salary*? 0) + (Salary* (CommissionPct !=null ? CommissionPct : 0) )

Donnerbalken

Donnerbalken

D. All other answers do not use the ternary operator in a correct way

Donnerbalken

Donnerbalken

Ups. D is wrong, too. Abdullah is right, there should be a typo in one of the given answers…

MuhammadYassein

MuhammadYassein

all Answers are wrong

this is Correct Answer

(Salary!=null ? Salary: 0) +
(
(Salary!=null ? Salary: 0) * (CommissionPct !=null ? CommissionPct : 0)
)