Hello everybody, I am trying to make a simple program however whenever I run it and input the age as 18 picking Film 4 it simply does not go onto the datetime part, it just closes. It does this with all 4 if statements. So if I was input Film 2 at 16 (which is compatible and should send me to the DateTime text at the bottom) the program seems to ignore it. I don't know if you understand me but I'd really appreciate some help. Thank you. I'm a new programmer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Homework
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Welcome to the Aquinas Multiplex \n We are
presently showing:");
Console.WriteLine(" 1. Teenage Horror Film (15) \n 2. How I Live
Now (15) \n 3. Another Marvel Film (12) \n 4. Filth (18) \n 5. Planes
(U)");
Console.WriteLine("Enter your age:");
int Age = int.Parse(Console.ReadLine());
Console.WriteLine("Enter the number of the film you wish to see");
int Film = int.Parse(Console.ReadLine());
{
if (Film < 1 || Film > 5)
Console.WriteLine("Access Denied - No such film");
if (Film == 1 || Film == 2 && Age < 15)
Console.WriteLine("Access Denied - You are too young");
if (Film == 3 && Age < 12)
Console.WriteLine("Access Denied - You are too young");
if (Film == 4 && Age < 18)
Console.WriteLine("Access Denied - You are too young");
Console.ReadLine();
Environment.Exit(0);
Console.WriteLine("Enter DD/MM/YY you wish to see the
film");
Console.ReadLine();
DateTime Date = DateTime.Parse(Console.ReadLine());
}
{
}
}
}
}
Aucun commentaire:
Enregistrer un commentaire