You've been hired by Planet Pals to write a C++ console application that reads and converts planet data. Create text file PlanetsIn.txt and paste this data into it: Planet Diameter (miles) Length of Day (hours) Mercury 3032 4222.6 Venus 7521 2802.0 Earth 7926 24.0 Moon 2159 708.7 Mars 4221 24.7 Jupiter 88846 9.9 Saturn 74897 10.7 Uranus 31763 17.2 Neptune 30775 16.1 Pluto 1485 153.3 Place the file in a folder where your development tool can locate it. Read the file by scanning past the header row. Print a file-reading message, and the column headers. Each detail row in the file contains three tokens (planet, diameter, length of day) so you may do one token per read. For each detail row: Read each token from the file. Convert the diameter from miles to feet. Convert the length of day from hours to minutes. Print both the input and corresponding output tokens. Format all real numbers to one decimal place. Continue reading until the end-of-file. Print the number of lines read.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question

You've been hired by Planet Pals to write a C++ console application that reads and converts planet data.  Create text file PlanetsIn.txt and paste this data into it:

Planet      Diameter (miles)  Length of Day (hours)

Mercury          3032             4222.6

Venus            7521             2802.0

Earth            7926               24.0

Moon             2159              708.7

Mars             4221               24.7

Jupiter         88846                9.9

Saturn          74897               10.7

Uranus          31763               17.2

Neptune         30775               16.1

Pluto            1485              153.3

 

Place the file in a folder where your development tool can locate it.  Read the file by scanning past the header row.  Print a file-reading message, and the column headers.  Each detail row in the file contains three tokens (planet, diameter, length of day) so you may do one token per read. For each detail row:

  • Read each token from the file.
  • Convert the diameter from miles to feet.
  • Convert the length of day from hours to minutes.
  • Print both the input and corresponding output tokens.

Format all real numbers to one decimal place.  Continue reading until the end-of-file.  Print the number of lines read. 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Study of Characters
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning