Question: I was assigned a Java code assignment to use a CSV file (second photo below) to create a table like this: I currently have a

I was assigned a Java code assignment to use a CSV file (second photo below) to create a table like this:

I was assigned a Java code assignment to use a CSV file

(second photo below) to create a table like this: I currently have

I currently have a code that looks like this:

a code that looks like this: And it produces a table like

And it produces a table like this:

I need help understanding how to make the data print in an actual table format instead of one long line

this: I need help understanding how to make the data print in

AK Enter a date (YYYY-MM-DD): 2021-02-12 State Cases Hosp Deaths 148 3 2 AL 1097 242 159 AR 565 23 13 AS AZ 2426 141 172 CA 10059 0 546 2091 48 9 838 27 WI WV WY 1102 467 107 55 0 2 11 13 date state death deathConfirmed deathlncrease deathProbable hospitalized hospitalized Cumulative hospitalized Currently hospitalizedIncre 2021-02-21 AK 289 0 1243 1243 34 2021-02-21 AL 9592 7526 2 2066 44767 44767 867 2021-02-21 AR 5357 4306 9 1051 14540 14540 577 2021-02-21 AS 0 0 2021-02-21 AZ 15505 13694 25 1811 56946 56946 1598 2021-02-21 CA 49105 280 7313 2021-02-21 CO 5892 5164 5 728 23169 23169 440 2021-02-21 CT 7523 6166 0 1357 12257 12257 535 2021-02-21 DC 995 1 196 2021-02-21 DE 1367 1236 1 131 175 2021-02-21 FL 30434 95 78946 78946 4160 2021-02-21 GA 16744 14633 2 2111 54753 54753 2778 2021-02-21 GU 130 0 5 2021-02-21 HI 431 431 1 2182 2182 42 2021-02-21 IA 5336 0 229 2021-02-21 ID 1826 1607 0 219 6983 6983 142 22466 20269 40 2197 1468 2021-02-21 IL 2021-02-21 IN 12372 11947 36 425 42445 42445 870 2021-02-21 KS 4614 0 9071 9071 290 2021-02-21 KY 4447 4033 21 414 18601 18601 902 2021-02-21 LA 9466 8798 26 668 756 2021-02-21 MA 15826 15508 47 318 19176 19176 927 2021-02-21 MD 7715 7533 18 182 34439 34439 973 2021-02-21 ME 658 643 0 15 1506 1506 75 package Assignments; 3+ import java.io.File;. 7 public class Assignment8 { 8 public static String getDate() { System.out.print("Enterrasdatem iinyi_MM-DD): "); String d = in.nextLine(); in.close(); return d; } 10 11 14 15 12 16 17 18 public static void getData(String dtable [] [], String t) throws FileNotFoundException { String line; Scanner in = new Scanner(new File("all-states-history-new.csv")); int i = 0; while (in.hasNext()) { line in.nextLine(); if (getColumn(line, 1).equals(t)) { dtable[i] [O]=getColumn(line, 2); //State dtable[i] [1]=getColumn(line, 20); //Cases dtable[i] [2]=getColumn(line, 7); //Hosp. dtable[i][3]=getColumn(line,3); //Deaths i++; } } } 31 32 33 35 34 public static String getColumn(String row, int col) { String[] cols; cols = row.split(","); return cols [col-1]; } 38 so 39 40 41 1 42 14 public static void printTable(String t[][]) { for (int x=0; x Assignments [Java Application] /Library/Java/JavaVirtual Machines/jdk-15.0.2.jdk/Contents/Home/bin/java (Mar 9, 2021, 9:40:47 PM 9:40:54 PM) Enter a date (YYYY-MM-DD): 2021-02-12 State Cases Hosp Deaths AK 54282 1230 282 AL 478667 44148 9180 AR 311608 14278 5212 AS

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!