Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A movie theater charges its customers for each film in accordance with the follo

ID: 3695708 • Letter: A

Question

A movie theater charges its customers for each film in accordance with the following rules: If the age entered is 12 or under, the program should display “Charge = $10.00” If the age entered is 13 or older, the program should display “Charge = $25.00” Seniors (age 65 or older) are given a 25% discount. However, if the time is earlier than 5, the charge should be $10.00 regardless of age. One exception: If the movie is part of a film festival, the charge will be $15.00 per seat regardless of age or time (hint: use a Boolean variable for this). Write a Java program that will allow the user to enter the values for integer variables age and time. An additional Boolean variable will be required to indicate if the movie in question is part of a film festival. The program should contain logic that will process the input and print (display) the correct output (i.e., the amount to be charged): Test your program with the following input combinations:

Explanation / Answer

TheaterCharges.java

package org.students;

import java.util.Scanner;

public class TheaterCharges {

   public static void main(String[] args) {
       //Declaring variables
       boolean ques=false;
       int age,time;
       //Scanner Object will read the user inputs
       Scanner sc=new Scanner(System.in);
      
       System.out.print("Enter Age::");
       age=sc.nextInt();
       System.out.print("Enter Time ::");
       time=sc.nextInt();
       System.out.println("Is this Movie is part of a film festival (true/false) ?");
       ques=sc.nextBoolean();
      
       //If block will execute if the Movie is part of film festival.
       //If not then else part will be executed.
       if(ques==true)
       {
           System.out.println(":: Charge is $15.00 ::");
       }
       else
       {
           //Here It will check whether that time is less than 5 or not
           //If the time is earlier than 5 the if block will gets executed.
           //if not then else part will be executed.
           if(time<5)
           {
               System.out.println(":: Charge is $10.00 ::");
           }
           else
           {
               //Here It will check whether the person is senior citizen or not.
               //if age is greater than 65 the if block will be executed.
               //If not ,else part will be executed.
               if(age>=65)
               {
                   System.out.println("For Seniors 25% discount.So Ticket Charge 18.75$::");
               }
               else
               {
                   //Here if the age is less than or equal to 12 then if block will gets executed.
                   if(age<=12)
                   {
                       System.out.println("::Charge = $10.00 ::");
                   }
                  
                   //Here if the age is greater than or equal to 13 then this block will gets executed.
                   else if(age>=13)
                   {
                       System.out.println(":: Charge = $25.00 ::");
                   }          
               }
      
              

           }
                      
       }


   }

}

_______________________________________________________________________________________

output:

Enter Age::69
Enter Time ::8
Is this Movie is part of a film festival (true/false) ?
true
:: Charge is $15.00 ::

___________________________________________________________________________

output2

Enter Age::40
Enter Time ::3
Is this Movie is part of a film festival (true/false) ?
false
:: Charge is $10.00 ::

____________________________________________________________________________________

output3:

Enter Age::67
Enter Time ::8
Is this Movie is part of a film festival (true/false) ?
false
For Seniors 25% discount.So Ticket Charge 18.75$::

_______________________________________________________________________________________

output4:

Enter Age::12
Enter Time ::8
Is this Movie is part of a film festival (true/false) ?
false
::Charge = $10.00 ::

________________________________________________________________________________________

output5:

Enter Age::25
Enter Time ::8
Is this Movie is part of a film festival (true/false) ?
false
:: Charge = $25.00 ::

________________________________________________________________________________________

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote