Determine the output displayed when the button is clicked

Assignment Help JAVA Programming
Reference no: EM13772099

1. Determine the output displayed when the button is clicked.

Private Sub btnDisplay_Click(...) Handles btnDisplay.Click

Dim nums() As Integer = {3, 5, 8, 10, 21}

Dim total As Integer = 0

For Each num As Integer In nums

If (num Mod 2 = 0) Then

total += 1

End If

Next

txtOutput.Text = total & " even numbers"

End Sub

2. Determine the output displayed when the button is clicked. Assume the five lines of the file Dates.txt contain the numbers 1492, 1776, 1812, 1929, and 1941 and the file is in the appropriate folder.

Private Sub btnDisplay_Click(...) Handles btnDisplay.Click

Dim dates() As String = IO.FilereadAllLines("Dates.txt")

Dim total As Integer = 0

For Each yr As String In dates

If (CInt(yr) >= 1900) Then

Total += 1

End If

Next

txtOutput.Text = total & " 20th-century dates"

End Sub

3. Identify the errors in the following program segment.

Dim nums() As Integer = {1, 2, 3)

For Each num as Integer In nums

Num += 100

Next

MessageBox.Show(CStr(nums.Sum)

4. Determine the output displayed when the button is clicked:

Structure College

Dim name As String

Dim stat As String

Dim yearFounded As Integer

End Structure

Private Sub btnDisplay_Click(...) Handles btnDisplay.Click

Dim school As College

school.name = "USC"

school.state = "CA"

school.yearFounded = 1880

‘Now.Year is the current year

Dim age As Integer = Now.Year - school.yearFounded

txtOutput.Text = school.name & " is " & age & "years old."

End Sub

5. Write a program using the file Baseball.txt that requests a team as input from a list and displays the players from that team.
The players should be sorted in decreasing order by the number of hits they had during the season. The Baseball.txt file contains data about the performance of major league baseball players during the 2009 regular season. Each record of the file contains four fields - name, team, atBats, and hits. Some lines of the file are as follows:

Aaron Hill, Blue Jays, 682, 195

Ichiro Suzuki, Mariners, 639, 225

Derek Jeter, Yankees, 634, 212

The output should look like the following:

6. Determine the errors in the following code.

Structure Vitamins

Dim a As Double

Dim c As Double

End Structure

Private Sub btnDisplay_Click(...) Handles btnDisplay.Click

Dim minimum As Vitamins

minimum.c = 60

minimum.a = 5000

lstOutput.Items.Add(minimum)

End Sub

Reference no: EM13772099

Questions Cloud

What changes is there likely to be in these same cost curves : Suppose a business experiences a sudden increase in its fixed costs. What changes, if any, is there likely to be in these same cost CURVES
Do you think that john f kennedys assassination a conspiracy : Do you think that John F. Kennedy's assassination was a conspiracy?
The physical force to structure solar systems : There is an organizational structure to the universe that exists at a level higher than that of the galaxy. Describe this structure?
What alternative should be pursued and why : Lay out the arguments forand against trade treaties like NAFTA, and/or for the process of"globalization" of the U.S. economy. What do you think? What is your position, positive or negative, and why do you think so? Paterson, which now has lost most o..
Determine the output displayed when the button is clicked : Determine the output displayed when the button is clicked. Assume the five lines of the file Dates.txt contain the numbers 1492, 1776, 1812, 1929, and 1941 and the file is in the appropriate folder.
Classes of hazardous materials : From an emergency response perspective, what precautions must emergency responders take into consideration when responding to transportation incidents involving explosives? How are explosives regulated in transport? How do these differ from other ..
Compare lord krishnas teachings with socratess teachings : Compare and contrast Lord Krishna's teachings in the "Bhagavad Gita" with Socrates's teachings to Crito in Plato's "Crito." What are the values each teaches?
Type of respiratory protection device : Select the preferred type of respiratory protection device and identify which standardized OSHA filter color the device should be fitted.
Describe the distinctions between jails and prisons : Write a 200- to 300-word response in which you describe the distinctions between jails and prisons. Address the following in your comparison: Identify the four types of prisons

Reviews

Write a Review

JAVA Programming Questions & Answers

  Create a program called date java to perform

Create a program called Date.java to perform error-checking on the initial values, for instance: fields month, day, and year. Also, provide a method nextDay() to increment the day by one. The Date object should always remain in a consistent state.

  Write a program arrayprocessing.java

Write a program ArrayProcessing.java that reads a file name from the keyboard. The file contains integers, each on a separate line. You then create a corresponding array with integers from the lines.

  Rewrite this code in order to ask the user for input

rewrite this code in order to ask the user for input and then coverth it from infex to postfix ,, so i want to put a Scanner and this ask the user for input .. how to do it ?

  Design and develop a console application

Required to design and develop a console (text-based) application for a small car servicing company -

  Write a method called makerow

Write a method called makeRow that is passed two arguments: an int and a String. It returns a String containing n copies of s, concatenated in a row.

  What is the purpose of using javascript on a website what

what is the purpose of using javascript on a website? what is a specific example of a javascript application that will

  Determines if the input string is a valid lock combination

Write a Java program that satisfies the given requirement - Prompts the user to input exactly nine characters, which constitute a valid lock combination.

  Technical community blog

Write a blog article for a coding/technical community blog

  Prepare a java program to create a gui

Prepare a java program to create a GUI and show the picture of the zodiac. Be sure to include comments. The comment should describe the purpose of the program and the data to be entered.

  Implement avl trees that allows both iterative traversal

implement avl trees that allows both iterative traversal and recursive traversal.iterative traversal is fairly easy if

  Write a public static method called sumdigits

Write a public static method called sumDigits that will return the sum of the digits within a string.

  Java program using jgrasp and the software development kit

Design a GUI program to find the weighted average of four test scores. The four test scores and their respective weights are given in the following format:

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd