Question

In: Computer Science

C# Programming language!!! Using visual studios if possible!! PrimeHealth Suite You will create an application that...

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:

  • Name which holds the name of the patient
  • Account which holds the account information of the patient

The class should have the following constructor and methods:

  • Constructor - The constructor should accept the patient's name as an argument (parameterized constructor). This value should be assigned to the backing field for the object's Name property. The constructor should assign 0 to the backing field for the Account property.
  • Credit - The Credit method subtracts an amount from the account.
  • Debit - The Debit method adds an amount to the account.

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:

  • More details on the form layout
  • Tutorial 9-3 on pgs. 563-567 show how to create BankAccount Class that has methods similar to those in this assignment.
  • Tutorial 9-6 on pgs. 593-597 show to access controls across multiple forms.
  • Add tabs to the listbox: ... + "/t"+ ... similar to how you a new line character.
  • You can create the array of Patient objects in the space between the Form namespace and the Form class, not in any specific event or method.

By the due date listed in D2L, submit your solution into D2L Project 3 folder:

  1. Zipped files and folders for the application named: Project3_ROakley (replace the instructor's name with the student name)

Point Breakdown:

Points Task

10

The application has a Patient class (separate class file in application) with:

  • a constructor,
  • 2 properties (Name, Account), and
  • 2 methods (Credit, Debit).
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

  • creates an instance of and displays the AccountDisplay form
  • uses foreach loop to display each patient's name and account balance in a listbox

10

The "Charge Service" button

  • uses input validation to ensure that a patient is selected (if-else statement)
  • creates an instance of and displays the AccountUpdate form
  • calls the Debit method and updates the account based on the selected service
  • clears listbox and radio button selections before returning to MainForm

10

The "Pay for Service" button

  • uses input validation to ensure that the textbox is not empty (if-else statement)
  • creates an instance of and displays the AccountUpdate form
  • calls the Credit method and updates the account based on the data entered in the textbox
  • clears listbox and radio button selections before returning to MainForm
50 TOTAL

Solutions

Expert Solution

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:


Related Solutions

Program is to be written in C++ using Visual studios Community You are to design a...
Program is to be written in C++ using Visual studios Community You are to design a system to keep track of either a CD or DVD/Blu-ray collection. The program will only work exclusively with either CDs or DVDs/Blu-rays since some of the data is different. Which item your program will work with will be up to you. Each CD/DVD/Blu-ray in the collection will be represented as a class, so there will be one class that is the CD/DVD/Blu-ray. The CD...
I need this code in C++ form using visual studios please: Create a class that simulates...
I need this code in C++ form using visual studios please: Create a class that simulates an alarm clock. In this class you should: •       Store time in hours, minutes, and seconds. Note if time is AM or PM. (Hint: You should have separate private members for the alarm and the clock. Do not forget to have a character variable representing AM or PM.) •       Initialize the clock to a specified time. •       Allow the clock to increment to the...
Must be in Visual C# using windows forms : Create an application that opens a specified...
Must be in Visual C# using windows forms : Create an application that opens a specified text file and then displays a list of all the unique words found in the file. Hint: Use a LINQ method to remove all duplicate words.
Programming Language: C# CheckingAccount class You will implement the CheckingAccount Class in Visual Studio. This is...
Programming Language: C# CheckingAccount class You will implement the CheckingAccount Class in Visual Studio. This is a sub class is derived from the Account class and implements the ITransaction interface. There are two class variables i.e. variables that are shared but all the objects of this class. A short description of the class members is given below: CheckingAccount Class Fields $- COST_PER_TRANSACTION = 0.05 : double $- INTEREST_RATE = 0.005 : double - hasOverdraft: bool Methods + «Constructor» CheckingAccount(balance =...
Your task is to create a book ordering form using VISUAL STUDIOS, with the code and...
Your task is to create a book ordering form using VISUAL STUDIOS, with the code and screenshots 1. Boxes for first name, last name, address. 2. Radio buttons to select: hard cover, soft cover, ebook. 3. Drop down list to select the book (make up three or four book names). 4. Radio buttons to select credit card (at least Visa, Master Card, American Express). 5. Box to enter credit card numbers. 6. The credit card box MUST verify that numbers...
Complete the 3 programming problems in this assignment by using Microsoft Visual Studio Suite. Compile your...
Complete the 3 programming problems in this assignment by using Microsoft Visual Studio Suite. Compile your solutions for each problem solved in a Word or Google document which includes (a) the pseudocode, (b) the C# codes and (c) the execution result (screen capture just the answer part using Snipping Tool, avoiding non-related or blank spaces). Notice for readability, that the (a) & (b) are in text mode and the (c) is in image mode. Use proper titles and wording in...
Complete the 3 programming problems in this assignment by using Microsoft Visual Studio Suite. Compile your...
Complete the 3 programming problems in this assignment by using Microsoft Visual Studio Suite. Compile your solutions for each problem solved in a Word or Google document which includes (a) the pseudocode, (b) the C# codes and (c) the execution result (screen capture just the answer part using Snipping Tool, avoiding non-related or blank spaces). Notice for readability, that the (a) & (b) are in text mode and the (c) is in image mode. Use proper titles and wording in...
You are using ONLY Programming Language C for this: In this program you will calculate the...
You are using ONLY Programming Language C for this: In this program you will calculate the average of x students’ grades (grades will be stored in an array). Here are some guidelines to follow to help you out: 1. In your program, be sure to ask the user for the number of students that are in the class. The number will help in declaring your array. 2. Use the function to scan the grades of the array. To say another...
Using (C programming language) Create a health monitoring program, that will ask user for their name,...
Using (C programming language) Create a health monitoring program, that will ask user for their name, age, gender, weight, height and other health related questions like blood pressure and etc. Based on the provided information, program will tell user BMI, blood pressure numbers if they fall in healthy range or not and etc. Suggestions can be made as what should be calorie intake per day and the amount of exercise based on user input data. User should be able to...
Must be written in C++ in Visual studios community In this lab, you will modify the...
Must be written in C++ in Visual studios community In this lab, you will modify the Student class you created in a previous lab. You will modify one new data member which will be a static integer data member. Call that data member count. You also add a static method to the Student class that will display the value of count with a message indicating what the value represents, meaning I do not want to just see a value printed...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT