subject
Computers and Technology, 31.01.2022 14:00 mads000

Overview Reading and writing to files is a constantly used way of transferring data in many different kinds of programs. Websites, such as news sites, and various phone applications are both excellent examples of this widespread use. Phone apps in particular will always read and write to files, since the alternative of writing to databases would be too large for their purposes. Another example is an application you use for daily tasks such as writing in a Microsoft Word file and uploading it as a Brightspace submission (to later be downloaded by your instructor). All of these demonstrate the importance and prevalence of reading and writing to a file as a method of information sharing.

Later in this course, you will need to be able to share information between C++ and Python as part of completing a larger task. Practicing reading and writing to a file this week will help prepare you for that later work. Although you will eventually have a broader understanding of working with files in multiple different programming languages, for this assignment your work should only be completed in C++.

Prompt
In this assignment, you are presented with a text document that includes six cities and their average yearly temperature in Fahrenheit. Your goal is to read that data, convert it to Celsius using the provided formula, and then write that new data to its own file.

To begin your work, open Visual Studio and create a new C++ project. Save the provided FahrenheitTemperature. txt document in a location where you will easily be able to access it while you work in Visual Studio. For this assignment, you will be submitting only your C++ (.cpp) file. You do not need to submit the final converted data; the C++ code you create just needs to be able to generate that file.

FahrenheitTemperature. txt document :
Toronto 47
Lima 66
Istanbul 57
Lagos 81
Shanghai 61
Sydney 64

Specifically, you must address the following rubric criteria:

Develop code to read data from a text file. Your work should be completed using C++. Read the provided document, FahrenheitTemperature. txt, which includes data on the average yearly temperature for six different cities in degrees Fahrenheit. Note that a space separates each city from its temperature. Assume the city’s name does not include any spaces or special characters (the name should consist of only a single word). Also assume the provided temperature is presented as an integer. Consider the following steps as you work:
Open the provided file so it is ready to be read. Remember the file is named FahrenheitTemperature. txt. Watch out for the class you use, and make sure it is for reading a file and not writing to a file.
Read data from the provided file. Remember, to read this file you will need to declare a variable. Begin by reading the first value and putting it in the first variable. Then read the next value and put it in the second variable.
Once this is complete, be sure to close the file. This releases the file so it can be used again.
Develop code to write data to a text file. Your work should be completed using C++. Title the new document you are creating CelsiusTemperature. txt. The name of the output file needs to be different from the name of the input file so you do not overwrite and erase the input file. Consider the following steps as you work:
Declare a variable to point to the file that will be written to. Watch out for the class you use, and make sure it is for writing to a file and not reading a file.
Create the code instructions for writing data to the new output file. In this new file, include space for both the name of the city and the temperature in Celsius for each city included in the original input file. You will need to complete the Fahrenheit-to-Celsius conversion calculation before you write to the new file. Use the following formula to make this conversion. (attached) Note that °F represents the temperature in degrees Fahrenheit while °C represents the temperature in degrees Celsius. Open parenthesis degrees F minus 32 close parenthesis times 5 over 9 equals degrees C.
Close the file once you are done writing to it. If you attempt to look at the results in the file before completing this step, your file may appear empty.


Overview

Reading and writing to files is a constantly used way of transferring data in many diffe

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:30
Imagine that you have a friend who is starting a small business and is interested in using social media to spread the word. he is not certain that it is a good move, and has come to you for . would you advise him to use social media to advertise his business? why or why not? support you answer with information from the text.
Answers: 1
question
Computers and Technology, 22.06.2019 11:00
When building customer relationships through email what should you not do? question 2 options: utilize proper grammar, spelling, and punctuation type in all capital letters use hyperlinks rather than attachments respond to all emails within 24 hours
Answers: 1
question
Computers and Technology, 22.06.2019 18:30
Word vocabulary words: print, proofread, status line, graphics, font effects, left margin, justification, line spacing, copy/paste, data. review words: font point, bold, save, center, error. fill in the correct word for the definition and then transfer the letters to the appropriate spot by number. some numbers will be found multiple times. you will end up with a quotation about…… what else? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 k 16 17 18 19 20 21 22 23 24 25 8 27 28 29 w 31 32 k 34 35 36 w h 39 40 41 42 8 44 45 46 47 48 49 50 51 52 53 54 55 .1. a software function that records keystrokes on a disk or drive so information can be 5 4 52 9 later retrieved. p n 2. to produce a paper copy of information. 10 7 12u n 3. a display that shows the location of the cursor, pages, etc. 45 46 18 27 36 20 42p4. pictures or images, located in clip art or other files. 6 24 44 28 34 49 555. any mis-stroke of a key. 47 41 48 2 10 n6. allows major changes to the font such as shadow, emboss, etc. 21 25 46 35 23 21 29 14 22 17 n7. a feature that centers lines of text horizontally. 49 53 46 9 51 p8. size of the font 31 16 22 b l 9. a feature that prints designated text darker than the rest to add emphasis. 32 3 . p10. to compare copy on a display screen or printout to the original 24 39 25 23 54 9 50 3 and correct errors. j un 11. a feature that allows text to be aligned at the left 11 12 7 21 16 49 40 46 34 2 and right margins. leftn 12. amount of blank space on the left side of the paper. 8 18 41 6 34 linen 13. number of blank lines between lines of text. 17 4 49 13 1914. any information inputted into the computer. 3 4 46 44 p /p15. feature that duplicates text from one location and places it in another.
Answers: 2
question
Computers and Technology, 22.06.2019 20:00
What side length would you specify if you were required to create a regular hexagonal plate that was composed of 33 cm(squared) of sheet metal? dimension the side length to 0.1 cm
Answers: 2
You know the right answer?
Overview Reading and writing to files is a constantly used way of transferring data in many differ...
Questions
question
History, 16.09.2019 01:10
question
History, 16.09.2019 01:20
Questions on the website: 13722360