Academic coaching, editing, and research guidance for university students.

Lab4 part 1 and 2, computer science assignment help

1 min read
  

LAB work.
lab_4_part_i.docx

lab_4_part_ii.docx

input._txt.docx

output._txt.docx

doubles._txt.docx

Unformatted Attachment Preview

Lab 4 Part I
You are given a text file “input.txt”containing in each line the name of a
capital city followed by the name of the corresponding country
separated by tabulation “t”.
Write a program that reads each line in “input.txt” and appends only the
name of the capital city in “output.txt”.
Note: “output.txt”already contains a line of text. You should add to it
and do not overwrite it.
Example:
input.txt:
Paris France
London
UK
Lisbon
Portugal
Output.txt:
Paris
London
Lisbon
Lab 4 Part II
Write a program that reads a text file“doubles.txt” containing a double in each
line and outputs the sum of all the doubles in all the lines of the file as output.
Example:
Doubles.txt:
1.0
2.2
3.6
=> Output to the console should be 6.8
Paris
France
London UK
Lisbon Portugal
List of Cities:
6.2
3.2
4.1
2.5
…
Purchase answer to see full
attachment

Academic integrity note

Use this educational resource to build your understanding. Follow your institution’s rules and cite sources appropriately.

Want feedback on your own work?

Request Academic Support

Leave a Reply

Your email address will not be published. Required fields are marked *