In this exercise, you’ll modify a class that stores a list of inventory items so it uses an indexer, a delegate, an event, and operators. Then, you’ll modify the code for the Inventory Maintenance form so it uses these features. Getting Started • Download the HW3Start project from Canvas. Unzip the compressed folder and place it in your class folder on your jump drive. • Open up the HW3Start solution. At the top of the code, include a comment with your name and class. For example, the comment I would enter for my assignment would be // Sherry Albright – CIT1755. • Review the code for the InvItemList class so you understand how it works. Then, review the code for the Inventory Maintenance form to see how it uses this class. Finally, run the application to see how it works. Add an index to the InvItemList class • Delete the GetItemByIndex method from the InvItemList class, and replace it with an indexer that receives an int value. This indexer should include both get and set accessors, and the get accessor should check that the value that’s passed to it is a valid index. If the index isn’t valid, the accessor should throw an ArgumentOutOfRangeException with a message that consists of the index value. • Modify the Invoice Maintenance form to use this indexer instead of the GetItemByIndex method. Then, test the application to be sure it still works. Add overloaded operators to the InvItemList class • Add overloaded + and – operators to the InvItemList class that add and remove an inventory item from the inventory item list. • Modify the Inventory Maintenance form to use these operators instead of the Add and Remove methods. Then, test the application to be sure it still works. Add a delegate and an event to the InvItemList class • Add a delegate named ChangeHandler to the InvItemList class. This delegate should specify a method with a void return type and an InvItemList parameter. • Add an event named Changed to the InvItemList class. This event should use the ChangeHandler delegate and should be raised any time the inventory item list changes. • Modify the Inventory Maintenance form to use the Changed event to save the inventory items and refresh the list box any time the list changes. To do that, you’ll need to code an event handler that has the signature specified by the delegate, you’ll need to wire the event to the event handler, and you’ll need to remove any unnecessary code from the event handlers for the Save and Delete buttons. When you’re done, test the application to be sure it still works.
Mine works but it only populates zero’s in the list box.
Heres my code so far:
frmInvMaint.cs:
namespace InventoryMaintenance
{
public partial class frmInvMaint : Form
{
private InvItemList invItems = new InvItemList();
public frmInvMaint()
{
InitializeComponent();
// register event handler (connect the event to the Invoiceupdated method)
invItems.Changed += new InvItemList.InvItemListChanged(ItemUpdated);
}
private void ItemUpdated(InvItem ChangedInvItem, string OperationMessage)
{
MessageBox.Show(ChangedInvItem.GetDisplayText() +”n” + OperationMessage + “nCurrent Inventory Item count: ” + invItems.Count);
}
//event handler for the add button
private void ChangedInvItem_TextChanged(object sender, System.EventArgs e)
{
}
//event handler for the clear button
private void ClearInvItem(object sender, System.EventArgs e)
{
}
private void FillItemListBox()
{
InvItem item = new InvItem();
lstItems.Items.Clear();
for (int i = 0; i < invItems.Count; i++)
{
lstItems.Items.Add(item.GetDisplayText());
}
}
private void frmInvMaint_Load(object sender, System.EventArgs e)
{
invItems.Fill();
}
private void btnAdd_Click(object sender, System.EventArgs e)
{
frmNewItem newItemForm = new frmNewItem();
InvItem invItem = newItemForm.GetNewItem();
if (invItem != null)
{
invItems.Add(invItem);
invItems.Save();
FillItemListBox();
}
{
this.lstItems.TextChanged +=
new System.EventHandler(this.ChangedInvItem_TextChanged);
}
}
private void btnDelete_Click(object sender, System.EventArgs e)
{
this.lstItems.TextChanged +=
new System.EventHandler(this.ClearInvItem);
InvItem invItem = new InvItem();
int i = lstItems.SelectedIndex;
if (i != -1)
{
string message = “Are you sure you want to delete “
+ invItem.Description + “?”;
DialogResult button =
MessageBox.Show(message, “Confirm Delete”,
MessageBoxButtons.YesNo);
if (button == DialogResult.Yes)
{
invItems.Remove(invItem);
invItems.Save();
FillItemListBox();
}
}
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
InvItemList.cs:
namespace InventoryMaintenance
{
public class InvItemList
{
private List<InvItem> invItems;
// delegate for event
public delegate void InvItemListChanged
(InvItem ChangedInvItem, string OperationMessage);
// event declaration tied to inventotyitemListChanged
public event
InvItemListChanged Changed;
//default constructor
public InvItemList()
{
invItems = new List<InvItem>();
}
public int Count
{
get
{
return invItems.Count;
}
}
public object InvItemList1 { get; internal set; }
// indexer (gets a inventory item by position (index) in the list)
public InvItem this[int index]
{
get
{
if
(index < 0)
{
// lowest index value for an item in the list is 0
throw new
ArgumentOutOfRangeException(index.ToString());
}
else if
(index >= invItems.Count)
{
// list is 0 based. If the Count is 3, the first item in the list is at index 0
// and the last item in the list is at index 2
throw new ArgumentOutOfRangeException(index.ToString());
}
return
invItems[index];
}
set
{
invItems[index] = value
;
Changed(invItems[index],
“Inventory Items information was updated!”
);
}
}
// Add method to add invitems to the list
public void Add(InvItem InvItemIn)
{
invItems.Add(InvItemIn);
// fire change event
Changed(InvItemIn, “Inventory Item information was added to the list!”);
}
// Remove method to delete studentgrade from the list
public
void
Remove(InvItem InvItemIn)
{
invItems.Remove(InvItemIn);
// fire change event
Changed(InvItemIn, “Inventory Item information was removed from the list!”);
}
// operators for + and –
public static InvItemList operator +(InvItemList invItem, InvItem item)
{
invItem.Add(item);
return
invItem;
}
public static InvItemList operator -(InvItemList invItem, InvItem item)
{
invItem.Remove(item);
return
invItem;
}
public void Add(int itemNo, string description, decimal price)
{
InvItem i = new InvItem(itemNo, description, price);
invItems.Add(i);
}
public void Fill()
{
invItems = InvItemDB.GetItems();
}
public void Save()
{
InvItemDB.SaveItems(invItems);
}
}
}
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
In This Essay Students Will Use Newly Acquired College Level Library Based Resea
/in Uncategorized /by developerIn this essay, students will use newly acquired college-level, library-based research skills to find three text-based sources on their topic and write an informational synthesis that describes the arguments made in the three sources and how they are in conversation with each other.
Assignment Objectives: You will complete this assignment by writing an essay that explains in detail the argument presented in four articles on similar topics and explain how the four different arguments are related to each other. Your essay should 1) explain what the essays seem to be saying together about the topic, 2) explain the kinds of evidence presented in the essays, how the authors use them, and important connections among evidence in all three essays, and 3) summarize, paraphrase, and quote from the three essays adequately to complete the task
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
In This Essay With Emphasis On Argument You Will Write With A Specific Purpose A
/in Uncategorized /by developerIn this essay with emphasis on argument, you will write with a specific purpose and for a specific audience. The art of persuasion in the workplace is so important that many businesses bring in educational consultants to teach employees how, why, and when to be persuasive. Often these companies charge several thousands of dollars for their expertise; however, to save money, your boss has asked you to write an essay that will be given to all employees explaining the art of persuasion and why it is a necessary skill in your workplace. In order for employees to understand what they are being asked to do, you should incorporate an extended definition of what good persuasion is, and possibly contrast it with what good persuasion is not. You may also want to incorporate scenarios that demonstrate both good and bad examples to help your audience fully understand how and when to be persuasive. Perhaps you work at an advertising company. One of your jobs is to acquire new client accounts, and persuading them to sign with you usually involves a key presentation. As the writer of this essay, you could give an example of one of your best presentations, explaining what was done correctly and why it worked. You could also give an example of one of your worst presentations, emphasizing what was done incorrectly.
need 3-4 pages in APA style
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
In This Essay You Ll Demonstrate Your Understanding Of The Different Types Of St
/in Uncategorized /by developerIn this essay, you’ll demonstrate your understanding of the different types of staining procedures discussed in Chapter 3 in terms of how they may be applied in the identification of an unknown sample. You’ll also demonstrate your understanding of the anatomical differences among prokaryotes discussed in Chapter 4 that these procedures use to differentiate among the different genera of bacteria.You are given a sputum sample from a patient that may be infected with a bacterium from one of the following genera: Bacillus, Escherichia, or Mycoplasma. In a Microsoft Word document, describe the important anatomical differences among these three genera (i.e., those features that could be used to differentiate among them) and the staining protocols you would use to identify which genera is causing the patient’s infection. When discussing each staining protocol, it is important not only to mention the steps involved, but also how each step and each protocol would identify or eliminate each of these genera as a suspect. You may refer to other scientific resources, but they should be in addition to and not in place of the Module 2 resources.Your essay should be approximately 2 pages in length, double spaced in 10-12 point font. If you refer to sources of information other then the textbook, please be sure to cite them in the text and on a reference page using APA format. When you have finished your essay, attach it to the assignment drop box and submit it to your instructor.
Differential stains work by using a series of dyes and sometimes additional chemicals, to stainbacteria contrasting colours based on structural difference between bacterial cells. The Gram stain,…
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
In This Essay You Will Address The Controversy Between Free Will And Determinism
/in Uncategorized /by developerIn this essay you will address the controversy between free will and determinism. You will go deeper into the problem of determinism by choosing whether it is the predictability or the unpredictability of our actions that poses a bigger threat to free will. Using passages from the textbook, explain in detail what determinism is and why determinism threatens the idea of free will.
Now consider these two opposite points of view about our ability to predict behavior:
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
In This Exercise You Ll Modify A Class That Stores A List Of Inventory Items So
/in Uncategorized /by developerIn this exercise, you’ll modify a class that stores a list of inventory items so it uses an indexer, a delegate, an event, and operators. Then, you’ll modify the code for the Inventory Maintenance form so it uses these features. Getting Started • Download the HW3Start project from Canvas. Unzip the compressed folder and place it in your class folder on your jump drive. • Open up the HW3Start solution. At the top of the code, include a comment with your name and class. For example, the comment I would enter for my assignment would be // Sherry Albright – CIT1755. • Review the code for the InvItemList class so you understand how it works. Then, review the code for the Inventory Maintenance form to see how it uses this class. Finally, run the application to see how it works. Add an index to the InvItemList class • Delete the GetItemByIndex method from the InvItemList class, and replace it with an indexer that receives an int value. This indexer should include both get and set accessors, and the get accessor should check that the value that’s passed to it is a valid index. If the index isn’t valid, the accessor should throw an ArgumentOutOfRangeException with a message that consists of the index value. • Modify the Invoice Maintenance form to use this indexer instead of the GetItemByIndex method. Then, test the application to be sure it still works. Add overloaded operators to the InvItemList class • Add overloaded + and – operators to the InvItemList class that add and remove an inventory item from the inventory item list. • Modify the Inventory Maintenance form to use these operators instead of the Add and Remove methods. Then, test the application to be sure it still works. Add a delegate and an event to the InvItemList class • Add a delegate named ChangeHandler to the InvItemList class. This delegate should specify a method with a void return type and an InvItemList parameter. • Add an event named Changed to the InvItemList class. This event should use the ChangeHandler delegate and should be raised any time the inventory item list changes. • Modify the Inventory Maintenance form to use the Changed event to save the inventory items and refresh the list box any time the list changes. To do that, you’ll need to code an event handler that has the signature specified by the delegate, you’ll need to wire the event to the event handler, and you’ll need to remove any unnecessary code from the event handlers for the Save and Delete buttons. When you’re done, test the application to be sure it still works.
Mine works but it only populates zero’s in the list box.
Heres my code so far:
frmInvMaint.cs:
namespace InventoryMaintenance
{
public partial class frmInvMaint : Form
{
private InvItemList invItems = new InvItemList();
public frmInvMaint()
{
InitializeComponent();
// register event handler (connect the event to the Invoiceupdated method)
invItems.Changed += new InvItemList.InvItemListChanged(ItemUpdated);
}
private void ItemUpdated(InvItem ChangedInvItem, string OperationMessage)
{
MessageBox.Show(ChangedInvItem.GetDisplayText() +”n” + OperationMessage + “nCurrent Inventory Item count: ” + invItems.Count);
}
//event handler for the add button
private void ChangedInvItem_TextChanged(object sender, System.EventArgs e)
{
}
//event handler for the clear button
private void ClearInvItem(object sender, System.EventArgs e)
{
}
private void FillItemListBox()
{
InvItem item = new InvItem();
lstItems.Items.Clear();
for (int i = 0; i < invItems.Count; i++)
{
lstItems.Items.Add(item.GetDisplayText());
}
}
private void frmInvMaint_Load(object sender, System.EventArgs e)
{
invItems.Fill();
}
private void btnAdd_Click(object sender, System.EventArgs e)
{
frmNewItem newItemForm = new frmNewItem();
InvItem invItem = newItemForm.GetNewItem();
if (invItem != null)
{
invItems.Add(invItem);
invItems.Save();
FillItemListBox();
}
{
this.lstItems.TextChanged +=
new System.EventHandler(this.ChangedInvItem_TextChanged);
}
}
private void btnDelete_Click(object sender, System.EventArgs e)
{
this.lstItems.TextChanged +=
new System.EventHandler(this.ClearInvItem);
InvItem invItem = new InvItem();
int i = lstItems.SelectedIndex;
if (i != -1)
{
string message = “Are you sure you want to delete “
+ invItem.Description + “?”;
DialogResult button =
MessageBox.Show(message, “Confirm Delete”,
MessageBoxButtons.YesNo);
if (button == DialogResult.Yes)
{
invItems.Remove(invItem);
invItems.Save();
FillItemListBox();
}
}
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
InvItemList.cs:
namespace InventoryMaintenance
{
public class InvItemList
{
private List<InvItem> invItems;
// delegate for event
public delegate void InvItemListChanged
(InvItem ChangedInvItem, string OperationMessage);
// event declaration tied to inventotyitemListChanged
public event
InvItemListChanged Changed;
//default constructor
public InvItemList()
{
invItems = new List<InvItem>();
}
public int Count
{
get
{
return invItems.Count;
}
}
public object InvItemList1 { get; internal set; }
// indexer (gets a inventory item by position (index) in the list)
public InvItem this[int index]
{
get
{
if
(index < 0)
{
// lowest index value for an item in the list is 0
throw new
ArgumentOutOfRangeException(index.ToString());
}
else if
(index >= invItems.Count)
{
// list is 0 based. If the Count is 3, the first item in the list is at index 0
// and the last item in the list is at index 2
throw new ArgumentOutOfRangeException(index.ToString());
}
return
invItems[index];
}
set
{
invItems[index] = value
;
Changed(invItems[index],
“Inventory Items information was updated!”
);
}
}
// Add method to add invitems to the list
public void Add(InvItem InvItemIn)
{
invItems.Add(InvItemIn);
// fire change event
Changed(InvItemIn, “Inventory Item information was added to the list!”);
}
// Remove method to delete studentgrade from the list
public
void
Remove(InvItem InvItemIn)
{
invItems.Remove(InvItemIn);
// fire change event
Changed(InvItemIn, “Inventory Item information was removed from the list!”);
}
// operators for + and –
public static InvItemList operator +(InvItemList invItem, InvItem item)
{
invItem.Add(item);
return
invItem;
}
public static InvItemList operator -(InvItemList invItem, InvItem item)
{
invItem.Remove(item);
return
invItem;
}
public void Add(int itemNo, string description, decimal price)
{
InvItem i = new InvItem(itemNo, description, price);
invItems.Add(i);
}
public void Fill()
{
invItems = InvItemDB.GetItems();
}
public void Save()
{
InvItemDB.SaveItems(invItems);
}
}
}
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
In This Exercise You Will Use Software At Car Selling Web Sites To Find Product
/in Uncategorized /by developerIn this exercise, you will use software at car- selling Web sites to find product information about a car of your choice and use that information to make an important purchase decision. You will also evaluate two of these sites as selling tools. You are interested in purchasing a new Ford Escape (or some other car of your choice). Go to the Web site of CarsDirect ( www. carsdirect. com) and begin your investigation. Locate the Ford Escape. Research the various Escape models, choose one you prefer in terms of price, features, and safety ratings. Locate and read at least two reviews. Surf the Web site of the manufacturer, in this case Ford ( www. ford. com). Compare the information available on Ford’s Web site with that of CarsDirect for the Ford Escape. Try to locate the lowest price for the car you want in a local dealer’s inventory. Suggest improvements for CarsDirect. com and Ford. com.
3-12 Requirements: Answers will vary a great deal, and with the option of choosing a car other than the Ford Escape, each student will more than likely turn in a different report. Students are required to use an Excel spreadsheet to compare the auto information from each of the Web sites. This will allow them to see from line-to-line the differences and similarities between the prices, safety ratings, features, and so on. Also, students should write a brief summary of the reviews they read concerning the auto and in their final report tell which decision they made referring back to the reviews. The final report should also include a review of the Web sites with suggestions for improvement.
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
In This Experiment A Hot Metal Block At 100oc Is Added To Cold Water In A Calori
/in Uncategorized /by developerIn this experiment a hot metal block at 100oC is added to cold water in a calorimeter. The heat lost by the metal block equals the heat gained by the water and the two end up at the same temperature.In one experiment, the mass of the metal block is 75.0 grams, the volume of water used is 74.6 mL, the temperature of the cold water extrapolated to the time of mixing is 17.5oC, and the temperature of the metal block and water extrapolated back to the time of mixing is 28.2oC
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
In This Experiment We Injected The Sample To Be Analyzed By Gas Chromatograph Eq
/in Uncategorized /by developerIn this experiment we injected the sample to be analyzed by Gas Chromatograph equipped with an FID (Flame Ionization Detector). The detector ionizes the sample as it reaches it, and the peak is proportional to the number of ions with a live flame. Explain in detail, why we need to run a standard when the GC is equipped with an FID detector to identify the component in a sample?
Gas Chromatography is another chromatography method you are learning about this semester. Construct a table comparing and contrasting the two other chromatography methods (TLC and LC). Point out to differences and similarities between each method and the GC method. Give at least 4 criteria of comparison.
During last week’s lab of distillation, many of you had difficulties getting the fractional distillation column to work properly. Specifically, the liquid started condensing at the top of the fractional column and the vapor did not distill over. It was suggested that changing the bead size (which was in the column) to a larger size might improve the outcome of the experiment. Is this suggestion valid? Would it help the process or is this suggestion wrong? Explain your answer.
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
In This Experiment We Made The Synthesis Of Biodiesel By Acid Catalysis H2so4 Wi
/in Uncategorized /by developerIn this experiment, we made the synthesis of biodiesel by acid catalysis H2SO4 with vegetable oil (Colza)and 1-propanol. BUT if we had used a basis for the synthesis of biodiesel,we would have had superior Yield. Explain Therefore with the help of a mechanism.Don’t forget the arrows
o rrO .f , ,? f”o fi e’it-c-0ch- ll Lhty._. o "_ R, –r rF –**) t,H tz- Q-1′ *,s!-L-o -l- u’-,, , , cl’-o rL-‘< ,/__,it t)0Fs C.l5 r;y11 I Q-+-tort ( "*trr, a + z E/- l:-0 r…
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
In This File Write A Java Program To Solve The Following Problem A File Named Lo
/in Uncategorized /by developerIn this file write a Java program to solve the following problem:
A file named loanBalance.txt contains numeric values that represent the balance of home loans for
customers of a bank. The loan balance for each customer is on a separate line within the file. Example data
from the file might be similar to:
65340.50
43892.00
38102.95
89820.75
106530.60
Your Java program must read the file into an appropriate array – you may assume that the file exists. The array should be
sized to store 500 loan balances but keep in mind that the file may not contain 500 loan balances.
after reading the file into the array calculate and display the average of the loan balances from the
array.
After reading the file into the array determine and display the largest loan balance from the array.
use appropriate methods and parameter passing.
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"