using System;
using static System.Console;
using System.IO;
class WritePatientRecords
{
static void Main()
{
StreamWriter writer = new StreamWriter(“Patients.txt”);
char choice;
do
{
Patient p = new Patient();
Console.Write(“Enter Patient Id: “);
p.ID = int.Parse(Console.ReadLine());
Console.Write(“Enter Patient name: “);
p.Name = Console.ReadLine();
Console.Write(“Enter Balance: “);
p.Balance = Double.Parse(Console.ReadLine());
writer.WriteLine(p);
Console.Write(“Enter more data..(y/n): “);
choice = Console.ReadLine().ToLower()[0];
} while (choice == ‘y’);
writer.Close();
}
}
class Patient
{
private int id;
private string name;
private double balance;
//Constructor
public Patient(int id, string name, double bal)
{
this.id = id;
this.name = name;
this.balance = bal;
}
//Constructor 2
public Patient()
{
id = 0;
name = “”;
balance = 0;
}
//Properties
public int ID
{
get
{
return id;
}
set
{
id = value;
}
}
public string Name
{
get
{
return name;
}
set
{
name = value;
}
}
public double Balance
{
get
{
return balance;
}
set
{
balance = value;
}
}
public override string ToString()
{
return “p” + id + “, ” + name + “, ” + balance;
}
}
i need the Output for this? Patients.txt?
Expert Answer
Answer to using System; using static System.Console; using System.IO; class WritePatientRecords { static void Main() { StreamWrite…