fork download
  1. using System;
  2. using System.Globalization;
  3.  
  4.  
  5. namespace PracTest3
  6. {
  7. class Bill
  8. {
  9. static void Main()
  10. {
  11. // Declare and initialise variables and constants
  12. // Constants
  13. const float PEEK_RATE = 0.50F;
  14. const float OFF_PEAK_RATE = 0.18F;
  15. const float GST_RATE = 0.10F;
  16. const float STANDARD_RATE = 0.32F;
  17.  
  18.  
  19.  
  20. // Customer variables
  21. string CustomerNumber = "";
  22. string CustomerName = "";
  23. string Address = "";
  24. string PeakOption = ""; //HERE
  25. string p = ""; //HERE "UNSURE"
  26. string s = ""; //HERE "UNSURE"
  27. float PeakKWH = 0.0F;
  28. float OffPeakKWH = 0.0F;
  29. float STANDARDKWH = 0.0F; //HERE
  30. // Calculation variables
  31. float PeakCharge = 0.0F;
  32. float OffPeakCharge = 0.0F;
  33. float StandardCharge = 0.0F; //HERE
  34. float TotalCharge = 0.0F;
  35. float TotalPlusGST = 0.0F;
  36.  
  37. //Temp variables
  38. string inputStr = "";
  39.  
  40. // INPUT
  41. // Set the variable defaults
  42. CustomerNumber = "";
  43. CustomerName = "";
  44. PeakOption = ""; //HERE
  45. Address = "";
  46. PeakKWH = 0.0F;
  47. OffPeakKWH = 0.0F;
  48. STANDARDKWH = 0.0F; //HERE
  49.  
  50. // Prompt and retrieve the data fronm the user
  51. Console.Write("Customer Number > ");
  52. CustomerNumber = Console.ReadLine();
  53.  
  54. Console.Write("Customer Name > ");
  55. CustomerName = Console.ReadLine();
  56.  
  57. Console.Write("Address > ");
  58. Address = Console.ReadLine();
  59.  
  60. Console.Write("Standrad (s) or Peak/Off Peak (p) > ");
  61. PeakOption = Console.ReadLine();
  62.  
  63. if (PeakOption.toLower() == "p")
  64. {
  65. // Usage data
  66. Console.Write("Peak Usage (kWh) > ");
  67. inputStr = Console.ReadLine();
  68. PeakKWH = float.Parse(inputStr);
  69.  
  70. Console.Write("Off Peak Usage (kWh) > ");
  71. inputStr = Console.ReadLine();
  72. OffPeakKWH = float.Parse(inputStr);
  73. }
  74.  
  75. if (PeakOption.toLower() == "s")
  76. {
  77. Console.Write("Standard Usage (kWh) > ");
  78. inputStr = Console.ReadLine();
  79. STANDARDKWH = float.Parse(inputStr);
  80. }
  81.  
  82. // PROCESS the calculations
  83. StandardCharge = STANDARDKWH * STANDARD_RATE; //HERE
  84. PeakCharge = PeakKWH * PEEK_RATE;
  85. OffPeakCharge = OffPeakKWH * OFF_PEAK_RATE;
  86. TotalCharge = PeakCharge + OffPeakCharge;
  87. TotalPlusGST = TotalCharge + TotalCharge * GST_RATE;
  88.  
  89. // OUTPUT the customer information and bill
  90. Console.WriteLine("===================================");
  91. Console.WriteLine("Electricity Bill for Customer {0}", CustomerNumber);
  92. Console.WriteLine("===================================");
  93. Console.WriteLine("Name : {0}", CustomerName);
  94. Console.WriteLine("Address : {0}", Address);
  95. Console.WriteLine("Standard : {0}", StandardCharge); //HERE
  96. Console.WriteLine("Peak : {0,7:C}", PeakCharge);
  97. Console.WriteLine("Off Peak : {0,7:C}", OffPeakCharge);
  98. Console.WriteLine("Total : {0,7:C}", TotalCharge);
  99. Console.WriteLine();
  100. Console.WriteLine("Including GST : {0,7:C}", TotalPlusGST);
  101. Console.WriteLine("===================================");
  102. Console.WriteLine("Press ENTER to exit");
  103. Console.ReadLine();
  104. }
  105. }
  106. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(63,28): error CS1061: Type `string' does not contain a definition for `toLower' and no extension method `toLower' of type `string' could be found (are you missing a using directive or an assembly reference?)
/usr/lib/mono/2.0/mscorlib.dll (Location of the symbol related to previous error)
prog.cs(75,28): error CS1061: Type `string' does not contain a definition for `toLower' and no extension method `toLower' of type `string' could be found (are you missing a using directive or an assembly reference?)
/usr/lib/mono/2.0/mscorlib.dll (Location of the symbol related to previous error)
Compilation failed: 2 error(s), 0 warnings
stdout
Standard output is empty