Explore BrainMass
Share

Visual Basic: Supply Cost Calculator Application

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

Write an application that calculates the cost of all the supplies added to the user's shopping list (Fig. 22.18). The application should contain two Li stBoxes. The first contains all the supplies offered and their respective prices. Users should be able to select the desired supplies from the first Li stBox and add them to the second Li stBox. Provide a Calculate Button that displays the total price for the user's shopping list (the contents of the second ListBox).

a) Copying the template to your working directory. Copy the directory C: ExamplesTutori al 22Exerci sesSuppl yCal cul ator to your C: Si mpl yVB2008 directory.

b) Opening the application's template file. Double click Suppl yCal cul ator. sl n in the Suppl yCal cul ator directory to open the application.

c) Adding code to the Add >> Button. Double click the Add >> Button to create an empty event handler. Insert code in the event handler that adds the selected item from the first Li stBox to shoppi ngLi stBox. Be sure to check that an item is selected in the first Li stBox before attempting to add an item to shoppi ngLi stBox.

d) Enabling the Buttons. Once the user adds something to the shoppi ngLi stBox, set the Enabl ed properties of the << Remove and Calculate Buttons to True.

e) Deselecting the items. Once the item is added to the shoppi ngLi stBox, make sure that it is deselected in the stockLi stBox. Also, clear the Total: Label to indicate to the user that a new total price must be calculated.

f) Adding code to the << Remove Button. Double click the << Remove Button to create an empty event handler. The Items in your list: Li stBox's Sel ecti onMode property has been set to Mul ti Extended to allow the user to select multiple items. Use a Do Whi l e loop to remove any selected items in the shoppi ngLi stBox. Be sureto check that at least one item is selected before attempting to remove an item. [Hint:Method shoppi ngLi stBox. Items. RemoveAt(i ndex) will remove the item located at i ndex from the shoppi ngLi stBox. When an item is removed, the Sel ectedIndexproperty points to the next selected item, if there is one.] If there are no items remaining in the shoppi ngLi stBox, disable the << Remove and Calculate Buttons.Also, clear the Total: Label to indicate to the user that a new total price must be calculated.

g) Adding code to the Calculate Button. Double click the Calculate Button to create an empty event handler. Use a For... Next statement to loop through all the items in the shoppi ngLi stBox. Convert each item from the Li stBox into a Stri ng. Then use the Stri ng method Substri ng to extract the price of each item.

h) Displaying the total. Convert the Stri ng representing each item's price to a Decimal , and add this to the overall total (of type Deci mal ). Remember to output the value in currency format.

i) Running the application. Select Debug > Start Debugging to run your application. Use the Add >> and << Remove Buttons to add and remove items from the Items in your list: Li stBox. Click the Calculate Button and verify that the total price displayed is correct.

j) Closing the application. Close your running application by clicking its close box.

k) Closing the IDE. Close the Visual Basic IDE by clicking its close box.

Please see the attached MS Word document and the files for further information.

© BrainMass Inc. brainmass.com October 17, 2018, 11:19 am ad1c9bdddf
https://brainmass.com/computer-science/visual-basic/visual-basic-supply-cost-calculator-application-533712

Attachments

Solution Summary

The supply cost calculator applications for visual basics are examined.

$2.19
Similar Posting

Environmental and Economic Analysis on Hewlett-Packard Company

I need some help. I need to complete an environmental and economic analysis on Hewlett-Packard Company, including the remote, industry, and operating environments.The paper should identify any major changes that you expect to affect Hewlett-Packard in the next 5-10 years. This will include the following subcomponents:
a.Utilize a macroeconomic forecast of economic indicators that will affect Hewlett-Packard in the future and should be considered part of strategic planning.
b.Analyze the non-economic factors in the remote environment:
1)Social and Cultural
2)Political
3)Technological
4)Demographic
c.Complete a competitive analysis of Hewlett-Packard's position from a microeconomic perspective based on the pricing of the organization's primary product or service line, an assessment of its cost structure, and an assessment of the market in which the organization competes. (Note: This should be a discussion, not a spreadsheet.)
d.Identify strengths and weaknesses in the organization's operating environment that can be leveraged to capitalize on the emerging opportunities or minimize the threats that you identified in items 1-4.
e.Create three to four strategic long-term objectives that can be measured to determine the success of the strategic plan.

I have added a paper on HP for reference.

View Full Posting Details