Unknown Sample .dll 03-08-2013, 08:32 PM
#1
Here is a .dll I made for an assignment in one of my classes. I added the commenting in just before posting this.
The following would need to be compiled as C# Class Library
Updated Thread Name
The following would need to be compiled as C# Class Library
Code:
using Microsoft.VisualBasic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
public class Treatment
{
//----- Private variables (attributes of the instantiated object), requires accessor/mutator methods seen below to change/retrieve values
private string treatID;
private string actionTaken;
private byte totHours;
private string medPrescribed;
private float medCost;
private float hourlyFee;
private byte diagCode;
//------------------------//
//----- Default constructor. Sets basic values for the attributes of the object when it is first instantiated
public Treatment()
{
treatID = "";
actionTaken = "";
totHours = 0;
medPrescribed = "";
medCost = 0;
hourlyFee = 40;
diagCode = 1;
}
//---------------------//
//-----Accessors/Mutators (Get/Set)
public string TreatmentID
{
get
{ return treatID; }
set
{ treatID = value; }
}
public string ActionTaken
{
get
{ return actionTaken; }
set
{ actionTaken = value; }
}
public byte TotalHours
{
get
{ return totHours; }
set
{ totHours = value; }
}
public string MedicationPrescribed
{
get
{ return medPrescribed; }
set
{ medPrescribed = value; }
}
public float MedicationCost
{
get
{ return medCost; }
set
{ medCost = value; }
}
public float HourlyFee
{
get
{ return hourlyFee; }
set
{ hourlyFee = value; }
}
public byte DiagnosisCode
{
get
{ return diagCode; }
set
{
int y;
string dCode = value.ToString();
bool result = int.TryParse(dCode, out y);
while (result == false || Convert.ToInt32(dCode) <= 0)
{
dCode = Interaction.InputBox("The diagnostic code must be a number from 1-100.\nPlease enter the correct diagnostic code.", "Input Error");
}
}
}
//--------------------------------------------//
//----Class methods. I think I messed this up. I believe the requirements stated that I needed to store the value calculated by the first method inside the class,
//----Ended up storing it on the form that I created.
public double CalcTreatmentCost(float insuranceCoverageAmount)
{ return ((totHours * hourlyFee) + (medCost - insuranceCoverageAmount)); }
public void PrintTreatInfo()
{
MessageBox.Show(" Treatment ID: \n" + treatID +
" Action Taken: \n" + actionTaken +
" Total Hours: \n" + totHours.ToString() +
"Medication Prescribed: \n" + medPrescribed +
" Medication Cost: \n" + medCost.ToString("C2") +
" Hourly Fee: \n" + hourlyFee.ToString("C2") +
" Diagnostic Code: \n" + diagCode.ToString());
}
}Updated Thread Name


![[+]](https://sinister.li/images/modern/collapse_collapsed.png)
![[Image: OilyCostlyEwe.gif]](http://fat.gfycat.com/OilyCostlyEwe.gif)
