Computer Science, asked by swethachowdary845, 11 months ago

According to a 24-hour clock, the show timings are 10.15, 13.30, 18.00 and 22.00. The normal price of an adult ticket is $8.00. However, the price of an adult ticket for the matinee show is $5.00. Adults are those over 13 years. The normal price of a child ticket is $4.00. However, the price of a child ticket for the matinee show is $2.00. Write a program that determines the price of a movie ticket.

Answers

Answered by noushin99882
12

Answer:

#include<iostream>

using namespace std;

int main()

{

 int a;

 float b;

 float x=10.15,y=13.30,z=18.00,m=22.00;

cin>>a>>b;

 if(a>13||a>=18)

{{

if(b==y || b==z){cout<<"$5.00";

}

else{

cout<<"$8.00";

}

}

 else if(  a<18)

{

if(b==y||b==z)

{

cout<<"$2.00";

}

else{cout<<"$4.00";

}

                    }

}

Explanation:

Answered by VismayaDevashya
0

Explanation:

The following code was written in python:

Age = input("Enter your age \n")

x = input("Are you attending a Maintainee show? \n Type 1 for yes and 0 for no \n")

if(x==1):

if(Age<13):

print("The price for your ticket is $2.00")

else:

print("The price for your ticket is $5.00")

else:

if(Age<13):

print("The price of your ticket is $4.00")

else:

print("The price of your ticket is $8.00")

  • So the code first takes value of age.
  • Then it takes a value of 1 for maintainee and 0 for not maintainee.
  • Then, if the age is less than 13 and is a maintainee it is considered a child-maintainee ticket
  • If the age is more than 13 and maintainee, it is considered as an adult maintainee ticket.
  • Now if the value of maintainee is not 1 (The else statement), it again checks the age.
  • If the age is less than 13 it considers it as a normal child ticket.
  • If the age is more than 13 it considers it as a normal adult ticket.

Project code #SPJ2

Similar questions