Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment Overview This assignment involves coding and testing of a program based on the Hello World program from the lab 00, and then using the

Assignment Overview This assignment involves coding and testing of a program based on the Hello World program from the lab 00, and then using the Mimr program to hand it in. Mimir provides a series of tests that get run every time you handin. It gives you feedback on how well your program works. When you pass all the tests, you are done! If you can't pass all the tests, turn in what you can and pass as many tests as possible. Always turn something in! You can turn in programs using Mimir as often as you want. Try turning in the Hello World program (or the completed project) during lab so if there is a problem, the TA can help you solve it. During lab you start the project so that if you need help, you are still in lab with the TA available. Complete the project and hand it in again when done. Remember, your best score is what uses for your grade on any project! The basic design of the first programs that you construct in this class consists of a prompt for information, receiving information, processing that information then producing a display of the results. Background The New Horizons spacecraft, launched January 19th 2006, is the first earth spacecraft to have made contact with the planet Pluto. On January 1st, 2019 it is schedule to make contact with the first Kuiper belt object KBO-2014-KU69. The NASA update page (http://pluto.jhuapl.edu/Mission/Where-is-New-Horizons/index.php) reports it (09/01/2017) at a distance of 39.33Astronomical Units (AU) from the Sun, traveling away from the Sun at 14.24 km/sec, 8.85 mi/sec. For this lab you will use the cin and cout streams along with some simple mathematics for calculating New Horizon's distance. The important part of the project is to learn the skills needed to access the class web site, to access a project description, create a new program in C++ and finally to hand it in. Your Task Your program will prompt the user for an integer number (a number without decimal points) which indicates the number of days after 09/01/2017, starting at the distance 39.33 AU from the sun. You will calculate the distance of New Horizons from the Sun using the numbers from 09/01/2017 (assume velocity is constant) plus the user provided number of days and report: Updated distance in A.U. Distance in kilometers (1 AU = 149,598,000 km) on a line by itself Distance in miles (1 AU = 92,955,800 mile) on a line by itself Round trip time for radio communication in hours. Radio waves travel at the speed of light, listed at 299,792,458 meters/second, on a line by itself provide 2 decimal points of accuracy using std::fixed and std::setprecision (the later requiring #include). You would use them as follows: std::cout << std::fixed; std::cout << std::setprecision(2); indicates that you need to show your TA your progress at this point. Please show your TA: Your working program Assignment Notes: There is a Mimir assignment labeled Lab01: New Horizons with 3 test cases. There is a starter file with the correct directory and name, lab01.cpp, but no content (nothing in the file). There are some rounding issues here so be careful! To make the km calculations, us the constants (speed and distance) provided. To make the mile calculations, use the constants (speed and distance) provided. To make the round trip calculation, use your distance in km and the speed of light constant provided. You'll get slightly different answers if you try to convert the two distance or the two speeds. If you want to work locally you can use the Mimir test cases. Look at the test case and the input and output. Save them into pairs of files, for example inXX.txt and outXX.txt examples, where XX is the test number: in1.txt should match out1.txt, int2.txt should match out2.txt and so on. The output should match exactly. Working locally is a good idea! You will need to work with the cin and cout streams and their operators >> (for cin) and << (for cout). You will also need to declare the appropriate variables: long (a 64 bit integer) for values like days and double for calculation values. cout takes either variable values or strings (between " ") and outputs them to the console. You can use multiple << operators on the same cout stream, usually ending with endl . Assuming the variable int_var has the value 23: std::cout << "This is a string: "<< int_var << " the end" << std::endl; would ouput: This is a string: 23 the end cin will input a value from the command line into a variable of a particular type. It does so until it hits a space (space separated values) or an end of line. For example: std::cin >> int_var; If you enter a value on the command line, an integer, it will be read into the variable (no conversion required). int multiplier, number; std::cin >> number; std::cin >> multiplier; std::cout << "The number "<

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions