Question
Visual basic 2010 Programs To Accompany Programming Logic and Design 7th edition I need help figuring out this array. It's Lab 6.1 Array Basics. In
Visual basic 2010 Programs To Accompany Programming Logic and Design 7th edition
I need help figuring out this array. It's Lab 6.1 Array Basics.
In this lab, you complete a partially prewritten Visual Basic program that uses an array. The Program prompts the user to interactively enter 10 salaries, which the program stores in an array. It should then find the minmum and maximum salaries stored in the array, as well as the average of the 10 salaries. The data file provided for this lab includes the imput statement and some variable declarations. Comments are included in the file to help you write the remained of the program. Execute the program using the following 10 values: 45000.00, 22000.00, 6000.00, 100000.00, 57000.00, 1000.00, 90000.00, 12000.00, 6000.00, and 35000.00. The minimum value should be 1000, and the maximum value should be 100000. The average should be 37400.
Option Explicit On Option Strict On Module MinMaxSalary Sub Main() ' Declare a named constant for array size here
' Declare array here
' Use this integer variable as your loop index Dim loopIndex As Integer
' Use this variable to store the salary input by user Dim salary As Double
' Declare string version of salary here Dim salaryString As String ' Use these variables to store the minimim and maximum values Dim min As Double Dim max As Double
' Use these variables to store the total and the average Dim total As Double Dim average As Double
' Write a loop to get salaries from user and assign to array For loopIndex = 0 To MAX_SALARIES - 1 salaryString = InputBox$("Enter a salary: ") salary = Convert.ToDouble(salaryString) ' Assign value to array Next loopIndex ' Assign the first element in the array to be the minimum and the maximum min = salaries(0) max = salaries(0) ' Start out your total with the value of the first element in the array total = salaries(0) ' Write a loop here to access array values starting with numbers(1) ' Within the loop test for minimum and maximum salaries ' Also accumulate a total of all salaries ' Calculate the average of the 10 salaries
' Print the salaries stored in the salaries array ' Print the maximum value, minimum value, and average End Sub End Module
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started