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
You open a folder Properties box to encrypt the folder, click Advanced, and discover that Encrypt contents to secure data is dim
yaroslaw [1]

Most likely a virus has attacked the system and is disabling encryption is the most likely problem.

c. Most likely a virus has attacked the system and is disabling encryption.

<u>Explanation:</u>

The end users can protect the folder by enabling encrypt the folder or files. But in windows encrypting the file or folder is not available. The computer management console is used to open all other services such as risk management, performance management extra.

In some other operating encryption of folder or files is allowed.  Third-party software is available to protect folder or files once the third party used any files possible to share outside the world.

As far as my knowledge there is encrypting technology is available in the windows operating system.

5 0
3 years ago
Maggie is preparing a business report. Which types of keys will she use to type out words and numbers?
nadya68 [22]
She would use enter period comma backspace
Hope this helps u
6 0
3 years ago
Read 2 more answers
During boom times, which of the
pashok25 [27]
I think the answer is D.
3 0
3 years ago
Who would like to join a team devoted to decreasing spam and bullying?
Tema [17]
Yes i would love to help the cause <span />
6 0
3 years ago
What are the specifications of mine shaft head gear​
svetlana [45]

Answer:

the depth of the shaft,

the carrying load of the skip and the mass of the counterweight,

the approximate size of the winding drum,

the approximate height of the headgear and the sheave wheel

4 0
3 years ago
Read 2 more answers
Other questions:
  • How can you find Web pages that contain news published during the past week?
    8·1 answer
  • Informs the network interface card to pass packets sent to that address to the ip stack so their contents can be read, and tells
    9·1 answer
  • To arrange data in alphabetical order quickly, you can _____ the data.
    7·2 answers
  • What are all the folders located on the DOCK called?
    11·1 answer
  • A signal has a spectrum from 0 to 145 Hz, as shown below. It is sampled at a rate of 295 Hz. Find the region of the baseband spe
    5·2 answers
  • It is important to name your files in a variety of formats. true or false
    15·2 answers
  • Write down the bit pattern in the fraction of value 1/3 assuming a floating point format that uses Binary Coded Decimal (base 10
    10·1 answer
  • to see which employees received 3 or more bonuses. use the highlight cells rules conditional formatting to format cells in the r
    6·1 answer
  • What is this?
    15·2 answers
  • Pleaseee help me with the typical situations of the icons(i already know for words but I have no idea for giving the situations
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!