Guest User

Diogenes Calc C#

a guest
Nov 13th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.22 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace DiogenesCalc
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. Double a;
  14. Double b;
  15. int c = 0;
  16. string answer = null;
  17.  
  18. Console.WriteLine("Diogenes' Influence Calculator 1.0");
  19. Console.WriteLine("Credit: Diogenes of Sinope (#57714) & DezNutz (#54689)");
  20. START:
  21. Console.WriteLine();
  22. Console.WriteLine();
  23.  
  24. Console.WriteLine("Hello, please select a calculator option below:");
  25. Console.WriteLine("CD : Charity Donation Calculator");
  26. Console.WriteLine("P : Propaganda Calculator");
  27. Console.WriteLine("cls : Clears Console");
  28. Console.WriteLine("Exit : Exit Calculator");
  29. answer = Console.ReadLine();
  30. if (String.Equals(answer, "cd", StringComparison.OrdinalIgnoreCase))
  31. {
  32. cdstart:
  33. Console.WriteLine();
  34. Console.WriteLine("Charity Donation Calculator");
  35. Console.Write("Current Influence: ");
  36. a = Convert.ToDouble(Console.ReadLine());
  37. Console.Write("Target Influence: ");
  38. b = Convert.ToDouble(Console.ReadLine());
  39. if (a > b)
  40. {
  41. Console.WriteLine("ERROR: The Target Influence is less than the Current Influence.");
  42. Console.WriteLine("Please try again!");
  43. Console.WriteLine("Press any key to continue....");
  44. Console.ReadKey();
  45. goto cdstart;
  46. }
  47. else
  48. {
  49. while (a < b)
  50. {
  51. a = a + (a * .05);
  52. c++;
  53. }
  54. Console.WriteLine("It will take " + c + " Charity Donation Cards to reach this goal.");
  55. c = 0;
  56. Console.WriteLine("Press any key to continue....");
  57. Console.ReadKey();
  58. goto START;
  59. }
  60. }
  61. else if (String.Equals(answer, "p", StringComparison.OrdinalIgnoreCase))
  62. {
  63. pstart:
  64. Console.WriteLine();
  65. Console.WriteLine("Propaganda Calculator");
  66. Console.Write("Current Influence: ");
  67. a = Convert.ToDouble(Console.ReadLine());
  68. Console.Write("Target Influence: ");
  69. b = Convert.ToDouble(Console.ReadLine());
  70. if (a < b)
  71. {
  72. Console.WriteLine("ERROR: The Target Influence is greater than the Current Influence.");
  73. Console.WriteLine("Please try again!");
  74. Console.WriteLine("Press any key to continue....");
  75. Console.ReadKey();
  76. goto pstart;
  77. }
  78. else
  79. {
  80. while (a > b)
  81. {
  82. a = a - (a * .05);
  83. c++;
  84. }
  85. Console.WriteLine("It will take " + c + " Propaganda Cards to reach this goal.");
  86. c = 0;
  87. Console.WriteLine("Press any key to continue....");
  88. Console.ReadKey();
  89. goto START;
  90. }
  91.  
  92. }
  93. else if (String.Equals(answer, "exit", StringComparison.OrdinalIgnoreCase))
  94. {
  95. Console.WriteLine("Thank You for using our calculator, giving us some credits wouldn't hurt, Bye!");
  96. Console.ReadKey();
  97.  
  98. }
  99. else if (String.Equals(answer, "cls", StringComparison.OrdinalIgnoreCase))
  100. {
  101. Console.Clear();
  102. goto START;
  103. }
  104.  
  105. else
  106. {
  107. Console.WriteLine("Sorry, you entered and invalid input. Please try again!");
  108. goto START;
  109.  
  110.  
  111. }
  112. }
  113. }
  114. }
Add Comment
Please, Sign In to add comment