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
Electric Bill Problem 3.0 (20 Points) What is the total cost of using the following at /kWh? a. 1600 W air conditioner for 6h b.
gulaghasi [49]

Answer:

The total const is 13025 KWh

Explanation:

These are the steps to solve this problem:

  1. Convert all the powers from W to KW dividing by 1000.
  2. Convert all the times on minutes to hours dividing by 60.
  3. Then you can apply energy consumption formula Energy = Power*Time for any of the appliances. the results will be at KWh.
  4. Sum all the consumtions and you will have the total cost.

Attached you will have a spreadsheet as a guidance. Any  questions, just let me know.

Download xlsx
7 0
3 years ago
Which term refers to a shorthand method for identifying network and host bits in an ip address?
zloy xaker [14]

A CIDR Notation is known as the term that refers to a shorthand method for identifying network and host bits in an ip address.

<h3>What is CIDR Notation?</h3>

This is known to be a term that was devised in 1993 by the IETF. The  CIDR is said to be a  shorthand method for knowing network and host bits in an IP address.

Therefore, one can say that A CIDR Notation is known as the term that refers to a shorthand method for identifying network and host bits in an ip address.

Learn more about CIDR Notation from

brainly.com/question/14985928

#SPJ12

7 0
2 years ago
Choose the correct item. Check your answers in the text.<br>3​
RSB [31]

Answer:

You should do that

Explanation:

You didnt say anything

5 0
3 years ago
Jessie will make and sell the trending Baked California Maki. Her Peso mark up is 5.00. Selling price PHP 15.000. How much will
Levart [38]

Answer:

50%

Explanation:

The markup is the difference between the selling price and the cost price. If the mark up is greater than zero, it means there is a profit, if the markup is less than 0, it means there is a loss and if the markup is equal to 0, it means there is breakeven.

Percentage markup = (markup/cost price) * 100%

Selling price - cost price = markup

15 - cost price = 5

cost price = 10

Percentage markup = (markup/cost price) * 100% = (5/10) * 100% = 50%

7 0
3 years ago
If a person is proactive, they do NOT have to be defensive.<br> True<br> False
Thepotemich [5.8K]
The answer is true for this question
6 0
3 years ago
Read 2 more answers
Other questions:
  • A flowchart would be an example of what kind of programming?
    12·1 answer
  • Write a program that asks the user to enter a birth year. the program should then indicate which generation a person of that yea
    14·1 answer
  • A technology company only hires applicants who are under the age of 30. This company could face possibly _________ consequences
    9·2 answers
  • An employee who interacts with customers regarding the nature of their car problems, rather than actually working on the vehicle
    12·2 answers
  • So I was wondering how I should get into Game Development?
    12·1 answer
  • The _____ handles the instructions for your computer to start up before the operating system is loaded.
    11·1 answer
  • Given the following sets, for each set operation provide the elements of the resulting set in set notation or using a well-known
    5·1 answer
  • What is malware? a type of virus that spreads through a network connection a type of virus that targets programs and files any p
    12·1 answer
  • Add me on blizzard none of my friends play ow<br> NADERJABER#2530
    8·1 answer
  • How to give a file name as an argument in function in python.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!