ciarrap552
15.04.2020 •
Computers and Technology
The program is run using the following command: java programName #row #cols < students.txt #rows and #cols are integers indicating the number of rows and columns of seats in the classroom. students.txt is a text file holding the student names.
Solved
Show answers
More tips
- C Computers and Internet Clearing Cache: How to Speed Up Your Browser...
- S Style and Beauty How are artificial nails removed?...
- S Style and Beauty Secrets of Tying a Pareo: 5 Ways...
- F Food and Cooking Everything You Need to Know About Pasta...
- C Computers and Internet How to Choose a Monitor?...
- H Horoscopes, Magic, Divination Where Did Tarot Cards Come From?...
- S Style and Beauty How to Make Your Lips Fuller? Ideas and Tips for Beautiful Lips...
- C Computers and Internet How to Learn to Type Fast?...
Ответ:
This question is not complete, here's the complete question:
The program is run using the following command:
java programName #row #cols < students.txt
#rows and #cols are integers indicating the number of rows and columns of seats in the
classroom. students.txt is a text file holding the student names.
a) (5 points) Write a code-segment to:
1. Declare a 1-D String array variable, studentLine, that has space to hold all
students in the class in a single line. (Figures 1 and 3)
2. Declare a 2-D String array variable, room, to represent the seats in the classroom
where the number of rows and number of columns are given as command line input.
Explanation:
a) 1 -> String[] studentLine = new String[Integer.parseInt(args[0]) * Integer.parseInt(args[1])];
2 -> String[][] room = new String[Integer.parseInt(args[0])][ Integer.parseInt(args[1])];
b)
public static void fillLine(String[] a){ try { File f=new File("students.txt"); FileReader fr=new FileReader(f); BufferedReader br=new BufferedReader(fr); String l; int index = 0; while((l = br.readLine())!=null) { a[index] = l; index++; } fr.close(); } catch(IOException e) { e.printStackTrace(); } }
Ответ:
uhm what
Explanation:
oooh i was looking for a math question and this showed up sorry
Ответ: