![]() |
|
Unknown Sample .dll - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: Coding (https://sinister.li/Forum-Coding--71) +--- Thread: Unknown Sample .dll (/Thread-Unknown-Sample-dll) |
Unknown Sample .dll - kmod - 03-08-2013 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 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 RE: Sample .dll - Psycho_Coder - 04-04-2013 Well the thread title is misleading Sample .dll , but sample of what ?? , you have mentioned nothing.In the post also you haven't described what your code does. RE: Sample .dll - ArkPhaze - 04-05-2013 I don't really understand, but this is pretty much useless... There's hardly an explanations, and this is also in the wrong forum. :yes: The only comments provided really are poor too. They don't describe any of what the code does and more what each part of the code is, based on the C# language specification, as if someone reading your code had the intention of learning the structure of some parts of a class in C#... And others that only explain how you think you may have messed up. This is nowhere near practical if you were using the comments to understand the code; typically what comments are for... :whistle: RE: Sample .dll - Linuxephus™ - 04-06-2013 Thread has been moved to a more appropriate forum based upon input from ArkPhaze and PsychoCoder. Thread marked as Closed on the merit of nobody currently speaking this particular type of "coding" language.:lol: |