-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
executable file
·107 lines (99 loc) · 4.32 KB
/
Program.cs
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
using System;
namespace daynegame234
{
class Program
{
static void Main(string[] args)
{
//Start the program with Clear();
Console.Clear();
//get user input
// Console.WriteLine("Q1 - aks and display names");
// System.Console.WriteLine("******************************");
// System.Console.Write("Please enter your firstname:");
// var name = Console.ReadLine();
// System.Console.WriteLine($"Your firstname is {name}");
// System.Console.WriteLine("");
// // System.Console.WriteLine("******************************");
// System.Console.Write("Please enter lastname:");
// var lastname = Console.ReadLine();
// System.Console.WriteLine($"Your lastname is {lastname}");
// System.Console.WriteLine("");
// // System.Console.WriteLine("******************************");
// Console.WriteLine("");
// System.Console.WriteLine($"So your full name is {name} {lastname}");
// System.Console.WriteLine("*********************************");
// Console.WriteLine("Q2 - Ask the user for a number input");
// Console.WriteLine("************************************");
// bool keepgoing = true;
// do
// {
// Console.WriteLine("Please enter a number");
// var numberinput = Console.ReadLine();
// var number1 = int.Parse(numberinput);
// }
// while (keepgoing == true);
// {
// Console.ReadLine();
// }
bool domile = true;
do
{
Console.WriteLine("Enter the code for what you want to convert");
Console.WriteLine("");
Console.WriteLine("Kilometres to Miles Code: KTM");
Console.WriteLine("Miles to Kilometres Code: MTK");
Console.WriteLine("");
Console.WriteLine("QUIT Code:QUIT");
Console.WriteLine("");
Console.Write("Enter Code:");
var KTM = "KTM";
var MTK = "MTK";
var userinput = Console.ReadLine();
var QUIT = "QUIT";
if (userinput == MTK)
{
Console.WriteLine("ENTER THE NUMBER OF MILES TO KILOMETRES:");
double number = double.Parse(Console.ReadLine());
double convertedNumber = Math.Round(number * 1.60934, 2);
Console.WriteLine("");
Console.WriteLine($"{convertedNumber}KM");
Console.WriteLine("");
Console.WriteLine("PRESS ENTER TO DO ANOTHER CALCULATION OR PRESS ENTER THEN TYPE QUIT TO QUIT THE APP");
Console.ReadLine();
}
else if (userinput == KTM)
{
Console.WriteLine("ENTER THE NUMBER OF KILOMETRES TO MILES:");
double number = double.Parse(Console.ReadLine());
double convertedNumber = Math.Round(number * 0.62137119, 2);
Console.WriteLine("");
Console.WriteLine($"{convertedNumber}MILES");
Console.WriteLine("");
Console.WriteLine("PRESS ENTER TO DO ANOTHER CALCULATION OR PRESS ENTER THEN TYPE QUIT TO QUIT THE APP");
Console.ReadLine();
}
else if (userinput == QUIT)
{
domile = false;
Console.WriteLine("THANK YOU FOR USING THE APPLICATION PRESS ENTER TO CLOSE");
}
else
{
Console.WriteLine("");
Console.WriteLine("YOU DIDN'T ENTER THE RIGHT CODE PRESS ENTER TO START AGAIN");
Console.ReadLine();
}
}
while(domile == true);
{
Console.ReadLine();
}
//End the program with blank line and instructions
Console.ResetColor();
Console.WriteLine();
Console.WriteLine("Press <Enter> to quit the program");
Console.ReadKey();
}
}
}