Answer:
Using Javascript,
function calTotal( subtotal, gratuity){
 gratuityValue = subtotal * (gratuity/100)
 total = subtotal + gratuityValue
 console.log( "gratuity: ", gratuityValue , "\nTotal: ", total)
}
Explanation:
The javascript function above is able to collect two parameters subtotal and gratuity rate in percentage and calculate the total and gratuity value, and displays it on the console.