Below is the solution:
code:
Public Class frmMain
'declare variable
Dim avg As Double
Dim sum As Double = 0
Dim rain As Double
Dim count As Integer
Private Sub ClearToolStripMenuItem_Click(sender
As Object, e As EventArgs) Handles
ClearToolStripMenuItem.Click
'clear all the
values
txtRainfall.Text =
""
lstRainfall.Items.Clear()
sum = 0
avg = 0
End Sub
Private Sub
ExitToolStripMenuItem_Click(sender As Object, e As EventArgs)
Handles ExitToolStripMenuItem.Click
Me.Close() 'close
form
End Sub
'textbox button press event
Private Sub textBox_EnterClicked(sender As
Object, e As KeyEventArgs) Handles txtRainfall.KeyDown
count =
lstRainfall.Items.Count()
If e.KeyCode =
Keys.Enter Then 'check for enter key press
If Not Double.TryParse(txtRainfall.Text, rain) Then
MessageBox.Show("Error! Enter Rainfall") ''error when enter wrong
data
Else
lstRainfall.Items.Add(txtRainfall.Text) ''add the rainfall
txtRainfall.Text = ""
If count = 11 Then 'sum of all the raifall entered
For i = 0 To lstRainfall.Items.Count - 1
sum += CDbl(lstRainfall.Items(i))
Next
avg = sum / lstRainfall.Items.Count 'average the sum of all the
rainfall entered
lblRainfall.Text = "Avearge Rainfall per month is " &
FormatNumber(avg, 1) & " inches " 'display number in one
decimal format place
End If
End If
End If
End Sub
End Class
output:
We were unable to transcribe this image
the code is in visual basic 376 Chapter 6 Loop Structures Case Programming Assignments con Most...
Write a C# code for a Sales Calculator: Note: You cannot use the foreach loop in any part of this program! sales.txt file: 1189.55, 1207.00, 1348.27, 1456.88, 1198.34, 1128.55, 1172.37, 1498.55, 1163.29 The application should have controls described as follows: • A button that reads Get Sales. If the user clicks this button, the application should call a method named ProcesSalesFile. ProcessSalesFile Method: accepts no arguments and does not return anything The ProcessSalesFile Method will do the following: o Open...
Write a C# code for a Sales Calculator: Note: You cannot use the foreach loop in any part of this program! sales.txt file: 1189.55, 1207.00, 1348.27, 1456.88, 1198.34, 1128.55, 1172.37, 1498.55, 1163.29 The application should have controls described as follows: • A button that reads Get Sales. If the user clicks this button, the application should call a method named ProcesSalesFile. ProcessSalesFile Method: accepts no arguments and does not return anything The ProcessSalesFile Method will do the following: o Open...
Chapter 8 Python Case study Baseball Team Manager For this case study, you’ll use the programming skills that you learn in Murach’s Python Programming to develop a program that helps a person manage a baseball team. This program stores the data for each player on the team, and it also lets the manager set a starting lineup for each game. After you read chapter 2, you can develop a simple program that calculates the batting average for a player. Then,...
One example of computer-aided design (CAD) is building geometric structures inter- actively. In Chapter 4, we will look at ways in which we can model geometric objects comprised of polygons. Here, we want to examine the interactive part. Let’s start by writing an application that will let the user specify a series of axis- aligned rectangles interactively. Each rectangle can be defined by two mouse positions at diagonally opposite corners. Consider the event listener canvas.addEventListener("mousedown", function() { gl.bindBuffer(gl.ARRAY_BUFFER, vBuffer); if...
Using C++ in Visual Studios Rewrite the code to use a Stack instead of a Queue. You will need to think about the differences in the Stack and Queue. Think about how they operate and how the nodes may differ. Modify the code as necessary. You will need to push to the Stack, pop from the Stack, peek at the Stack. You will need a member functions like in the example code. Your program will need to show that everything...
could you please help me with this problem, also I need a little text so I can understand how you solved the problem? import java.io.File; import java.util.Scanner; /** * This program lists the files in a directory specified by * the user. The user is asked to type in a directory name. * If the name entered by the user is not a directory, a * message is printed and the program ends. */ public class DirectoryList { public static...
Additional code needed: PartA: BurgerOrder class (1 point) Objective: Create a new class that represents an order at a fast-food burger joint. This class will be used in Part B, when we work with a list of orders. As vou work through this part and Part B, draw a UML diagram of each class in using the UML drawing tool 1) Create a new Lab5TestProject project in Netbeans, right-click on the lab5testproject package and select New>Java Class 2) Call your...