Q: Please name your file as YourLastNameQZ1.java, e.g., vatturiQZ1.java
Input file: qz1Data.csv
Assumption: There are less than 10,000 records in qz1Data.csv
The data file “qz1Data.csv” is a csv (comma separate value) file and contains 3 fields, separated by commas, on each line:
Property ID, County, Price
Listed below are some sample lines:
119736,CLAY COUNTY,792148.9
448094,CLAY COUNTY,1438163.57
206893,CLAY COUNTY,192476.78
333743,CLAY COUNTY,86854.48
172534,CLAY COUNTY,246144.49
You are required to:
1. Design and develop a data class for the input data record. Please name the data class as MyRecord. (This class does not need to a public class.) 2. Develop a Java program to read input data records into an object array of MyReccord and display the CPU time used to for such a reading operation.
Hint: This program generates 1 line of output.
………………………………………………………………………………………………………………………..
Ans:
import java.io.*;
import java.util.*;
public class vatturiQZ1
{
public static void main(String []args)
{
int count=0;
long CPU_time=0, end_time=0, start_time=0;
String csvRecord;
ArrayList <MyRecord> recs = new ArrayList <MyRecord> ();
try {
BufferedReader brFile = new BufferedReader(new FileReader(“qz1Data.csv”));
start_time = System.currentTimeMillis();
while ((csvRecord = brFile.readLine()) != null)
{
recs.add(new MyRecord(csvRecord));
}
end_time = System.currentTimeMillis();
brFile.close();
}
catch (Exception e) { e.printStackTrace(); };
CPU_time = end_time – start_time;
System.out.print(“CPU time used: ” + CPU_time + ” ms”);
}
}
class MyRecord
{
String propertyID;
String county;
double price;
public MyRecord(String myrec)
{
StringTokenizer st = new StringTokenizer(myrec, “,”);
propertyID = st.nextToken(“,”);
county = st.nextToken(“,”);
price = Double.valueOf(st.nextToken(“,”));
}
public String getPropertyID() { return propertyID; }
public String getCounty() { return county; }
public double getPrice() { return price; }
………………………………………………………………………………………………………………
professor’s comment:
You did not know your name?!?!?! Your solution has nothing to do with the requirement.
Only 1 student who has completed Quiz#1 with a correct answer.
The question requires you to use an array.
Please redo and resubmit your solution by the new deadline.
 
Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount! Use Discount Code “Newclient” for a 15% Discount!NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.

The post correct-the-java-program appeared first on Essay Fount.


What Students Are Saying About Us

.......... Customer ID: 12*** | Rating: ⭐⭐⭐⭐⭐
"Honestly, I was afraid to send my paper to you, but you proved you are a trustworthy service. My essay was done in less than a day, and I received a brilliant piece. I didn’t even believe it was my essay at first 🙂 Great job, thank you!"

.......... Customer ID: 11***| Rating: ⭐⭐⭐⭐⭐
"This company is the best there is. They saved me so many times, I cannot even keep count. Now I recommend it to all my friends, and none of them have complained about it. The writers here are excellent."


"Order a custom Paper on Similar Assignment at essayfount.com! No Plagiarism! Enjoy 20% Discount!"