2025-01-19

Introduction

  • Welcome!
  • Today, I’ll be presenting a simple Shiny application: A Tip Calculator.

The Problem

  • Calculating tips can sometimes be cumbersome, especially when dealing with multiple people or different tip percentages.

The Solution: A Shiny App

  • My Shiny app provides a user-friendly interface to:
    • Enter the total bill amount.
    • Select the desired tip percentage using a slider.
    • Instantly see the calculated tip amount and the total bill amount.

Application Demonstration

  • (Insert a screenshot of your running Shiny app here)

  • Key Features:

    • Intuitive user interface with clear input fields.
    • Dynamic calculations: Tip and total bill are updated in real-time as the user adjusts the tip percentage.
    • User-friendly guidance on how to use the application.

Code Example: Tip Calculation Function

calculate_tip <- function(bill_amount, tip_percentage) {
  tip_amount <- bill_amount * (tip_percentage / 100)
  total_bill <- bill_amount + tip_amount
  return(c(tip_amount = round(tip_amount, 2), total_bill = round(total_bill, 2)))
}

# Example usage
bill_amount <- 50 
tip_percentage <- 20
calculate_tip(bill_amount, tip_percentage)
## tip_amount total_bill 
##         10         60