Question

In: Computer Science

*VISUAL BASIC* Construct and instantiate an array of strings called afcSouth that contains the following information...

*VISUAL BASIC* Construct and instantiate an array of strings called afcSouth that contains the following information separated by commas (as team, wins, losses, and ties). You realize now that you need to compute a winning percentage (namely (wins+.5*ties)/(wins + losses+ties)) for these teams.  Use this array to create a structure afcSouthTeam consisting of types string, integer, integer, integer, and double. Write a for loop that will cycle through the array to populate this structure with the actual data.

Solutions

Expert Solution

Following is the Code:

Imports System
Public Structure afcSouthTeam 'Create structure
   Public teamName As String
   Public wins As Integer
   Public loses As Integer
   Public ties As Integer
   Public winPercent As Double
End Structure

Class MyClient
   Public Shared Sub Main()
       Dim afcSouth() As String = {"TeamA", "10", "5", "2"}
       Dim team as New afcSouthTeam
       Dim j As Integer
       For j = 0 To 4
           If (j <> 0) Then
               team.teamName = afcSouth(0)
           End if
           If (j <> 1) Then
               team.wins = CInt(afcSouth(1)) 'Convert String to Integer
           End if
           If(j <> 2) Then
               team.loses = CInt(afcSouth(2)) 'Convert String to Integer
           End if
           If(j <> 3) Then
               team.ties = CInt(afcSouth(3)) 'Convert String to Integer
           End if
           If(j <> 4) Then 'Computer results in double datatype
               team.winPercent = (team.wins + (0.5) * team.ties) / (team.wins + team.loses + team.ties)
           End if
           Next j
       Console.WriteLine("The TeamName = is {0}", team)
       Console.WriteLine("The Wins - {0}", team.wins)
       Console.WriteLine("The Loses = {0}", team.loses)
       Console.WriteLine("The Ties = {0}", team.ties)
       Console.WriteLine("The Win Percentage = {0}", team.winPercent)
   End Sub 'Main
End Class 'MyClient


Related Solutions

Seasons Re-Visited Write a program that contains an array of strings in main(). Your array of...
Seasons Re-Visited Write a program that contains an array of strings in main(). Your array of strings will contain the seasons, “Winter”, “Spring”, “Summer”, and “Fall”. Your program will then contain a function that will use your seasons array to display a menu and ask the user to choose their favorite season and return that value to the main() function. Your function must include a data validation loop. The user must enter in a 1 for winter, a 2 for...
Write a function (in Javascript) called longestMorseCodeWords which takes in an array of strings. The output...
Write a function (in Javascript) called longestMorseCodeWords which takes in an array of strings. The output of longestMorseCodeWords should be an array of the strings that were passed in, but ordered by the length of their Morse Code equivalent in descending order. If the length of Morse Code is equal, order the words alphabetically.For convenience, the full table for the 26 letters of the English alphabet is given below: [".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."] let words = ["gin", "zen", "gig", "msg"] longestMorseCodeWords(words) The Morse...
Language: c++ works in visual basic Write a program that uses an array of nested structs...
Language: c++ works in visual basic Write a program that uses an array of nested structs to store the addresses for your store’s customers.  Each customer has a name and two addresses: home address and business address.  Each address has a street, city, state, and zip code. Requirements: 1. Data structure a. Define an Address struct with street, city, state and zip fields b. Define a Customer struct with lastNm and firstNm fields, plus homeAddr and busAddr fields...
can anyone give me an example of an Array and its usage in Visual Basic programming
can anyone give me an example of an Array and its usage in Visual Basic programming
USE VISUAL BASIC / VB You will create a datafile with the following information: 70 80...
USE VISUAL BASIC / VB You will create a datafile with the following information: 70 80 90 55 25 62 45 34 76 105You will then write the program to read in the values from the datafile and as you read in each number, you will then evaluate it through an if statement for the weather of the day. For example, when you read in the value 70 from the datafile, you should print to the screen that the temperature...
Create a structure array that contains the following information fields concerning the road bridges in a town
Create a structure array that contains the following information fields concerning the road bridges in a town: bridge location, maximum load (tons), year built, year due for maintenance. Then enter the following data into the array:
Create a program in visual basic that allows the user to manage vehicle information including: •...
Create a program in visual basic that allows the user to manage vehicle information including: • License plate number • Owner name • Owner phone number The user interface will be GUI-based providing the following capabilities: • Add up to 100 vehicles • Remove specified vehicles • View a sorted list of all known license plates • View the data for a specified vehicle • Save the database contents into a file • Load a saved database from a file
Instructions (No array) (c++) (visual studio) 1. Create a project called Project3B 2. Create 3 String...
Instructions (No array) (c++) (visual studio) 1. Create a project called Project3B 2. Create 3 String variables called name1, name2, name3 3. Create 9 double variables called test1_1, test1_2, test1_3, test2_1, test2_2, test2_3, test3_1, test3_2, test3_3 4. Create 3 double variables called average1, average2, average3 To calculate the average score = (test1 + test2 + test3) / 3.0 5. Run the program with the following data using cin name1 = “Tom”, name2 = “Mary”, name3 = “Ali” test1_1 = 81.4,...
Write a class called Pen that contains the following information: Private instance variables for the price...
Write a class called Pen that contains the following information: Private instance variables for the price of the pen (float) and color of the pen (String). A two-argument constructor to set each of the instance variables above. If the price is negative, throw an IllegalArgumentException stating the argument that is not correct. Get and Set methods for each instance variable with the same error detection as the constructor. public class Pen {
4. Construct regular expressions for the following languages over the alphabet {a, b}: a. Strings that...
4. Construct regular expressions for the following languages over the alphabet {a, b}: a. Strings that do not begin with an “a”. b. Strings that contain both aa and bb as substrings. 5. Let ? = {? ?? ?? ? | ? > ? + ?}. a. List all strings of length 7. (use power notation: i.e. aabbbbaaaaaaaa is a2b 4a 8 ) b. Use the Pumping Lemma for Regular Languages to prove that L is not regular.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT