Open the Calories Solution.sln file contained in the VB2017\Chap08\Calories Solution folder. Open the Code Editor window and locate the btnDisplay_Click procedure. The procedure declares and initializes a one-dimensional array named intCalories. The array stores the numbers of daily calories consumed. The procedure should calculate and display the average number of calories consumed; use the Math.Round method to round the average to an integer. (You learned about the Math.Round method in Chapter 6.) The procedure should also display the number of days in which the daily calories were greater than the average, the number of days in which the daily calories were the same as the average, and the number of days in which the daily calories were less than the average. Code the procedure. Save the solution and then start and test the application.
'Note this is done in Visual Basic.
Conditions:
Three Option Statements Must be used in the beginning of the code which are:
Option Explicit On
Option Strict On
Option Infer Off
It must be done in Visual Basic Windows Forms App.
VB Windom form code
============================================================================================
Option Explicit On
Option Strict On
Option Infer Off
Public Class Form1
Private Sub btnDisplay_Click(sender As Object, e As EventArgs) Handles btnDisplay.Click
'declares and initializes a one-dimensional array named
intCalories
Dim intCalories() As Integer = {23, 45, 12, 45, 11, 56, 34, 11, 9,
8, 67, 56, 2, 5}
Dim avg As Double
Dim sum As Integer
Dim sum1, sum2, sum3 As Integer
sum = 0
'find sum of calories
For i As Integer = 0 To intCalories.Length() - 1
sum = sum + intCalories(i)
Next
'find avg of calories
avg = sum / intCalories.Length() - 1
' round the average to an integer
avg = Math.Round(avg)
sum1 = 0
sum2 = 0
sum3 = 0
For i As Integer = 0 To intCalories.Length() - 1
If (intCalories(i) < avg) Then
sum1 = sum1 + 1
ElseIf (intCalories(i) = avg) Then
sum2 = sum2 + 1
Else
sum3 = sum3 + 1
End If
Next
Label1.Text = "The number of days in which the daily calories were
less than the average: " + sum1.ToString()
Label2.Text = "The number of days in which the daily calories were
the same as the average: " + sum2.ToString()
Label3.Text = "Thenumber of days in which the daily calories were
greater than the average: " + sum3.ToString()
End Sub
End Class
============================================================================================
Output
Open the Calories Solution.sln file contained in the VB2017\Chap08\Calories Solution folder. Open the Code Editor window...
Open the Gross Pay
Solution.sln file contained in the VB2017\Chap08\Gross Pay Solution
folder. The interface provides a text box for entering the number
of hours an employee worked. It also provides a list box for
selecting the employee’s pay code. The btnCalc_Click procedure
should display the gross pay, using the number of hours worked and
the pay rate corresponding to the selected code. The pay codes and
rates are listed in Figure 8-47. Employees working more than 40
hours receive...
Open the Chang Solution (Chang Solution.sln) file contained in the VbReloaded2015\ Chap11\Chang Solution folder. The application should display a grade based on the number of points entered by the user. The grading scale is shown in Figure 11-47. Create a structure that contains two members: an Integer variable for the minimum points and a String variable for the grades. Use the structure to declare a class-level one-dimensional array that has five elements. The MainForm_Load procedure should store the minimum points...
Open the Validate Number Solution.sln file contained in the
VB2017\Chap07\Validate Number Solution folder. The interface
provides a text box for entering a 9-digit number. The
btnValidate_Click procedure should use the algorithm and example
shown in Figure 7-56 to validate the user’s entry. The procedure
should display a message indicating whether the entry is or is not
valid. Code the procedure. Include any other code that will
professionalize the interface. Save the solution and then start and
test the application. Create...
Zander Inc. stores employee IDs and salaries in a sequential
access file named Employees.txt. Open the VB2015\Chap10\Zander
Solution\Zander Solution (Zander Solution.sln) file. Open the
Employees.txt file, which is contained in the project’s bin\Debug
folder. The ID and salary information appear on separate lines in
the file. Close the Employees.txt window. a. Define a structure
named Employee. The structure should contain two member
variables:
a String variable to store the ID and a Double variable to store
the salary.
b. Declare...
Follow the instructions for starting C++ and viewing the Intermediate23.cpp file, which is contained in either the Cpp8IChap11\Intermediate23 Project folder or the Cpp8\Chap11 folder. (Depending on your C++ development tool, you may need to open the project/solution file first.) The program uses an array to store the amount of money a game show contestant won in each of five days. The program should display the total amount won and the average daily amount won. It should also display the day...
I need help regarding my Visual Basic code
ISC/ITE 285 Homework Due: Monday, January 28 by 11:55 pm Create a text file named "Grades.txt" which will contain a list of numeric grades. Save the file in the projects Bin/Debug folder. A sample of the file contents is shown below: 80 96 95 86 54 97 Create a string array that will be populated from the file "Grades.txt" when the array is created (Class-level array). Also create a numeric array that...
This is done in visual basic langauge. I created a
query and i want to invoke this query from code.
for example, if i select the Company-owned radio button and hit the
display button ONLY the information for company owned stores should
be shown. same for the other radio button except it will only show
the information for the Franchise ownership.
F. for Franchises
C. for company owned
please provide the appropriate code.
and select statements.
hon Mcescft Vsal Studio...
write by python code and screenshoot the python code for me. thanks The Problem: You are to design a Calorie Intake Assistant tailored to the user’s personal characteristics. The assistant will initially ask the user for his/her gender, name, age in years, height in cm and weight in kg. Based on these, the assistant will calculate the recommended daily calorie intake (RDCI) using the Mifflin – St Jeor formula[1], which is also shown to the user: Mifflin – St Jeor...
Problem Statement You are to create a Visual Basic(VB) project for a census bureau to obtain and analyze household income survey data within the Pittsburgh area (including Morgantown Ky). Data Collected: Home identification code (4 alphanumeric characters) – required Program should generate it using a random number generator. You won’t use this anywhere it just need to be generated. Generate the first number in the Form Load event and then each subsequent number in the button click. See attached code...
Program 7 File Processing and Arrays (100 points) Overview: For this assignment, write a program that will process monthly sales data for a small company. The data will be used to calculate total sales for each month in a year. The monthly sales totals will be needed for later processing, so it will be stored in an array. Basic Logic for main() Note: all of the functions mentioned in this logic are described below. Declare an array of 12 float/doubles...