Notes
![]() ![]() Notes - notes.io |
//Gary Tan
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PatientDemo
{
class InsuredPatient : Patient
{
public string insuranceCompany;
public double percentage;
public double balance; //balance user has to pay after insurance
public double quarter;
public double calculation(double amtdue, double percent)//does calculation for insurance
{
double totalDues = amtdue - ((amtdue * percent) / 100); //total ammount minus the the amount times percege that insurance covers
return totalDues;
}
public double calculation2(double amtdue, double percent)//does calculation for quarterly insurance
{
double quarterDues = (amtdue - ((amtdue * percent) / 100))*.25;
return quarterDues;
}
public override string ToString()
{
return "Patient's ID : " + ID + ", Patient's Name : " + Name + ", Patient's Age : " + Age + ", Hospital Bill : " + amountDue + ", Insurance : " + insuranceCompany + ", Insurance Percent : " + percentage + ", Balance Due : " + balance + ", Quarterly Payment : " + quarter;
}
}
class PatientInput
{
static void Main(string[] args)
{
InsuredPatient[] patient = new InsuredPatient[5];
//asks for users input and convert to proper data types
for (int i = 0; i < 5; i++)
{
patient[i] = new InsuredPatient();
Console.Write("Patient's ID : ");
patient[i].ID = Convert.ToInt32(Console.ReadLine());
Console.Write("Patient's name : ");
patient[i].Name = Console.ReadLine();
Console.Write("Patient's age : ");
patient[i].Age = Convert.ToInt32(Console.ReadLine());
Console.Write("Patient's dues : ");
patient[i].amountDue = Convert.ToDouble(Console.ReadLine());
Console.Write("Patient's Insurance company name : ");
patient[i].insuranceCompany = Console.ReadLine();
Console.Write("Percentage Insurance company will cover : ");
patient[i].percentage = Convert.ToDouble(Console.ReadLine());
patient[i].balance = patient[i].calculation(patient[i].amountDue, patient[i].percentage);
patient[i].quarter = patient[i].calculation2(patient[i].amountDue, patient[i].percentage);
}
InsuredPatient temp = new InsuredPatient();
//sorts patient id
for (int i = 0; i < 5; i++)
{
for (int j = 0; j < 5; j++)
{
if (patient[j].ID > patient[i].ID)
{
temp = patient[i];
patient[i] = patient[j];
patient[j] = temp;
}
}
}
//print patients data
Console.WriteLine("rnPatient's Hospital Recordrn"); //try to get new line aka endl
for (int i = 0; i < 5; i++)
{
Console.WriteLine(patient[i].ToString());
Console.Write("rn");
}
Console.ReadKey();
}
}
}
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team