Question
Im learning Java programming language. Here is input filename game.txt. As you can see, The first line in this input file consists of the number
Im learning Java programming language. Here is input filename game.txt. As you can see,
The first line in this input file consists of the number of countries or also known as team participating in both games.
The second line are the names of these countries.
Then from lines 3 to 8 is the game data for badminton sports and their results that have 3 sets of score.
whereas from line 9 to 14 the game data for soccer sports and also their results.
As you can see, this input file from line 3 and onwards have difference number of items in a line since they are not the same because it depends on the particular sport.
4 Malaysia;Japan;Belgium;USA Malaysia;Japan;21-19;21-8;21-17 Malaysia;USA;10-21;21-19;21-11 Malaysia;Belgium;21-9;21-9;21-0 Japan;Belgium;21-10;21-5;19-21 Japan;USA;16-21;21-11;21-18 USA;Belgium;1-21;13-21;16-21 Malaysia;Japan;0-4 Malaysia;USA;1-1 Malaysia;Belgium;2-11 Japan;Belgium;2-3 Japan;USA;4-2 USA;Belgium;4-5 |
my question is how do write the code so that this data will be stored into two different output files name as badminton.txt and soccer.txt just like the example below?
Output filename: Soccer.txt
and same goes to output filename : Badminton.txt
1 Team 1 2 Malaysia 3 Malaysia 4 Malaysia 5 Japan 6 Japan 7 USA 8 Team 2 Japan USA Belgium Belgium USA Belgium Score 0-4 1-1 2-11 2-3 4-2 4-5Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started