Untitled

mail@pastecode.io avatar
unknown
plain_text
8 months ago
1.2 kB
1
Indexable
Never
namespace Consumer;
class ConsumerAccount
{
     string consumerName;
     string mobileNumber;
     int callUsageMinutes;

    public ConsumerAccount(string name, string mobile, int minutes)
    {
        consumerName = name;
        mobileNumber = mobile;
        callUsageMinutes = minutes;
    }

    public void CalculateBillAmount()
    {
        double billAmount = callUsageMinutes * 2.0; // Rs.2 per minute
        Console.WriteLine($"Consumer Mobile Number: {mobileNumber}");
        Console.WriteLine($"Total Amount to be Paid: Rs. {billAmount}");
    }
}

class Program
{
    static void Main()
    {
        // Example usage
        Console.Write("Enter Consumer Name: ");
        string name = Console.ReadLine();

        Console.Write("Enter Consumer Mobile Number: ");
        string mobile = Console.ReadLine();

        Console.Write("Enter Call Usage in Minutes: ");
        int minutes = Convert.ToInt32(Console.ReadLine());

        ConsumerAccount consumer = new ConsumerAccount(name, mobile, minutes);

        // Calculate and display the bill amount
        consumer.CalculateBillAmount();
    }
}
Leave a Comment