GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — dotnet_basic_program/Program.cs at master · karunb09/dotnet_basic_program

Expand file tree

/

Program.cs

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
163 lines (155 loc) · 6.66 KB
/

Program.cs

Copy path

File metadata and controls

163 lines (155 loc) · 6.66 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
using System;
namespace assn1
{
class Program
{
static void Main(string[] args)
{
int count = 0, check;
bool age;
char a;
string name, x;
decimal cost = 7.85M;
double amount = 0;
Console.WriteLine("Enter your name: ");
name = Console.ReadLine();
while (name == "")
{
Console.WriteLine("Sorry, Please Enter you name ?");
name = Console.ReadLine();
}
do
{
do
{
Console.WriteLine("Enter your age(>=15, <= 90) ?");
//String x = int.Parse(Console.ReadLine());
x = Console.ReadLine();
} while (x == "");
check = int.Parse(x);
if (check >= 15 && check <= 90)
{
age = true;
}
else if (check > 90)
{
Console.WriteLine("You are too old to watch a movie");
age = false;
}
else
{
age = false;
Console.WriteLine("Your Age is below 15, you need a guardian to book a ticket.");
Console.WriteLine($"Sorry! {name} you have to be above 15+ to buy movie ticket.");
}
int selection;
String[] movies_tiers = { "Standard", "Imax", "Imax-3D" };
while (age)
{
do
{
for (int i = 0; i < movies_tiers.Length; i++)
{
Console.WriteLine($"{i + 1}. {movies_tiers[i]}");
}
selection = Convert.ToInt32(Console.ReadLine());
if (selection > 3)
{
Console.WriteLine("Wrong option selected !!");
}
} while (selection > 3);
switch (selection)
{
case 1:
Console.WriteLine("you have selected {0} type.", movies_tiers[0]);
break;
case 2:
Console.WriteLine("you have selected {0} type.", movies_tiers[1]);
break;
case 3:
Console.WriteLine("you have selected {0} type.", movies_tiers[2]);
char glasses_check;
do
{
Console.WriteLine("Do you have 3D glasses (y/n)?");
glasses_check = char.Parse(Console.ReadLine());
if (glasses_check == 'y')
{
Console.WriteLine("Great !!");
selection = 2;
break;
}
else if (glasses_check == 'n')
{
Console.WriteLine("Extra 2$ for each ticket will be added");
break;
}
else
{
Console.WriteLine("please type y or n !!");
}
} while (glasses_check != 'y' || glasses_check != 'n');
break;
}
Console.WriteLine("Enter number of tickets");
int num = int.Parse(Console.ReadLine());
if (selection == 1 || selection == 2)
{
switch (num)
{
case 1:
Console.WriteLine($"The Total cost of ticket(s) is {calculate(num, cost)}");
count += 1;
break;
case 2:
Console.WriteLine($"The Total cost of ticket(s) is {calculate(num, cost)}");
count += 2;
break;
case 3:
Console.WriteLine($"The Total cost of ticket(s) is {calculate(num, cost)}");
count += 3;
break;
default:
Console.WriteLine($"{name} you can only buy 1 or 2 or 3 tickets per Transaction.\nsorry !!");
break;
}
}
else
{
switch (num)
{
case 1:
Console.WriteLine($"The Total cost of ticket(s) is {calculate(num, cost)+2}");
amount += 2;
count += 1;
break;
case 2:
Console.WriteLine($"The Total cost of ticket(s) is {calculate(num, cost)+4}");
amount += 4;
count += 2;
break;
case 3:
Console.WriteLine($"The Total cost of ticket(s) is {calculate(num, cost)+6}");
amount += 6;
count += 3;
break;
default:
Console.WriteLine($"{name} you can only buy 1 or 2 or 3 tickets per Transaction.\nsorry !!");
break;
}
}
age = false;
}
double calculate(int c, decimal d)
{
double result = decimal.ToDouble(c * d);
amount += result;
return amount;
}
Console.WriteLine("Do you want to continue again (y/n)?");
a = char.Parse(Console.ReadLine());
} while (a.Equals('y') || a.Equals('Y'));
Console.WriteLine("{0}, Total Number of Tickets are {1} and total cost is {2}.\nThank You! and have a nice day.", name, count, amount);
}
}
}
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.