problem with my task

Status
Not open for further replies.

hiseiba

New member
Joined
Oct 8, 2022
Messages
2
Programming Experience
Beginner
dag iedereen ik was mijn taak voor school aan het maken en ik snap echt niet wat de probleem van mijn codes zijn kan iemand me helpen

schooltaak:
Ontwerp een console toepassing waarmee je berekent hoeveel iemand voor een bioscoopkaartje moet betalen.
De volle prijs van een bioscoopticket bedraagt 13,70 EUR.
Op basis van de leeftijd wordt de prijs bepaald:
Jonger dan 5 jaar: gratis;
Tussen de 5 en de 12: halve prijs;
Tussen de 13 en de 54: vol tarief;
55+: gratis

mijn codes:
//declaration variables
const double cdblFullPriceTicket = 13.70;
double dblEndPriceTicket;
int intAge;

dblEndPriceTicket = 0;

//entry
Console.Write("How old are you: ");
intLeeftijd = Convert.ToInt32(Console.Read()); ;


if (intAge < 5)
{

//output
Console.WriteLine();
Console.Write("your cinema ticket is free.");
}
else if (intAge >= 5 && intAge<= 12)
{
//Calculation
dblEndPriceTicket = cdblFullPriceTicket / 2;

//output
Console.WriteLine();
Console.Write("you must pay " + Math.Round(dblEindPriceTicket, 2).ToString() + "EUR.");
}
else if (intAge >= 13 && intAge <= 54)
{
//calculation
dblEndPriceTicket = cdblFullPriceTicket;

//export
Console.WriteLine();
Console.Write("you must pay " + Math.Round(dblEindPriceTicket, 2).ToString() + "EUR.");
}
else if (intAge >= 55)
{

//output
Console.WriteLine();
Console.Write("your cinema ticket is free.");
}
else
{
Console.WriteLine();
Console.Write("you don't enter any data");
}


Console.ReadKey();

Translated with www.DeepL.com/Translator (free version)
 
Unfortunately this is an English language forum. Closing this thread. It looks like you started another thread in English.
 
Status
Not open for further replies.

Similar threads

Back
Top Bottom