Advertisement
yarin0600

Untitled

Dec 11th, 2023
538
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.26 KB | None | 0 0
  1. using System;
  2.  
  3. public class Program
  4. {
  5.     public static void Main()
  6.     {
  7.         System.Console.WriteLine("Hello!\nWelcome to my first VS  app!");
  8.         System.Console.WriteLine("Please type your name (and then press enter).");
  9.         string name = System.Console.ReadLine();
  10.         System.Console.WriteLine("Hello " + name + "!\nHave a very nice day!");
  11.         System.Console.WriteLine("Please type your desired salary (and then press enter).");
  12.        
  13.         string salaryStr = System.Console.ReadLine();
  14.         float salary = float.Parse(salaryStr);
  15.         salary *= 1.1f;
  16.         System.Console.WriteLine("Please type your desired working day (and then press enter).");
  17.         string workingDayStr = System.Console.ReadLine();
  18.         eWeekDay workingDay = (eWeekDay)Enum.Parse(typeof(eWeekDay), workingDayStr);
  19.         //string msg = "Hello " + name + "!\nYou are going to get $" + salary.ToString() + " an hour\nand you are going to work on " + workingDay.ToString() + "!\nBye bye " + name;
  20.         /*object[] args = new string[4];
  21.         args[0] = name;
  22.         args[1] = salary;
  23.         args[2] = workingDay.ToString();
  24.         args[3] = System.Environment.NewLine;//\n for all platforms*/
  25.         string msg = string.Format(
  26. @"Hello {0}!
  27. You are going to get {1:c} an hour
  28. and you are going to work on {2}!
  29. Bye bye         {0}",
  30.             name, salary, workingDay);
  31.         System.Console.WriteLine(msg);
  32.         SpeechLib.SpVoice voice = new SpeechLib.SpVoice();
  33.         voice.Speak(msg);
  34.     }
  35.     public enum eWeekDay
  36.     {
  37.         //I define the values can be inserted in enum set
  38.         //it let's you define for each value NAME
  39.         //Doesn't matter the values, Sunday=12 because
  40.         //I am not making any arithmetic operations on these enum
  41.         //starts with 0
  42.         Sunday,
  43.         Monday,
  44.         Tuesday,
  45.         Wednsday,
  46.         Thursday,
  47.         Friday,
  48.         Saturday
  49.         //In c# you cannot add logic [methods] to enum
  50.     }
  51.     public class WeekDay
  52.     {
  53.         private eWeekDay m_Value;
  54.         public static int m_Test;
  55.         public bool IsWeekEnd()
  56.         {
  57.             return m_Value == eWeekDay.Friday;
  58.         }
  59.     }
  60.  
  61.     public class Test
  62.     {
  63.         public Test() {}
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement