If statement problem (tip calculator)
Mostra commenti meno recenti
Im having trouble with this problem. I basically have to create a script that will receive an input as a billing amount and party size with an output calculation of a tip based on two conditions. The billing amount and party size should be considered during the calculations; if the bill is less than $10.00 the tip will be $1.80 and if the party size if greater than 2 persons an additional %32 will be included, if the bill is between $10.00 and $60.00 the tip is %18 and if the party size if greater than 4 persons an additional $4.20 will be included, if the bill is above $60.00 the tip is %20 and if the party size if greater than 6 persons an additional %13.33 will be included
1 Commento
@Erasmo Hinojosa: what is your question?
Note that your code concept will not work: you either need to use a loop with indexing, or get rid of the if's altogether and use logical indexing (better). if statements do not operate on different parts of vectors in the way that you are trying to use them.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Functional Programming in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!