If statement problem (tip calculator)
古いコメントを表示
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 件のコメント
@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.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Functional Programming についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!