Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- decimal busdistance;
- decimal attempts = 0;
- decimal traindistance;
- decimal taxidistance;
- decimal cardistance;
- decimal buspass;
- decimal taximile;
- decimal trainticket;
- string[] username = { "a", "b", "c", };
- string[] password = { "x", "y", "z", };
- for (int i = 0; i < 3; i++)
- {
- while (username[i] != password[i])
- {
- Console.SetWindowSize(50, 28);
- Console.BackgroundColor = ConsoleColor.Gray;
- Console.Clear();
- Console.ForegroundColor = ConsoleColor.Red;
- Console.SetCursorPosition(13, 1);
- Console.WriteLine("Enter Your Login Details");
- Console.ForegroundColor = ConsoleColor.DarkGreen;
- Console.SetCursorPosition(15, 6);
- Console.Write("Username: ");
- Console.ForegroundColor = ConsoleColor.Black;
- Console.ReadLine();
- Console.ForegroundColor = ConsoleColor.DarkGreen;
- Console.SetCursorPosition(15, 9);
- Console.Write("Password: ");
- Console.ForegroundColor = ConsoleColor.Black;
- Console.ReadLine();
- Console.WriteLine();
- attempts = attempts + 1;
- if (attempts == 3)
- {
- break;
- }
- }
- if (attempts == 3)
- {
- Console.BackgroundColor = ConsoleColor.Red;
- Console.Clear();
- Console.SetCursorPosition(13, 13);
- Console.Write("You have been locked out!");
- Console.ReadLine();
- System.Environment.Exit(1);
- }
- else
- {
- Console.ForegroundColor = ConsoleColor.DarkRed;
- Console.SetCursorPosition(13, 12);
- Console.WriteLine("You have granted access");
- Console.ForegroundColor = ConsoleColor.DarkBlue;
- Console.SetCursorPosition(4, 16);
- Console.WriteLine("Would you like to look at the help screen?");
- Console.SetCursorPosition(21, 18);
- Console.Write("Yes or No:");
- string help = Console.ReadLine();
- if (help == "Yes" || help == "yes")
- {
- Console.Clear();
- Console.BackgroundColor = ConsoleColor.Gray;
- Console.ForegroundColor = ConsoleColor.Red;
- Console.SetCursorPosition(23, 1);
- Console.WriteLine("Help");
- Console.ReadLine();
- }
- else
- {
- Console.Clear();
- Console.BackgroundColor = ConsoleColor.Gray;
- Console.ForegroundColor = ConsoleColor.Red;
- Console.Write("What is the distance travelled by bus: ");
- busdistance = Convert.ToDecimal(Console.ReadLine());
- Console.WriteLine("The distance traveled by bus is " + busdistance);
- Console.WriteLine();
- Console.Write("What is the distance travelled by train: ");
- traindistance = Convert.ToDecimal(Console.ReadLine());
- Console.WriteLine("The distance traveled by train is " + traindistance);
- Console.WriteLine();
- Console.Write("What is the distance travelled by car: ");
- cardistance = Convert.ToDecimal(Console.ReadLine());
- Console.WriteLine("The distance traveled by car is " + cardistance);
- Console.WriteLine();
- Console.Write("What is the distance travelled by taxi: ");
- taxidistance = Convert.ToDecimal(Console.ReadLine());
- Console.WriteLine("The distance traveled by taxi is " + taxidistance);
- Console.WriteLine();
- Console.Write("What is the cost of a day bus pass: ");
- buspass = Convert.ToDecimal(Console.ReadLine());
- Console.WriteLine("The cost of a day bus pass is " + buspass);
- Console.WriteLine();
- Console.Write("What is the cost per mile in a taxi: ");
- taximile = Convert.ToDecimal(Console.ReadLine());
- Console.WriteLine("The cost per mile with a taxi is " + taximile);
- Console.WriteLine();
- Console.Write("What is the cost for a train ticket: ");
- trainticket = Convert.ToDecimal(Console.ReadLine());
- Console.WriteLine("The cost for a train ticket is " + trainticket);
- Console.WriteLine("Click Enter to show your costings and you cheapest method.");
- Console.ReadLine();
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement