Course Project
Alper Gondiken
2014-07-27
Scenario: You go to a restaurant and don't know how much you should tip
This application helps you to calculate the tip you could leave, based on:
You input your bill amount on the slider in the sidebar
You input number of people dining on the second slider in the sidebar
Then you input your thoughts about the place by checking out the boxes in the sidebar



You and your three friends had dinner and your bill is £72
Your feedbacks are “Waitress was a smiling person” and “Service quality was high”
bill <- 72
size <- 4
feedback <- c("Smiling","High-quality")

Each positive feedback results in additional 5% tip on top of the min 5% (social norm)
Each additional person in the dining group will decrease the tip by 1%*
As the bill increases, tips tend to decrease percentage-wise*
*: Information comes from the research
tipModel <- function(bill,feedback,size){
#Every positive feedback counts for 5% tip on top of 5% minimum
feedback.reward <- length(feedback)*0.05 + 0.05
#Every incremental person in the group reduces the bill by 1%
size.penalty <- (1 - size*0.01)
#People tend to pay percentage-wise less tips when the bill is higher
bill.penalty <- (1 - bill*0.001)
tip <- round(bill*feedback.reward*size.penalty*bill.penalty,1)
tip
}
In the example from previous page, calculate the tip amount and total payment amount:
tipModel(bill,feedback,size) #Tip amount
[1] 9.6
bill + tipModel(bill,feedback,size) #Total payment
[1] 81.6