0
I am making a website to calculate account in the restaurant ,which is calculated in different example ways, in the account goes the items : main course, dessert, service fee, drink and snacks. Being that the bill is divided by quantity of people on the table example : are 5 people and the bill gives in total 450, main crying costs 150, dessert 100, drinks 100, service fee 50 and snack 50. Only obligatory to pay are the main delivery, dessert and drinks . Where the value goes to 350 divided into 5 is 70 for each person.
To leave so on the left the total of people , the total of items required to pay, the items served and on the last lines the items charged. On the right hand side the total of all items in the account, the amount for each one to pay and the total amount of items required to pay .
The codes I made but locked
function cobrar(entradas) {
const linha =entradas.trim().replace('\n')
for (let index = 0; index < linha.length; index++) {
if (!linha||linha==='') {
return
}else if (linha) {
}
}
}
Actually the input codes are right I just wanted to solve the calculation function of how to calculate the account.