Consider a comma-separated file that contains student names and scores such as the following: Jane Lee,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Consider a comma-separated file that contains student names and scores such as the following: Jane Lee, 180, 98, 97, 198 Aaron X. Schmidt, 37, 42, 49, 54 Frank von Tardy, 2, 3, 10, 7 We can read the file one line at a time and use the indexOf method to get the positions of the commas. The call line.indexOf(",", pos) gives the position of the next comma at or beyond the position pos, or -1 if there is no match. Rearrange the lines below to compute the total score for a student. Assume that each student has at least one score Unused String name = line.substring(0, end); int start = end + 1; score = score.trim(); end = if (end == -1) } { } line.indexOf(",", start); score = line.substring (start, end); else total = total + Integer.parseInt(score); while (end != -1) { String score; Scores.java import java.util.Scanner; public class Scores { public static void calculateScore (String line) { } int total = } 0; System.out.println(name + 11 } Load default template... 11 public static void main (String [] args) { + total); Scanner in = new Scanner (System.in); while (in.hasNextLine()) { calculateScore (in.nextLine()); Unused end if (end } { } else line.. = line.indexOf(",", start); -1) } score = = line.substring(start, end); total = == total + Integer.parseInt(score); while (end != -1) { String score; int end line.indexOf(",", 0); { score = line.substring (start); Scores.java ***** import java.util.Scanner; public class Scores { public static void calculateScore (String line) { } int total = 0; System.out.println(name + } Load default template... public static void main (String [] args) { + total); } Scanner in = new Scanner(System.in); while (in.hasNextLine()) { calculateScore (in.nextLine()); Consider a comma-separated file that contains student names and scores such as the following: Jane Lee, 180, 98, 97, 198 Aaron X. Schmidt, 37, 42, 49, 54 Frank von Tardy, 2, 3, 10, 7 We can read the file one line at a time and use the indexOf method to get the positions of the commas. The call line.indexOf(",", pos) gives the position of the next comma at or beyond the position pos, or -1 if there is no match. Rearrange the lines below to compute the total score for a student. Assume that each student has at least one score Unused String name = line.substring(0, end); int start = end + 1; score = score.trim(); end = if (end == -1) } { } line.indexOf(",", start); score = line.substring (start, end); else total = total + Integer.parseInt(score); while (end != -1) { String score; Scores.java import java.util.Scanner; public class Scores { public static void calculateScore (String line) { } int total = } 0; System.out.println(name + 11 } Load default template... 11 public static void main (String [] args) { + total); Scanner in = new Scanner (System.in); while (in.hasNextLine()) { calculateScore (in.nextLine()); Unused end if (end } { } else line.. = line.indexOf(",", start); -1) } score = = line.substring(start, end); total = == total + Integer.parseInt(score); while (end != -1) { String score; int end line.indexOf(",", 0); { score = line.substring (start); Scores.java ***** import java.util.Scanner; public class Scores { public static void calculateScore (String line) { } int total = 0; System.out.println(name + } Load default template... public static void main (String [] args) { + total); } Scanner in = new Scanner(System.in); while (in.hasNextLine()) { calculateScore (in.nextLine()); Consider a comma-separated file that contains student names and scores such as the following: Jane Lee, 180, 98, 97, 198 Aaron X. Schmidt, 37, 42, 49, 54 Frank von Tardy, 2, 3, 10, 7 We can read the file one line at a time and use the indexOf method to get the positions of the commas. The call line.indexOf(",", pos) gives the position of the next comma at or beyond the position pos, or -1 if there is no match. Rearrange the lines below to compute the total score for a student. Assume that each student has at least one score Unused String name = line.substring(0, end); int start = end + 1; score = score.trim(); end = if (end == -1) } { } line.indexOf(",", start); score = line.substring (start, end); else total = total + Integer.parseInt(score); while (end != -1) { String score; Scores.java import java.util.Scanner; public class Scores { public static void calculateScore (String line) { } int total = } 0; System.out.println(name + 11 } Load default template... 11 public static void main (String [] args) { + total); Scanner in = new Scanner (System.in); while (in.hasNextLine()) { calculateScore (in.nextLine()); Unused end if (end } { } else line.. = line.indexOf(",", start); -1) } score = = line.substring(start, end); total = == total + Integer.parseInt(score); while (end != -1) { String score; int end line.indexOf(",", 0); { score = line.substring (start); Scores.java ***** import java.util.Scanner; public class Scores { public static void calculateScore (String line) { } int total = 0; System.out.println(name + } Load default template... public static void main (String [] args) { + total); } Scanner in = new Scanner(System.in); while (in.hasNextLine()) { calculateScore (in.nextLine()); Consider a comma-separated file that contains student names and scores such as the following: Jane Lee, 180, 98, 97, 198 Aaron X. Schmidt, 37, 42, 49, 54 Frank von Tardy, 2, 3, 10, 7 We can read the file one line at a time and use the indexOf method to get the positions of the commas. The call line.indexOf(",", pos) gives the position of the next comma at or beyond the position pos, or -1 if there is no match. Rearrange the lines below to compute the total score for a student. Assume that each student has at least one score Unused String name = line.substring(0, end); int start = end + 1; score = score.trim(); end = if (end == -1) } { } line.indexOf(",", start); score = line.substring (start, end); else total = total + Integer.parseInt(score); while (end != -1) { String score; Scores.java import java.util.Scanner; public class Scores { public static void calculateScore (String line) { } int total = } 0; System.out.println(name + 11 } Load default template... 11 public static void main (String [] args) { + total); Scanner in = new Scanner (System.in); while (in.hasNextLine()) { calculateScore (in.nextLine()); Unused end if (end } { } else line.. = line.indexOf(",", start); -1) } score = = line.substring(start, end); total = == total + Integer.parseInt(score); while (end != -1) { String score; int end line.indexOf(",", 0); { score = line.substring (start); Scores.java ***** import java.util.Scanner; public class Scores { public static void calculateScore (String line) { } int total = 0; System.out.println(name + } Load default template... public static void main (String [] args) { + total); } Scanner in = new Scanner(System.in); while (in.hasNextLine()) { calculateScore (in.nextLine());
Expert Answer:
Answer rating: 100% (QA)
The above image is the correct arrangement of given lines of code input jane ... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
Businesses use budgets to plan for the future. Thats what you will be doing for this assignment. Rather than budgeting for your current financial situation, I want you to put together a budget for...
-
How are writable CDs implemented?
-
The electric potential in some region of space is given by V(x) = C1+ C2x2, where V is in volts, x is in meters, and C1 and C2 are positive constants. Find the electric field E in this region. In...
-
How would you expect the possibility of differentiating your product to change competition between oligopolists?
-
How do you prevent name clashes when using header files?
-
Brett Dunlop is seeking part-time employment while he attends school. He is considering purchasing technical equipment that will enable him to start a small training services company that will offer...
-
Compare and contrast DDL commands with DML commands. You are requested to submit one example of SQL query for DDL and one for DML
-
Darcelle teaches skiing at the Snow School. Jack runs a ski shop called Up Hill, Down Hill. Their combined bank interest is $1,000. If they get a refund, they would like the money deposited into...
-
A common way of thinking about linked list Node objects is that each Node contains a head value and a pointer containing another list. Write a function to calculate the length of a linked list using...
-
Conduct individual inquiry and research into the Roles and Influences of a current global business(es). Demonstrates evidence of extensive inquiry and research in relation to ONE role and TWO...
-
Provide a brief overview of the primary objectives of compilation, review, and preparation engagements under SSARS. Describe the task objectives that differentiate one SSARS engagement from another....
-
He personally loaned $150,000 to his wife on a demand promissory note without interest, in order to help her purchase some land adjacent to her retailing business which she operated as a sole...
-
Trifold Framework in Healthcare: Primary prevention includes educating and communicating a strong organizational culture that promotes respect and professionalism. Healthcare leaders must develop...
-
in April Pratt corporation made an advanced payment of $14,000 to a local company for advertising that would run during October. It is now October 31 and the advertising has run assuming original...
-
A weight-loss program advertises a person can attain an average weight loss of 4 pounds per week. (a) What is the average rate of change (in pounds per week) for this weight-loss program? (b) If a...
-
Organizations are increasing their use of personality tests to screen job applicants. What are some of the advantages and disadvantages of this approach? What can managers do to avoid some of the...
-
Emily Jackson (Social Security number 765-12-4326) and James Stewart (Social Security number 466-74-9932) are partners in a partnership that owns and operates a barber shop. The partnership's first...
-
Steve Jackson (age 51) is a single taxpayer living at 3215 Pacific Dr., Del Mar, CA 92014. His Social Security number is 465-88-9415. In 2012, Steve's earnings and income tax withholding as the...
-
Jenny earns $34,500 in 2012. Calculate the FICA tax that must be paid by: Jenny: ..............................Soc,Sec. ..................$______________...
-
Which of the following steps in the acquisition of goods and services occurs first? a. Appropriation b. Encumbrance c. Budget d. Expenditure
-
Fixed assets purchased from general fund revenue were received. What account, if any, should have been debited in the general fund? a. None b. Fixed Assets c. Expenditures d. Fund BalanceUnassigned
-
When a governmental units Estimated Revenues Control account is closed out at the end of the fiscal year, the excess of estimated revenues over estimated appropriations is a. Debited to Fund...
Lessons From The Mountain What I Learned From Erin Walton 1st Edition - ISBN: 0758263678 - Free Book
Study smarter with the SolutionInn App