Question

In: Mechanical Engineering

2. Write a program which reads in the text file generated in part one and writes...

2. Write a program which reads in the text file generated in part one and writes out the same data as a comma-separated values (CSV) file for further processing.

The file should have a header line which identifies which column contains which values and should look something like this:
Time, Potentiometer, Temperature, Light, Switch0, Switch1, Switch2, Switch3
That header line should be followed by detail lines containing the measurements and should look something like this (matching the above Arduino output):
0,1,1,1,1,0.50,0.14,0.90 40,1,1,1,1,0.65,0.20,0.89

Store the data in an appropriate struct.

Solutions

Expert Solution

Program to read text file generated in part one and write out the data as Comma Seperated Values:
type,ident,lat,long,y_proj,x_proj,new_seg,display,color,altitude,depth,temp,time,model,filename,ltime
TRACK,ACTIVE LOG,40.78966141,-77.85948515,4627251.76270444,1779451.21349775,True,False,255,358.228393554688,0,0,2008/06/11-14:08:30,eTrex Venture, ,2008/06/11 09:08:30
TRACK,ACTIVE LOG,40.78963995,-77.85954952,4627248.40489401,1779446.18060893,False,False,255,358.228393554688,0,0,2008/06/11-14:09:43,eTrex Venture, ,2008/06/11 09:09:43
TRACK,ACTIVE LOG,40.78961849,-77.85957098,4627245.69008772,1779444.78476531,False,False,255,357.747802734375,0,0,2008/06/11-14:09:44,eTrex Venture, ,2008/06/11 09:09:44
TRACK,ACTIVE LOG,40.78953266,-77.85965681,4627234.83213242,1779439.20202706,False,False,255,353.421875,0,0,2008/06/11-14:10:18,eTrex Venture, ,2008/06/11 09:10:18
TRACK,ACTIVE LOG,40.78957558,-77.85972118,4627238.65402635,1779432.89982442,False,False,255,356.786376953125,0,0,2008/06/11-14:11:57,eTrex Venture, ,2008/06/11 09:11:57
TRACK,ACTIVE LOG,40.78968287,-77.85976410,4627249.97592111,1779427.14663093,False,False,255,354.383178710938,0,0,2008/06/11-14:12:18,eTrex Venture, ,2008/06/11 09:12:18
TRACK,ACTIVE LOG,40.78979015,-77.85961390,4627264.19055204,1779437.76243578,False,False,255,351.499145507813,0,0,2008/06/11-14:12:50,eTrex Venture, ,2008/06/11 09:12:50
TRACK,ACTIVE LOG,40.78983307,-77.85961390,4627268.97701256,1779436.91622722,False,False,255,357.747802734375,0,0,2008/06/11-14:14:24,eTrex Venture, ,2008/06/11 09:14:24
TRACK,ACTIVE LOG,40.78987598,-77.85950661,4627275.37008691,1779445.16407113,False,False,255,360.151123046875,0,0,2008/06/11-14:14:35,eTrex Venture, ,2008/06/11 09:14:35
TRACK,ACTIVE LOG,40.78996181,-77.85946369,4627285.58504744,1779447.10971155,False,False,255,357.747802734375,0,0,2008/06/11-14:14:47,eTrex Venture, ,2008/06/11 09:14:47
TRACK,ACTIVE LOG,40.79011202,-77.85957098,4627300.72880585,1779435.05431356,False,False,255,350.057250976563,0,0,2008/06/11-14:15:10,eTrex Venture, ,2008/06/11 09:15:10
TRACK,ACTIVE LOG,40.79015493,-77.85954952,4627305.83572582,1779436.02722689,False,False,255,353.902587890625,0,0,2008/06/11-14:15:45,eTrex Venture, ,2008/06/11 09:15:45
TRACK,ACTIVE LOG,40.79015493,-77.85950661,4627306.47872977,1779439.66424433,False,False,255,357.747802734375,0,0,2008/06/11-14:16:21,eTrex Venture, ,2008/06/11 09:16:21
TRACK,ACTIVE LOG,40.79021931,-77.85929203,4627316.87391712,1779456.58252508,False,False,255,352.460571289063,0,0,2008/06/11-14:16:47,eTrex Venture, ,2008/06/11 09:16:47
TRACK,ACTIVE LOG,40.79024076,-77.85927057,4627319.58761408,1779457.97853529,False,False,255,352.941162109375,0,0,2008/06/11-14:16:48,eTrex Venture, ,2008/06/11 09:16:48
TRACK,ACTIVE LOG,40.79036951,-77.85907745,4627336.83984196,1779471.8086655,False,False,255,352.460571289063,0,0,2008/06/11-14:17:17,eTrex Venture, ,2008/06/11 09:17:17
TRACK,ACTIVE LOG,40.79036951,-77.85909891,4627336.51825492,1779469.98973889,False,False,255,343.327880859375,0,0,2008/06/11-14:18:13,eTrex Venture, ,2008/06/11 09:18:13
TRACK,ACTIVE LOG,40.79047680,-77.85899162,4627350.09107746,1779476.96808367,False,False,255,342.847290039063,0,0,2008/06/11-14:18:32,eTrex Venture, ,2008/06/11 09:18:32
TRACK,ACTIVE LOG,40.79064846,-77.85920620,4627366.01910842,1779455.39595965,False,False,255,346.212036132813,0,0,2008/06/11-14:18:59,eTrex Venture, ,2008/06/11 09:18:59
TRACK,ACTIVE LOG,40.79069138,-77.85922766,4627370.48398108,1779452.73079612,False,False,255,345.731323242188,0,0,2008/06/11-14:19:42,eTrex Venture, ,2008/06/11 09:19:42
TRACK,ACTIVE LOG,40.79079866,-77.85939932,4627379.87553205,1779436.06595964,False,False,255,344.77001953125,0,0,2008/06/11-14:20:14,eTrex Venture, ,2008/06/11 09:20:14
TRACK,ACTIVE LOG,40.79101324,-77.85967827,4627399.62551803,1779408.19190874,False,False,255,346.692626953125,0,0,2008/06/11-14:20:42,eTrex Venture, ,2008/06/11 09:20:42
TRACK,ACTIVE LOG,40.79101324,-77.85965681,4627399.9470929,1779410.01081578,False,False,255,346.692626953125,0,0,2008/06/11-14:21:16,eTrex Venture, ,2008/06/11 09:21:16
TRACK,ACTIVE LOG,40.79118490,-77.85987139,4627415.87524858,1779388.43897893,False,False,255,347.173217773438,0,0,2008/06/11-14:21:47,eTrex Venture, ,2008/06/11 09:21:47
TRACK,ACTIVE LOG,40.79133511,-77.86006451,4627429.7329001,1779369.10903715,False,False,255,347.653930664063,0,0,2008/06/11-14:22:05,eTrex Venture, ,2008/06/11 09:22:05
TRACK,ACTIVE LOG,40.79161406,-77.85987139,4627463.7353061,1779379.97757661,False,False,255,344.77001953125,0,0,2008/06/11-14:22:33,eTrex Venture, ,2008/06/11 09:22:33
TRACK,ACTIVE LOG,40.79172134,-77.85991430,4627475.0562103,1779374.22548807,False,False,255,343.80859375,0,0,2008/06/11-14:23:03,eTrex Venture, ,2008/06/11 09:23:03
TRACK,ACTIVE LOG,40.79172134,-77.85991430,4627475.0562103,1779374.22548807,False,False,255,340.924682617188,0,0,2008/06/11-14:23:45,eTrex Venture, ,2008/06/11 09:23:45
TRACK,ACTIVE LOG,40.79167843,-77.86004305,4627468.34161271,1779364.15903736,False,False,255,344.289428710938,0,0,2008/06/11-14:24:01,eTrex Venture, ,2008/06/11 09:24:01
TRACK,ACTIVE LOG,40.79159260,-77.86015034,4627457.16214745,1779356.75766578,False,False,255,345.731323242188,0,0,2008/06/11-14:24:17,eTrex Venture, ,2008/06/11 09:24:17
TRACK,ACTIVE LOG,40.79154968,-77.86036491,4627449.16052359,1779339.41750767,False,False,255,348.134643554688,0,0,2008/06/11-14:24:31,eTrex Venture, ,2008/06/11 09:24:31
TRACK,ACTIVE LOG,40.79169989,-77.86055803,4627463.01825969,1779320.08774845,False,False,255,349.095825195313,0,0,2008/06/11-14:24:48,eTrex Venture, ,2008/06/11 09:24:48
TRACK,ACTIVE LOG,40.79185009,-77.86075115,4627476.87491346,1779300.75825936,False,False,255,351.018432617188,0,0,2008/06/11-14:25:03,eTrex Venture, ,2008/06/11 09:25:03
TRACK,ACTIVE LOG,40.79191446,-77.86081553,4627483.08881601,1779294.03255604,False,False,255,351.979858398438,0,0,2008/06/11-14:25:26,eTrex Venture, ,2008/06/11 09:25:26
TRACK,ACTIVE LOG,40.79189301,-77.86083698,4627480.37530763,1779292.63741228,False,False,255,352.941162109375,0,0,2008/06/11-14:26:20,eTrex Venture, ,2008/06/11 09:26:20
TRACK,ACTIVE LOG,40.79169989,-77.86060095,4627462.37514912,1779316.4499767,False,False,255,350.537841796875,0,0,2008/06/11-14:26:43,eTrex Venture, ,2008/06/11 09:26:43
TRACK,ACTIVE LOG,40.79161406,-77.86045074,4627455.0541118,1779330.87351158,False,False,255,350.057250976563,0,0,2008/06/11-14:27:04,eTrex Venture, ,2008/06/11 09:27:04
TRACK,ACTIVE LOG,40.79159260,-77.86045074,4627452.66088714,1779331.29660567,False,False,255,350.057250976563,0,0,2008/06/11-14:27:06,eTrex Venture, ,2008/06/11 09:27:06
TRACK,ACTIVE LOG,40.79135656,-77.86012888,4627431.16046351,1779363.23028903,False,False,255,347.173217773438,0,0,2008/06/11-14:27:32,eTrex Venture, ,2008/06/11 09:27:32
TRACK,ACTIVE LOG,40.79112053,-77.85982847,4627409.33982599,1779393.34591179,False,False,255,346.212036132813,0,0,2008/06/11-14:27:57,eTrex Venture, ,2008/06/11 09:27:57
TRACK,ACTIVE LOG,40.79086304,-77.85950661,4627385.44746832,1779425.70289218,False,False,255,345.250610351563,0,0,2008/06/11-14:28:24,eTrex Venture, ,2008/06/11 09:28:24
TRACK,ACTIVE LOG,40.79075575,-77.85935640,4627375.73335314,1779440.5498292,False,False,255,345.731323242188,0,0,2008/06/11-14:28:44,eTrex Venture, ,2008/06/11 09:28:44
TRACK,ACTIVE LOG,40.79051971,-77.85905600,4627353.91165485,1779470.6652577,False,False,255,346.212036132813,0,0,2008/06/11-14:29:10,eTrex Venture, ,2008/06/11 09:29:10
TRACK,ACTIVE LOG,40.79045534,-77.85894871,4627348.34087781,1779481.02821242,False,False,255,348.134643554688,0,0,2008/06/11-14:29:35,eTrex Venture, ,2008/06/11 09:29:35
TRACK,ACTIVE LOG,40.79045534,-77.85894871,4627348.34087781,1779481.02821242,False,False,255,352.941162109375,0,0,2008/06/11-14:29:53,eTrex Venture, ,2008/06/11 09:29:53
TRACK,ACTIVE LOG,40.79032660,-77.85877705,4627336.55616698,1779498.11631935,False,False,255,349.095825195313,0,0,2008/06/11-14:30:29,eTrex Venture, ,2008/06/11 09:30:29
TRACK,ACTIVE LOG,40.79017639,-77.85858393,4627322.69873444,1779517.44674923,False,False,255,350.057250976563,0,0,2008/06/11-14:30:55,eTrex Venture, ,2008/06/11 09:30:55
TRACK,ACTIVE LOG,40.79019785,-77.85862684,4627324.44891961,1779513.3865948,False,False,255,352.941162109375,0,0,2008/06/11-14:31:34,eTrex Venture, ,2008/06/11 09:31:34
TRACK,ACTIVE LOG,40.79034805,-77.85881996,4627338.3052446,1779494.05637582,False,False,255,351.979858398438,0,0,2008/06/11-14:31:55,eTrex Venture, ,2008/06/11 09:31:55
TRACK,ACTIVE LOG,40.79024076,-77.85903454,4627323.12460431,1779477.98422633,False,False,255,350.537841796875,0,0,2008/06/11-14:32:17,eTrex Venture, ,2008/06/11 09:32:17
TRACK,ACTIVE LOG,40.79021931,-77.85905600,4627320.41090176,1779476.58822285,False,False,255,350.057250976563,0,0,2008/06/11-14:32:25,eTrex Venture, ,2008/06/11 09:32:25
TRACK,ACTIVE LOG,40.79024076,-77.85905600,4627322.80301647,1779476.16529588,False,False,255,351.499145507813,0,0,2008/06/11-14:32:54,eTrex Venture, ,2008/06/11 09:32:54
TRACK,ACTIVE LOG,40.79021931,-77.85905600,4627320.41090176,1779476.58822285,False,False,255,350.537841796875,0,0,2008/06/11-14:33:14,eTrex Venture, ,2008/06/11 09:33:14
TRACK,ACTIVE LOG,40.79015493,-77.85914183,4627311.94501541,1779470.5827101,False,False,255,351.979858398438,0,0,2008/06/11-14:33:33,eTrex Venture, ,2008/06/11 09:33:33
TRACK,ACTIVE LOG,40.79002619,-77.85931349,4627295.01549676,1779458.57124095,False,False,255,351.979858398438,0,0,2008/06/11-14:33:54,eTrex Venture, ,2008/06/11 09:33:54
TRACK,ACTIVE LOG,40.78987598,-77.85952806,4627275.04865997,1779443.34597797,False,False,255,353.902587890625,0,0,2008/06/11-14:34:20,eTrex Venture, ,2008/06/11 09:34:20
TRACK,ACTIVE LOG,40.78966141,-77.85972118,4627248.22583359,1779431.2076234,False,False,255,352.460571289063,0,0,2008/06/11-14:34:39,eTrex Venture, ,2008/06/11 09:34:39
TRACK,ACTIVE LOG,40.78959703,-77.85957098,4627243.29685689,1779445.2078692,False,False,255,352.941162109375,0,0,2008/06/11-14:35:00,eTrex Venture, ,2008/06/11 09:35:00
TRACK,ACTIVE LOG,40.78966141,-77.85950661,4627251.44112745,1779449.39455063,False,False,255,352.941162109375,0,0,2008/06/11-14:35:40,eTrex Venture, ,2008/06/11 09:35:40

Related Solutions

Write a C program that Reads a text file(any file)  and writes it to a binary file....
Write a C program that Reads a text file(any file)  and writes it to a binary file. Reads the binary file and converts it to a text file.
Write a program that reads a file called document.txt which is a text file containing an...
Write a program that reads a file called document.txt which is a text file containing an excerpt from a novel. Your program should print out every word in the file that contains a capital letter on a new line to the stdout. For example: assuming document.txt contains the text C++
Write a simple text-formating.cpp file that reads (asks for then reads) a text file and produces...
Write a simple text-formating.cpp file that reads (asks for then reads) a text file and produces another text file in Which blank lines are removed, multiple blanks are replaced with a single blank, and no lines are longer than some given length (let say 80). Put as many words as possible on the same line (as close as possible to 80 characters). You will have to break some lines of the given file, but do not break any words or...
You are given a text file containing a short text. Write a program that 1. Reads...
You are given a text file containing a short text. Write a program that 1. Reads a given text file : shortText.txt 2. Display the text as it is 3. Prints the number of lines 4. Prints the occurences of each letter that appears in the text. [uppercase and lowercase letter is treated the same]. 5. Prints the total number of special characters appear in the text. 6. Thedisplayofstep3,4and5aboveshouldbesaveinanoutputfile:occurencesText.txt write it in C++ programing Language
In JAVA Write a brief program that writes your name to a file in text format...
In JAVA Write a brief program that writes your name to a file in text format and then reads it back. Use the PrintWriter and Scanner classes.
Python program: Write a program that reads a text file named test_scores.txt to read the name...
Python program: Write a program that reads a text file named test_scores.txt to read the name of the student and his/her scores for 3 tests. The program should display class average for first test (average of scores of test 1) and average (average of 3 tests) for each student. Expected Output: ['John', '25', '26', '27'] ['Michael', '24', '28', '29'] ['Adelle', '23', '24', '20'] [['John', '25', '26', '27'], ['Michael', '24', '28', '29'], ['Adelle', '23', '24', '20']] Class average for test 1...
Could you write a c- program that reads a text file into a linked list of...
Could you write a c- program that reads a text file into a linked list of characters and then manipulate the linked list by making the following replacements 1. In paragraph 1 Replace all “c” with “s” if followed by the characters “e”, “i” or “y”; otherwise 2. In pragraph 2 Replace "We" with v"i" This is the text to be manipulated: Paragraph1 She told us to take the trash out. Why did she do that? I wish she would...
● Write a program that reads words from a text file and displays all the words...
● Write a program that reads words from a text file and displays all the words (duplicates allowed) in ascending alphabetical order. The words must start with a letter. Must use ArrayList. MY CODE IS INCORRECT PLEASE HELP THE TEXT FILE CONTAINS THESE WORDS IN THIS FORMAT: drunk topography microwave accession impressionist cascade payout schooner relationship reprint drunk impressionist schooner THE WORDS MUST BE PRINTED ON THE ECLIPSE CONSOLE BUT PRINTED OUT ON A TEXT FILE IN ALPHABETICAL ASCENDING ORDER...
Could you write a c- program that reads a text file into a linked list of...
Could you write a c- program that reads a text file into a linked list of characters and then manipulate the linked list by making the following replacements 1. Replace all “c” with “s” if followed by the characters “e”, “i” or “y”; otherwise 2. Replace "sh" with ph This is the text to be manipulated: Paragraph1 She told us to take the trash out. Why did she do that? I wish she would not do that Paragraph 2 We...
Design and write a python program that reads a file of text and stores each unique...
Design and write a python program that reads a file of text and stores each unique word in some node of binary search tree while maintaining a count of the number appearance of that word. The word is stored only one time; if it appears more than once, the count is increased. The program then prints out 1) the number of distinct words stored un the tree, Function name: nword 2) the longest word in the input, function name: longest...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT