Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Timers;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace TestingProject
- {
- class Program
- {
- public static string ID, Password, Answer;
- public static int Error = 3;
- static void Main()
- {
- Console.WriteLine("_______________________________________________________________________________________________");
- Console.WriteLine("| |");
- Console.WriteLine("|Available Programs: All, BinaryConversion, LoginAttempt, NumberTriangle, NameandSum, Counter.|");
- Console.WriteLine("|_____________________________________________________________________________________________|");
- Console.Write("Choose a program: ");
- Answer = Console.ReadLine();
- if (Answer == "All")
- {
- GetIDandPass();
- Console.WriteLine();
- BinaryConversion();
- Console.WriteLine();
- NumberTriangle();
- Console.WriteLine();
- NameandSum();
- Console.WriteLine();
- Reset();
- }
- if (Answer == "BinaryConversion")
- {
- BinaryConversion();
- Console.WriteLine();
- Reset();
- }
- if (Answer == "LoginAttempt")
- {
- GetIDandPass();
- Console.WriteLine();
- Reset();
- }
- if (Answer == "NumberTriangle")
- {
- NumberTriangle();
- Console.WriteLine();
- Reset();
- }
- if (Answer == "NameandSum")
- {
- NameandSum();
- Console.WriteLine();
- Reset();
- }
- if (Answer == "Counter")
- {
- Counter();
- Console.WriteLine();
- Reset();
- }
- }
- static void LoginAttempt()
- {
- Console.Write("Please login with the format <username> <password>: ");
- string Login = Console.ReadLine();
- if (Login != ID + " " + Password)
- {
- if (Error >= 1)
- {
- Console.Clear();
- Console.WriteLine("Please try again. You have " + (Error - 1) + " tries left.");
- Error -= 1;
- }
- if (Error < 1)
- {
- Console.WriteLine("Terminating Command Window.");
- Environment.Exit(0);
- }
- LoginAttempt();
- }
- if (Login == ID + " " + Password)
- {
- Console.WriteLine("Welcome, " + ID);
- }
- }
- static void NumberTriangle()
- {
- Console.Write("Enter a number that is less than 15: ");
- int PastaNum = Convert.ToInt32(Console.ReadLine());
- Console.Write("Enter the width that is less than 15: ");
- int width = Convert.ToInt32(Console.ReadLine());
- if (PastaNum < 15 && width < 15)
- {
- int height = width;
- for (int row = 0; row < height; row++)
- {
- for (int column = 0; column < width; column++)
- {
- Console.Write(PastaNum);
- }
- Console.WriteLine();
- for (int spacer = 0; spacer < width; spacer++)
- {
- Console.Write("~");
- }
- Console.WriteLine();
- width--;
- }
- } else
- {
- Console.WriteLine("Please use smaller numbers.");
- NumberTriangle();
- }
- }
- static void NameandSum()
- {
- Console.Write("Please enter your first name: ");
- string FirstName = Console.ReadLine();
- Console.Write("Please enter your last name: ");
- string LastName = Console.ReadLine();
- Console.Write("Enter a number: ");
- string NumOne = Console.ReadLine();
- long NumOne64Bit = Convert.ToInt64(NumOne);
- Console.Write("Enter another number: ");
- string NumTwo = Console.ReadLine();
- long NumTwo64Bit = Convert.ToInt64(NumTwo);
- long Sum64 = NumOne64Bit + NumTwo64Bit;
- string YourSum = ("The sum of " + NumOne + " and " + NumTwo + " is: " + Sum64 + ". Good job " + FirstName + " " + LastName + "!");
- Console.WriteLine(YourSum);
- }
- static void BinaryConversion()
- {
- Console.Write("Enter a big number: ");
- int Num = Convert.ToInt32(Console.ReadLine());
- string Result = "";
- while (Num >1)
- {
- int Remainder = Num % 2;
- Result = Convert.ToString(Remainder) + Result;
- Num /= 2;
- }
- Result = Convert.ToString(Num) + Result;
- Console.WriteLine("Binary: {0}", Result);
- }
- static void GetIDandPass()
- {
- Console.Write("Please enter your username: ");
- ID = Console.ReadLine();
- Console.Write("Pleas enter your password: ");
- Password = Console.ReadLine();
- LoginAttempt();
- }
- static void Reset()
- {
- Answer = null;
- Main();
- }
- static void Counter()
- {
- Console.Write("Please enter a number: ");
- int Num = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine();
- Console.Write("| " + Num + " | ");
- for (int i = 0; i < 10; i++)
- {
- System.Threading.Thread.Sleep(500);
- Console.Write((Num *= 2) + " | ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement