using System;
using System.Globalization;
namespace PracTest3
{
class Bill
{
static void Main()
{
// Declare and initialise variables and constants
// Constants
const float PEEK_RATE = 0.50F;
const float OFF_PEAK_RATE = 0.18F;
const float GST_RATE = 0.10F;
const float STANDARD_RATE = 0.32F;
// Customer variables
string CustomerNumber = "";
string CustomerName = "";
string Address = "";
string PeakOption = ""; //HERE
string p = ""; //HERE "UNSURE"
string s = ""; //HERE "UNSURE"
float PeakKWH = 0.0F;
float OffPeakKWH = 0.0F;
float STANDARDKWH = 0.0F; //HERE
// Calculation variables
float PeakCharge = 0.0F;
float OffPeakCharge = 0.0F;
float StandardCharge = 0.0F; //HERE
float TotalCharge = 0.0F;
float TotalPlusGST = 0.0F;
//Temp variables
string inputStr = "";
// INPUT
// Set the variable defaults
CustomerNumber = "";
CustomerName = "";
PeakOption = ""; //HERE
Address = "";
PeakKWH = 0.0F;
OffPeakKWH = 0.0F;
STANDARDKWH = 0.0F; //HERE
// Prompt and retrieve the data fronm the user
Console.Write("Customer Number > ");
CustomerNumber = Console.ReadLine();
Console.Write("Customer Name > ");
CustomerName = Console.ReadLine();
Console.Write("Address > ");
Address = Console.ReadLine();
Console.Write("Standrad (s) or Peak/Off Peak (p) > ");
PeakOption = Console.ReadLine();
if (PeakOption.toLower() == "p")
{
// Usage data
Console.Write("Peak Usage (kWh) > ");
inputStr = Console.ReadLine();
PeakKWH = float.Parse(inputStr);
Console.Write("Off Peak Usage (kWh) > ");
inputStr = Console.ReadLine();
OffPeakKWH = float.Parse(inputStr);
}
if (PeakOption.toLower() == "s")
{
Console.Write("Standard Usage (kWh) > ");
inputStr = Console.ReadLine();
STANDARDKWH = float.Parse(inputStr);
}
// PROCESS the calculations
StandardCharge = STANDARDKWH * STANDARD_RATE; //HERE
PeakCharge = PeakKWH * PEEK_RATE;
OffPeakCharge = OffPeakKWH * OFF_PEAK_RATE;
TotalCharge = PeakCharge + OffPeakCharge;
TotalPlusGST = TotalCharge + TotalCharge * GST_RATE;
// OUTPUT the customer information and bill
Console.WriteLine("===================================");
Console.WriteLine("Electricity Bill for Customer {0}", CustomerNumber);
Console.WriteLine("===================================");
Console.WriteLine("Name : {0}", CustomerName);
Console.WriteLine("Address : {0}", Address);
Console.WriteLine("Standard : {0}", StandardCharge); //HERE
Console.WriteLine("Peak : {0,7:C}", PeakCharge);
Console.WriteLine("Off Peak : {0,7:C}", OffPeakCharge);
Console.WriteLine("Total : {0,7:C}", TotalCharge);
Console.WriteLine();
Console.WriteLine("Including GST : {0,7:C}", TotalPlusGST);
Console.WriteLine("===================================");
Console.WriteLine("Press ENTER to exit");
Console.ReadLine();
}
}
}