Advertisement
Guest User

Untitled

a guest
Jun 16th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.82 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace RileyConsoleApp
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             var defaultUser = new User()
  11.             {
  12.                 Username = "rileyhempel",
  13.                 Password = "abc123",
  14.                 EmailAddress = "rileyhempel@outlook.com",
  15.                 Pet = new Pet()
  16.                 {
  17.                     Name = "Doggo",
  18.                     Type = "Cat"
  19.                 }
  20.             };
  21.  
  22.             Console.WriteLine("Enter your username:");
  23.             var username = Console.ReadLine();
  24.             if (username != defaultUser.Username)
  25.             {
  26.                 Console.WriteLine("Sorry, this user does not exist.");
  27.                 Console.ReadLine();
  28.                 return;
  29.             }
  30.  
  31.             Console.WriteLine("Enter your password:");
  32.             var password = Console.ReadLine();
  33.             if (password != defaultUser.Password)
  34.             {
  35.                 Console.WriteLine("Sorry, that password is incorrect.");
  36.                 Console.ReadLine();
  37.                 return;
  38.             }
  39.  
  40.             Console.WriteLine("You have successfully logged in.");
  41.  
  42.             Console.WriteLine($"Your pet's name is {defaultUser.Pet.Name} and it is a {defaultUser.Pet.Type}");
  43.  
  44.             Console.ReadLine();
  45.         }
  46.     }
  47.  
  48.     public class Car
  49.     {
  50.         public string Body { get; set; }
  51.         public string Trail { get; set; }
  52.     }
  53.  
  54.     public class User
  55.     {
  56.         public string Username { get; set; }
  57.         public string Password { get; set; }
  58.         public string EmailAddress { get; set; }
  59.         public Pet Pet { get; set; }
  60.     }
  61.  
  62.     public class Pet
  63.     {
  64.         public string Name { get; set; }
  65.         public string Type { get; set; }
  66.     }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement