CS计算机代考程序代写 Java import java.io.FileReader;

import java.io.FileReader;
import java.io.BufferedReader;
import java.io.IOException;

public class ReadCSV {
public static void main(String[] args) {

try (BufferedReader br =
new BufferedReader(new FileReader(“recipe.csv”))) {
String text;
int count = 0;

while ((text = br.readLine()) != null) {
if (count == 0) {
count++;
continue;
}

String cells[] = text.split(“,”);

String ingredient = cells[0];
double cost = Double.parseDouble(cells[1]);
int quantity = Integer.parseInt(cells[2]);

System.out.format(“%d %s will cost $%.2f\n”, quantity,
ingredient, cost*quantity);
count++;
}
} catch (Exception e) {
e.printStackTrace();
}

}
}