Lab Assignments- Arrays
Objectives
In this lab assignment, students will learn:
- How to declare and initialize array
- How to save/retrieve data in/from array
- How to find the highest and lowest value from array
- How find sum and average value of an array
Create a "Gas Price" Windows Form Application, here is the sample input/output:
Allow user to enter gas prices for 12 month from the textbox and click the Enter button.
Create a 12 element 1-dimensional array of Decimal type
Store the prices in the array, and get price from the array, display in the listbox immediately.
When click "Get Highest Price" button, iterate the elements in the array and find the highest price and its month.
When click "Get Lowest Price" button, iterate the elements in the array and find the lowest price and its month.
When click "Get Average Price" button, iterate the elements in the array and find the average price.
Display results on the form.