In: Computer Science
C# Programming language!!! Using visual studios if possible!!
PrimeHealth Suite
You will create an application that serves as a healthcare billing management system. This application is a multiform project (Chapter 9) with three buttons. The "All Accounts" button allows the user to see all the account information for each patient which is stored in an array of class type objects (Chapter 9, section 9.4).The "Charge Service" button calls the Debit method which charges the selected service to the patient's account and displays information in a separate form. The "Pay for Service" button calls the Credit method which deducts the amount in the textbox from the patient's account and displays information in a separate form. The Patient class (Chapter 9) will have the following properties:
The class should have the following constructor and methods:
The application's design
When the "All Accounts" button is clicked:
When a patient is selected, a service is selected, and the "Charge Service" button is clicked
If you click the "All Accounts" button, you should see the patient's account balance updated:
When a patient is selected, an amount is placed in the textbox, and the "Pay for Service" button is clicked:
If you click the "All Accounts" button, you should see the patient's account balance updated:
The application should work similarly for all other patients.
HINTS:
By the due date listed in D2L, submit your solution into D2L Project 3 folder:
Point Breakdown:
Points | Task |
10 |
The application has a Patient class (separate class file in application) with:
|
10 | The application creates an array of Patient objects that uses the constructor to create 4 new instances of patients. |
10 |
The "All Accounts" button
|
10 |
The "Charge Service" button
|
10 |
The "Pay for Service" button
|
50 | TOTAL |
Program
Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace healathcaremanagement
{
public partial class Form1 : Form
{
public static Patient[] ltPat;
public Form1()
{
InitializeComponent();
ltPat = new Patient[] {
new Patient("Rajinikanth", 0),
new Patient("Kamalahasan", 0),
new Patient("Ajithkumar", 0),
new Patient("Vijay", 0)
};
}
private void Form1_Load(object sender, EventArgs e)
{
listBox1.DataSource = ltPat;
listBox1.DisplayMember = "Name";
}
private void button1_Click(object sender, EventArgs e)
{
frmAllAccount frm2 = new frmAllAccount();
frm2.Show();
}
private void button2_Click(object sender, EventArgs e)
{
string st = listBox1.SelectedIndex.ToString();
string tName = ltPat[0].Name;
if (listBox1.SelectedIndex == -1)
{
MessageBox.Show("Please select a patient");
}
else
{
Patient selectedPatient = (Patient)listBox1.SelectedItem;
if (checkBox1.Checked == true)
{
selectedPatient.debit(89);
}
else if (checkBox2.Checked == true)
{
selectedPatient.debit(159);
}
else if (checkBox3.Checked == true)
{
selectedPatient.debit(99);
}
else if (checkBox4.Checked == true)
{
selectedPatient.debit(139);
}
else
{
MessageBox.Show("Please select a service");
}
clearForms();
}
}
public void clearForms()
{
checkBox1.Checked = false;
checkBox2.Checked = false;
checkBox3.Checked = false;
checkBox4.Checked = false;
textBox1.Text = string.Empty;
}
private void button3_Click(object sender, EventArgs e)
{
string st = listBox1.SelectedIndex.ToString();
string tName = ltPat[0].Name;
if (listBox1.SelectedIndex == -1)
{
MessageBox.Show("Please select a patient");
}
else
{
Patient selectedPatient = (Patient)listBox1.SelectedItem;
if (string.IsNullOrEmpty(textBox1.Text))
{
MessageBox.Show("Please enter service amout");
}
else
{
int amt = Convert.ToInt32(textBox1.Text);
selectedPatient.credit(amt);
}
clearForms();
}
}
}
}
Patient.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace healathcaremanagement
{
public class Patient
{
string name;
int account;
public Patient(string pName, int acct)
{
this.Name = pName;
this.Account = acct;
}
public String Name {
get { return name; }
set { name = value; }
}
public int Account {
get { return account; }
set { account = value; }
}
public void credit (int amt)
{
try
{
account = account - amt;
}
catch (Exception)
{
throw;
}
}
public void debit(int amt)
{
try
{
account = account + amt;
}
catch (Exception)
{
throw;
}
}
}
}
frmAllAccount.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace healathcaremanagement
{
public partial class frmAllAccount : Form
{
string patDetails = "{0,-20}{1, -20}";
public frmAllAccount()
{
InitializeComponent();
}
private void frmAllAccount_Load(object sender, EventArgs e)
{
//listBox1.DataSource = Form1.ltPat;
//listBox1.DisplayMember = "Name";
listBox1.Items.Add(String.Format(patDetails,"PatientName","AccountBalance"));
foreach (Patient listBoxItem in Form1.ltPat)
{
listBox1.Items.Add(String.Format(patDetails, listBoxItem.Name, listBoxItem.Account.ToString()));
}
}
}
}
Form1 design code
namespace healathcaremanagement
{
partial class Form1
{
///
<summary>
/// Required designer
variable.
///
</summary>
private
System.ComponentModel.IContainer components = null;
///
<summary>
/// Clean up any
resources being used.
///
</summary>
/// <param
name="disposing">true if managed resources should be disposed;
otherwise, false.</param>
protected override void
Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
///
<summary>
/// Required method for
Designer support - do not modify
/// the contents of this
method with the code editor.
///
</summary>
private void
InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.checkBox3 = new System.Windows.Forms.CheckBox();
this.checkBox4 = new System.Windows.Forms.CheckBox();
this.listBox1 = new System.Windows.Forms.ListBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(42, 31);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(43, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Patient:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(389, 31);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(43, 13);
this.label2.TabIndex = 1;
this.label2.Text = "Service";
//
// button1
//
this.button1.Location = new System.Drawing.Point(548, 26);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(100, 23);
this.button1.TabIndex = 2;
this.button1.Text = "All Accounts";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new
System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(554, 87);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(94, 23);
this.button2.TabIndex = 3;
this.button2.Text = "Charge Service";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new
System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(554, 150);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(94, 23);
this.button3.TabIndex = 4;
this.button3.Text = "Pay for Service";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new
System.EventHandler(this.button3_Click);
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(392, 76);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(125, 17);
this.checkBox1.TabIndex = 6;
this.checkBox1.Text = "Annual Physical -$89";
this.checkBox1.UseVisualStyleBackColor = true;
//
// checkBox2
//
this.checkBox2.AutoSize = true;
this.checkBox2.Location = new System.Drawing.Point(392, 116);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(117, 17);
this.checkBox2.TabIndex = 7;
this.checkBox2.Text = "Vaccinations -$159";
this.checkBox2.UseVisualStyleBackColor = true;
//
// checkBox3
//
this.checkBox3.AutoSize = true;
this.checkBox3.Location = new System.Drawing.Point(392, 156);
this.checkBox3.Name = "checkBox3";
this.checkBox3.Size = new System.Drawing.Size(107, 17);
this.checkBox3.TabIndex = 8;
this.checkBox3.Text = "Minor illness -$99";
this.checkBox3.UseVisualStyleBackColor = true;
//
// checkBox4
//
this.checkBox4.AutoSize = true;
this.checkBox4.Location = new System.Drawing.Point(392, 203);
this.checkBox4.Name = "checkBox4";
this.checkBox4.Size = new System.Drawing.Size(113, 17);
this.checkBox4.TabIndex = 9;
this.checkBox4.Text = "Minor Injury -$ 139";
this.checkBox4.UseVisualStyleBackColor = true;
//
// listBox1
//
this.listBox1.FormattingEnabled = true;
this.listBox1.Location = new System.Drawing.Point(24, 62);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(335, 238);
this.listBox1.TabIndex = 10;
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(515, 279);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 20);
this.textBox1.TabIndex = 11;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(733, 446);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.listBox1);
this.Controls.Add(this.checkBox4);
this.Controls.Add(this.checkBox3);
this.Controls.Add(this.checkBox2);
this.Controls.Add(this.checkBox1);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private
System.Windows.Forms.Label label1;
private
System.Windows.Forms.Label label2;
private
System.Windows.Forms.Button button1;
private
System.Windows.Forms.Button button2;
private
System.Windows.Forms.Button button3;
private
System.Windows.Forms.CheckBox checkBox1;
private
System.Windows.Forms.CheckBox checkBox2;
private
System.Windows.Forms.CheckBox checkBox3;
private
System.Windows.Forms.CheckBox checkBox4;
private
System.Windows.Forms.ListBox listBox1;
private
System.Windows.Forms.TextBox textBox1;
}
}
frmAllAccount
Design code
namespace healathcaremanagement
{
partial class frmAllAccount
{
///
<summary>
/// Required designer
variable.
///
</summary>
private
System.ComponentModel.IContainer components = null;
///
<summary>
/// Clean up any
resources being used.
///
</summary>
/// <param
name="disposing">true if managed resources should be disposed;
otherwise, false.</param>
protected override void
Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
///
<summary>
/// Required method for
Designer support - do not modify
/// the contents of this
method with the code editor.
///
</summary>
private void
InitializeComponent()
{
this.listBox1 = new System.Windows.Forms.ListBox();
this.SuspendLayout();
//
// listBox1
//
this.listBox1.FormattingEnabled = true;
this.listBox1.Location = new System.Drawing.Point(197, 36);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(235, 251);
this.listBox1.TabIndex = 0;
//
// frmAllAccount
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(797, 382);
this.Controls.Add(this.listBox1);
this.Name = "frmAllAccount";
this.Text = "frmAllAccount";
this.Load += new
System.EventHandler(this.frmAllAccount_Load);
this.ResumeLayout(false);
}
#endregion
private
System.Windows.Forms.ListBox listBox1;
}
}
Output: