visual Basic variable concepts , save contents from control to variable, from variable to control

Опубликовано: 06 Октябрь 2024
на канале: RioProfessor Liu
51
1

A procedure needs to store an item’s name and price (which may have decimal places).  Write the appropriate Dim statements to declare the necessary procedure-level variables.Dim strName as String dim dblPrice as DoubleA procedure needs to store the name of an inventory item, the number of units in stock at the beginning of the current month,  the number of units purchased during the current month, the number of units sold during the current month, and the number of units in stock at the end of the current month. The number of units is always  a whole number. Write the appropriate Dim statements to declare the necessary procedure-level variables.                 Dim intitialStock as integer                  Dim intPurchaseUnit as integer                  Dim intSoldUnit as integer                   Dim intEndStock as integer3.    Write an assignment statement that assigns Miami to a String vari- able named strCity.strCity =”Miani”4.    Write an assignment statement that assigns Desk to a String variable named strItemName. Also write assignment statements that assign the numbers 40 and 20 to Integer variables named intQuantityInStock and intQuantityOnOrder,strItemName =”Desk”intQuantityInStock = 40IntQuanityOnOrder = 205.   Write the statement to declare a procedure-level named constant named decTAX_RATE whose value is .05.Const decTAX_Rate = .056.    Write the statement to store the contents of the txtUnits control in an Integer variable named intNumberOfUnits.Integer.TryParse(txtUnits.text, intNumberOfUnits)7.   Write the statement to assign the contents of an Integer variable named intNumberOfUnits to the lblUnitslblUnits.Text = Convert.ToString(intNumberOfUnits)8.   An application needs to store the part number of an item and its cost (which may contain a decimal place). An example of a part number for this application is A103. Write the appropriate Private statements to declare the necessary class-levelPrivate strItemName as stringprivate dblCost  as double               9.   Write an assignment statement that adds together the contents of the dblNorthSales and dblSouthSales variables and then assigns the sum to the dblTotalSalesdblTotalSales.text  = Convert.toString (dblNorthSales + dblSouthSales)10.  Write an assignment statement that multiplies the contents of the decSalary variable by the number 1.5 and then assigns the result to the decSalary variable.decSalary = decSlary *1. 511.  Write the statement to assign the sum of the values stored in the decWestSales and decEastSales variables to a String variable named strTotalSales.strTotalSales = Convert.toString(decWestSales + decEastSales)