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

  Write a complete java program to simulate ahmed''s show

Suppose you're on a game show and you're given the choice of three doors. Behind one door is a car; there is nothing behind the others. The car and is placed randomly behind the doors before the show. The rules of the game show are as follows:

  Write complete java program to read from keyboard

Write complete Java program to read, from keyboard, a student's first and last name and six grades. It will display on screen last name then first letter of first name with a period.

  Calculate the body mass index

Write an application (BMICalc) that reads the user's weight in poinds and height in inches, then calculates the Body Mass Index.

  Write a java program to perform matrix multiplication

In this project you need to write a java program called to perform matrix multiplication and

  Use counting sort to sort an array

State the difficulty in attempting to use counting sort to sort an array of n floating-point numbers from the continuous interval [0,1].

  Application that reads the lengths of sides of a triangle

Write a java application that reads the lengths of the sides of a triangle from the user.

  Represent the relationship between parents - children class

Draw a class diagram that represents the relationship between parents, children, and grandparents. Take into account that a person can have both a parent and a child. Annotate associations with roles and multiplicities.

  Program create an application that uses a priorityqueue to

create an application that uses a quotpriorityqueuequot to perform the following ltbrgt ltbrgtuses the constructor that

  Create a javafx application named runningman.java

Create a JavaFX application named RunningMan.java to animate a man running laps. The man should run from left to right until the edge of the window is reached. The man should then begin running in the opposite direction.

  Use data structures and algorithm to implement search engine

For the URLs in the keyword list, sort them by either the number of times the keyword appearing in the pages or the popularity of the pages.

  Complete the recursive method matchstring x string y in the

complete the recursive method matchstring x string y in the code below which will determine whether or not two strings

  Develop and test stand alone java applications

Gain practical skills in Graphical User Interface (GUI) programming by implementing an event driven application.

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