The provided code calculates the tip for a fixed bill amount. Your task is to complete the code to allow users to input the bill amount and the tip percentage, and then calculate and display the tip amount using a computed property.
What are computable properties
Fixed bill amount
Report a typo
Fill in the gaps with the relevant elements
<template>
<div>
<p>Bill Amount ($): <input v-model="billAmount" type="number" /></p>
<p>Tip Percentage (%): <input v-model="tipPercentage" type="number" /></p>
<p>Tip Amount ($): {{ tipAmount }}</p>
</div>
</template>
<script setup>
import { , } from 'vue'
const billAmount = // Initial bill amount
const tipPercentage = ref(15) // Initial tip percentage
const = computed(() => {
return (billAmount.value * (tipPercentage.value / 100)).toFixed(2)
})
</script>Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.