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.00

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: Weekday or weekend
  • Seat type: Regular or premium
Companies
Apple DE Shaw
Topics
Data Structures Basics
Solution.cs C#JavaPythonC++Javascript

Unlock the code editor

Sign in to write, run, and submit your solution against the full test suite.

  • Run code against sample & hidden test cases
  • Save submissions and track your streak
  • Compare with editorial & community solutions