1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Andre45 [30]
3 years ago
9

Write a program that lets the user enter the name of a team and then displays the number of times that team has won the World Se

ries. The WorldSeriesWinners.txt file contains a chronological list of the world series winning the World Series in the time period from 1903 to 2018. Tips and tricks: Question. How do I use arrays to complete this assignment? Answer 1: You can use arrays if you want. You will need read the file twice, first time to determine the number of lines in the file, and then the second time to assign values to the elements of your array. You will have to create this string array with the size that you found out by reading the file the first time. Answer 2. Do not use arrays, use ArrayList class instead. The topic is covered in Chapter 7 of your text book. We will cover the material during the next lecture, but there is nothing that prevents you from using this class.
Computers and Technology
1 answer:
xz_007 [3.2K]3 years ago
5 0

Answer:

see explaination

Explanation:

import java.io.*;

import java.util.Scanner;

public class Winners {

public static void main(String args[]) throws IOException {

Scanner sc = new Scanner(new File("WorldSeriesWinners.txt"));

String commands[] = new String[100000];

int c = 0;

while (sc.hasNextLine()) {

String input = sc.nextLine();

System.out.println(input);

if (input.isEmpty())

continue;

commands[c++] = input;

}

sc.close();

Scanner keyboard = new Scanner(System.in);

System.out.println("Enter the name of a team: ");

String name = keyboard.nextLine();

int count = 0;

for (int i = 0; i < c; i++) {

if (commands[i] != null) {

if (commands[i].equals(name)) {

++count;

}

}

}

if(count!=0)

System.out.println(name + " has won the World Series in the time period from 1903 through 2018 " +count + " number of times" );

else

System.out.println("Team with name "+name+ " does not exists");

}

}

You might be interested in
Robin ensures that she is always available if anyone in the team needs her. Which quality is shown by robin?
Inessa05 [86]
Helpful, resourceful, friendly, welcoming.
8 0
3 years ago
Read 2 more answers
) Perform error checking for the data point entries. If any of the following errors occurs, output the appropriate error message
emmainna [20.7K]

Answer:

In Python:

entry = input("Sentence: ")

while True:

   if entry.count(",") == 0:

       print("Error: No comma in string")

       entry = input("Sentence: ")

   elif entry.count(",") > 1:

       print("Error: Too many comma in input")

       entry = input("Sentence: ")

   else:

       ind = entry.index(',')+1

       if entry[ind].isnumeric() == False:

           print("Comma not followed by an integer")

           entry = input("Sentence: ")

       else:

           break

print("Valid Input")

Explanation:

This prompts the user for a sentence

entry = input("Sentence: ")

The following loop is repeated until the user enters a valid entry

while True:

This is executed if the number of commas is 0

<em>    if entry.count(",") == 0:</em>

<em>        print("Error: No comma in string")</em>

<em>        entry = input("Sentence: ")</em>

This is executed if the number of commas is more than 1

<em>    elif entry.count(",") > 1:</em>

<em>        print("Error: Too many comma in input")</em>

<em>        entry = input("Sentence: ")</em>

This is executed if the number of commas is 1

   else:

This calculates the next index after the comma

       ind = entry.index(',')+1

This checks if the character after the comma is a number

       if entry[ind].isnumeric() == False:

If it is not a number, the print statement is executed

<em>            print("Comma not followed by an integer")</em>

<em>            entry = input("Sentence: ")</em>

If otherwise, the loop is exited

<em>        else:</em>

<em>            break</em>

This prints valid input, when the user enters a valid string

print("Valid Input")

Note that: entry = input("Sentence: ") <em>is used to get input</em>

4 0
3 years ago
The ________ is responsible for the Internet's domain name system and the allocation of IP addresses.
Agata [3.3K]

Answer:

The answer is "ICANN"

Explanation:

In the given question some information is missing, that is option, which can be described as follows:

A) IAB

B) ICANN

C) W3C

D) ISOC

It manages the installation and processes of multiple databases concerning the Network domain and  provides a stable and safe networking service, and wrong choices were explained as follows:

  • IAB, It provides a protocol to manage IETF, that's why it is wrong.
  • W3C is used in web development.
  • ISOC is used to provide internet accessibility.
6 0
3 years ago
Individuals and IT professionals have a responsibility to be aware of security threats and the damage they might do.
Veseljchak [2.6K]
The answer is true they will have to be responsible
6 0
2 years ago
Which are guidlines for using themes? Check all that apply
Andreyy89

Answer: A. Using different cell styles can help you differentiate different types of data.

B. Fonts should be easily readable and of appropriate size.

D. Be consistent with themes across worksheets and workbooks.

Explanation:

A theme refers to the preset package that contains functionality details and graphical appearance.

The guidelines for using themes include:

• Using different cell styles can help you differentiate different types of data.

• Fonts should be easily readable and of appropriate size.

• Be consistent with themes across worksheets and workbooks.

Therefore, the correct options are A, B and D.

7 0
3 years ago
Other questions:
  • A computer abuse technique called a ____ involves inserting unauthorized code in a program, which, when activated, may cause a d
    11·1 answer
  • Juliet is trying to increase her savings account and she decides that she is going save an additional $700 every month. If her m
    9·1 answer
  • Fill in the blank
    11·1 answer
  • What arw two reasons for maintaning your privacy on the internet
    11·2 answers
  • When an interrogator speaks highly about how a crime was committed, hoping to get the suspect to brag about his or her involveme
    7·2 answers
  • Which of the following is NOT an advantage to using inheritance?
    13·1 answer
  • A label control may be added to a form by double-clicking on the Label control icon in the ________ window.
    15·1 answer
  • What two windows security updates do most organizations always patch?
    7·1 answer
  • Which of the following statements is true regarding a user account? Once a user account has been created, it cannot be completel
    8·1 answer
  • A ……………………………is used to verify the identity of a website and is issued to the owner of the website by an independent and recogni
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!