Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this Final program you are going to use several concepts you learned in CSC 101 class, especially operations on or using FILES , LOOPS

In this Final program you are going to use several concepts you learned in CSC 101 class, especially operations on or using FILES , LOOPS and FUNCTIONS.

You need to implement C++ code that will read data from a file and process it as outlined below and write the processed data to an output file. You can refer to the file input.txt for how the data is made available to you and output.txt for how to write out the processed data. Your code will be tested using an input file with different values.

The example input file shows one temperature value along with one word (Celsius or Fahrenheit) per line denoting its scale. The last line has a temperature value and the word Last. You need to ignore the temperature on this line since it doesnt say whether it is Celsius or Fahrenheit).

First determine how many lines are in the file. Your loop(s) will run this many times.

Then read each line of the input file (in a loop) and if the word you read is Celsius then convert the temperature to Fahrenheit. If the word is Fahrenheit then convert the temperature to Celsius.

Write two functions called convertFtoC and convertCtoF for performing the conversions. Pass input(s) by value and return the converted value using a return statement.

As you read each line from the input file, call the appropriate function to convert the value and write the old value, its scale, new value and its scale to the output file.

Close the input and output files after the loop.

Maximum points 100. For 30 bonus points use arrays.

Hint: You may have to open and close the input file more than once.

image text in transcribedimage text in transcribed

Samplelnput.txt Garrett Crawford Dashboar Course 50 Celsius 5 Celsius 8 Celsius 50 Fahrenheit 80 Fahrenheit 10 Last Calendan SampleOutput.txt Garrett Crawford Dashboar Course 50 Celsius 122 Fahrenheit 5 Celsius 41 Fahrenheit 8 Celsius 46.4 Fahrenheit 50 Fahrenheit 10 Celsius 80 Fahrenheit 80 Celsius Calendar

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Application Development And Design

Authors: Michael V. Mannino

1st Edition

0072463678, 978-0072463675

More Books

Students also viewed these Databases questions