Live Batches
Masterclasses
Menu
Free Courses
Account
Login / Sign Up

Calculate Movie Ticket Price Based on Age, Day and Seat Type

Basic Acceptance 96.93% Points 10

You are given a viewer's age, the day of the week, and the seat type. Your task is to calculate the final movie ticket price by applying the appropriate discounts to the base price.

The base ticket prices are as follows:

  • Regular seat: ₹150.
  • Premium seat: ₹250.

The discounts are applied as follows:

  • A 20% discount is applied for children under 12 years old or seniors above 60 years old.
  • An additional 10% discount is applied on weekdays.
  • Both discounts are applied independently, with the weekday discount calculated on the price after the age-based discount.
Examples
Example 1

Input: age = 30, day = Saturday, seat = regular
Output: 150
Explanation: No discount applies to an adult on a weekend, so the ticket price remains ₹150.

Example 2

Input: age = 10, day = Monday, seat = regular
Output: 108
Explanation: The child discount reduces the price from ₹150 to ₹120. The additional 10% weekday discount reduces it to ₹108.

Example 3

Input: age = 65, day = Sunday, seat = premium
Output: 200
Explanation: The senior discount reduces the premium ticket price from ₹250 to ₹200. No weekday discount applies on Sunday.

Constraints
  • 0 = age = 120
  • Day is either a weekday or weekend; seat type is either regular or premium.
Topics
Data Structures Basics
Companies
Apple DE Shaw
Added 30 Oct 2026 96.93% acceptance
Ln 1, Col 1Sign in to save your code
10 Monday Regular
108