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

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.
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...
Book - Introduction to Programming Using Visual Basic 11th Edition by David I. Schneider Programming Language...
Book - Introduction to Programming Using Visual Basic 11th Edition by David I. Schneider Programming Language - Visual Studio 2017 RESTAURANT MENU Write a program to place an order from the restaurant menu in Table 4.13. Use the form in Fig. 4.70, and write the program so that each group box is invisible and becomes visible only when its corresponding check box is checked. After the button is clicked, the cost of the meal should be calculated. (NOTE: The Checked...
Create a project plan on the game or application you are creating. Using java programming. The...
Create a project plan on the game or application you are creating. Using java programming. The project plan should include the following: A description of the game or application The IDE or game engine your plan to use to create the game or app and information on how you are going to develop the game or app If you choose to create a game, how are you going to approach the game design and game development process or if you...
C Programming Language: For this lab, you are going to create two programs. The first program...
C Programming Language: For this lab, you are going to create two programs. The first program (named AsciiToBinary) will read data from an ASCII file and save the data to a new file in a binary format. The second program (named BinaryToAscii) will read data from a binary file and save the data to a new file in ASCII format. Specifications: Both programs will obtain the filenames to be read and written from command line parameters. For example: - bash$...
Code should be written in C++ using Visual Studios Community This requires several classes to interact...
Code should be written in C++ using Visual Studios Community This requires several classes to interact with each other. Two class aggregations are formed. The program will simulate a police officer giving out tickets for parked cars whose meters have expired. You must include both a header file and an implementation file for each class. Car class (include Car.h and Car.cpp) Contains the information about a car. Contains data members for the following String make String model String color String...
Objectives: 1. To get familiar with C# programming language 2. To get familiar with Visual Studio...
Objectives: 1. To get familiar with C# programming language 2. To get familiar with Visual Studio development environment 3. To practice on writing a C# program Task 1: Create documentation for the following program which includes the following: a. Software Requirement Specification (SRS) b. Use Case Task 2: Write a syntactically and semantically correct C# program that models telephones. Your program has to be a C# Console Application. You will not implement classes in this program other than the class...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT