代写辅导接单- Project 6 – Interstellar Travel App CS 211, Spring 2024

欢迎使用51辅导,51作业君孵化低价透明的学长辅导平台,服务保持优质,平均费用压低50%以上! 51fudao.top

 Project 6 – Interstellar Travel App

CS 211, Spring 2024

Collaboration Policy

By submitting this assignment, you are acknowledging you have read the collaboration policy in the syllabus for projects. This project should be done individually. You may not receive any assistance from anyone outside of the CS 211 Instructional Team.

Late Policy

No late work or extensions. All work for the semester must be finished by the final day of the term. As this is the last project, we are making it due at 11:59pm on Friday of week 15.

What & Where to Submit

1. zyBooks - Functionality Score

2. Gradescope - Forgetting this step may result in a score of 0 on the project.

Submit all your C++ files to Gradescope. As we are implementing many files, the easiest way to submit from zyBooks is to download the entire project, which will download a zip file. Then drag the entire zip into the Gradescope uploader (or select it), and the uploader should expand it to show all of your files. The submission system automatically rejects all files that are not C++ files ending in .cpp and PDF files ending in .pdf.

Don't wait until the last second! Submissions could fail. No late submission. Failure to submit to Gradescope may result in a score of 0 on the project!

Grading Breakdown

The automarked functionality score will be out of 100 points. The extra credit function will be automarked on zyBooks. Gradescope will be used for manual deductions relating to project coding restrictions, course style requirements, and other deductions similar to prior projects.

Table of Contents

Project Summary

Program and Coding Restrictions

Provided Code & Solution Executable

Primary Project Topics

The Data Files

A Little Bit About Exception Handling

To Begin - What's in a Stub?

Implementation Basics

I Renamed 4 TODOs to DONE After Completing Them, Now What? Testing Basics

Example Execution with input.txt no splash screen

Copyright Notice

Copyright 2024 Adam T Koehler, PhD - University of Illinois Chicago

This assignment description is protected by U.S. copyright law. Reproduction and distribution of this work, including posting or sharing through any medium, such as to websites like chegg.com is explicitly prohibited by law and also violates UIC's Student Disciplinary

Policy (A2-c. Unauthorized Collaboration; and A2-e3. Participation in Academically Dishonest Activities: Material Distribution).

Material posted on any third party sites in violation of this copyright and the website terms will be removed. Your user information will be released to the author.

 

 Project 6 – Interstellar Travel App

CS 211, Spring 2024

Project Summary

Every great Interstellar Travel Agent needs a flight planning app. So in this project we will create an object oriented terminal based program that allows reading of Celestial data files and Solar System connection data files to help us plan flights across the stars.

Now let's get started because there are so many solar systems and so little time!

Program and Coding Restrictions

● Only use getline for user and file input, only use the >> operator with string streams

● Any hard coding, especially to pass test cases, will result in a zero for the entire project.

● You cannot use any libraries beyond the ones we have given.

● You must use smart pointers.

● You must use vectors as your C++ container, you may not use maps, sets, pairs, or

similar built-in C++ container types.

● Use the provided code, do not edit the given class declarations in the header files.

Provided Code & Solution Executable

We have provided the executable solution within the zyBooks development area alongside a multitude of given files. You should utilize the solution as a resource to explore various execution scenarios. To execute the solution within the terminal, type: make solution

Have a useful tip? Find a Bug or an Errant Project/Function Description?

Post a followup on Piazza so that responses are all collected in a single spot. Primary Project Topics

  "New" C++ Syntax

Classes & Polymorphism

C++ Review or Refresh

● Command Line Args ● File Input (141 video) ● String Streams

● string parsing

● -> operator

● auto ● multi-file classes

  ● {}e.g.return {};

● for-each loops

● to_string()

● try-catch

● smart pointers

● inheritance

● virtual keyword

● override keyword

● custom exception class

 

 Project 6 – Interstellar Travel App

CS 211, Spring 2024

The Data Files

For this project we have two types of data files. The first data file type is a CSV that contains Celestial object information, allowing creation of the varying derived class types. The second data file type is a CSV data file containing various Solar Systems connections.

Unless data is cleared via the menu, reading multiple files will accumulate the data so more Celestial objects are created or more connections are added between Solar Systems.

For both types of data files:

● Use the getline() File IO templates in the video linked above.

● All blank lines should be skipped (e.g. lines 7 and 11 below)

● All comments (lines starting with #) should be skipped (e.g. lines 1-3 below)

The Celestial Object Data CSV

   1 2 3 4 5 6 7 8 9

10 11

 # This file was created for test purposes to mimic data from the NASA Exoplanet Archive

# http://exoplanetarchive.ipac.caltech.edu

#

System,Sol

Star,Sol,Sol,G2 V,5780.00,1.00

Planet,Earth,Sol,Sol,365.20,1.00

Satellite,Moon,Earth,Sol,0.27,No

Satellite,Internation Space Station,Earth,Sol,0.0000171,Yes

Planet,Mars,Sol,Sol,687.00,0.53

example.csv

  Every Celestial object we create will have fully defined data, which is why we throw some of the exceptions see below. Fully defined for us simply means there are the proper number of commas to parse the line into the necessary pieces.

As noted before it is wise to break up the data file reading to make sure you are getting one item correct before moving on to parse the others. We suggest starting with the Solar System objects as all other objects must be inserted into a Solar System or Planet.

Every data line starts with a keyword denoting the Celestial object type.

Line 4 shows us a Solar System object's data, its constructor requires a single argument. ● The data contains: The name of the Solar System to create.

Line 5 shows us a Star object's data, its constructor requires four arguments.

● A Star object gets added to the named Solar System

● If the Solar System where the Star resides does not exist, we must create it first.

● The data contains:

○ The name of the Star

○ The name of the Solar System in which the Star resides

○ The spectral type of the Star

○ The temperature of the Star in Kelvins

○ The Solar Mass (mass relative to the Sun) of the Star

 

 Project 6 – Interstellar Travel App

CS 211, Spring 2024

Lines 6 and 10 show us a Planet object's data, its constructor requires three arguments.

● A Planet object gets added to the named Solar System

● If the Solar System where the Planet resides does not exist, we must create it first.

● If the Star the Planet orbits does not exist, we must create it next.

● The data contains:

○ The name of the Planet

○ The name of the Star

○ The name of the Solar System in which the Star resides

○ The orbital period (in days) of the Planet

○ The radius (relative to Earth) of the Planet

Lines 8 and 9 show us a Satellite object's data, its constructor requires three arguments.

● A Satellite object gets added to the satellites of the named Planet

● If the Solar System where the Planet resides does not exist, we must create it first.

● If the Planet the Satellite orbits does not exist, we must create it next.

● The data contains:

○ The name of the Satellite

○ The name of the Planet

○ The name of the Solar System in which the Planet resides

○ The radius (relative to Earth) of the Satellite

○ Yes or No, whether the Satellite is naturally occurring

■ For our purposes, No implies that it is human made. The Solar System Connection Data CSV

Lines 3, 5, and 6 show examples of connection data lines.

● A source Solar System is always listed first on the line.

○ If that Solar System is not in our imported Celestials data set we cannot add any connections so we are done.

● After the source, there are any number of connections to add to the connections collection of the source Solar System.

Play around, make some data file changes, execute the solution's menu commands to load and then display the data or information about the data in various ways and see how your changes are reflected in what is loaded or what is created. You don't need to restart the app to load a file again after changing it! For example...

● What happens when the connection is not a valid Solar System?

● What happens when a connection already exists?

   1 2 3 4 5 6 7

 # data connections file

# first is source, then all remaining are potential destinations

Sol1,Sol2

Sol2,Sol3,Sol1,Sol5

Sol3,Sol1

example2_connections1.csv

 

 Project 6 – Interstellar Travel App

CS 211, Spring 2024

A Little Bit About Exception Handling

We define a custom exception class FileException for you to utilize. When throwing a FileException the constructor takes a string that is a message. You can explore using the solution with various provided data files (or incorrect file names) to see these occur in the executing solution. We will only catch exceptions that occur during our file reading or any function decomposition that you perform within file reading (such as data line parsing).

What to catch and how to rethrow an exception

We will use the base level class to define what we are catching. You should handle exceptions at the top level. For us that is either in the case in main() or in the top most function decomposition from main().

     catch(const exception& e)

{

... // <-anycleanupcodenecessarybeforetherethrow

throw; // <-rethrowsthecaughtexceptionuptothenextlevel }

FileException Message

The following are the messages associated with the FileException exceptions we throw.

● File Not Found - (combined with the filename)

● Bad Data Line - No Comma Found: (combined with the line of data)

○ ● Bad

Occurs when the data line has no commas in it.

Data Line - Invalid Celestial Type: (combined with the line of data) Occurs when the type of Celestial object is not one of the parseable types

● Bad Data Line - Mismatched Data Amount: (combined with the line of data)

Occurs when looking for a specific Celestial objects data

To Begin - What's in a Stub?

Set up function stubs in the various C++ files that should contain all the definitions of the various class declarations. A function stub is a definition that allows compilation, but is logically flawed as it either doesn't have body code or only has a return statement.

At times this semester we have given you function stubs with TODO or UPDATE THIS comments inside the function because C does not have a default value initializer. In C++ (since C++11) we can use the {} to return a default value that matches the return type.

return {}; // <-sinceC++11

Once you have created function stubs for all the functions in every class you must implement. Check to make sure that the code compiles correctly. It still will not do anything so execution is not necessary but if you do, you can type option 15 to exit.

 

 Project 6 – Interstellar Travel App

CS 211, Spring 2024

Implementation Basics

There are many ways to go about implementing our program because of the vast amount of functions across all the classes. I would suggest implementing the basics of interstellar.cpp before going and defining many of the class functions.

This means go through a few of the TODOs in the main file before jumping into data parsing and object creation. There are 5 TODO statements in interstellar.cpp, and you should complete all except the "Add cases as you implement functionalities" TODO.

I Renamed 4 TODOs to DONE After Completing Them, Now What?

It's time to be free and to pivot around as you see fit.

Go through the classes, implement some of the easier functions such as the straightforward accessors and mutators. After the easy ones try to complete as much as the Solar System class as possible.

Bored or stuck? Time to pivot and go back to (or start) implementing some of the menu options.There are 15 options in the menu, some are extremely straightforward, but they all work with the object classes that you are crafting. If you have the Solar System class almost fully implemented, it may be a good time to finish up (or start) the Celestial object data reading. Now that you have the menu printed you should be able to execute your program, see the menu and select the choice you wish to execute. You can do the same actions within the solution and see the results there as well.

Note On File Reading and Data Parsing

Take it in chunks. There are a lot of interdependencies with the final result of the data file reading. However, the Celestial objects are noted as part of the data line and therefore you could implement just one of the types and return back to the others later. Feel free to insert TODO statements to remind you to go back and complete branches of code that you left blank.

Testing Basics

We provided a tests.cpp file for testing our implementations outside the scope of the program. This will allow you to create objects within main() of tests.cpp and invoke your various member functions to check that they are working correctly.

There is a makefile rule for compiling your tests.cpp and a makefile rule for executing it.

We will not grade your tests.cpp. If you submit it to Gradescope because you uploaded the zip with all C++ files, we will ignore your tests.cpp during grading.

 

 Project 6 – Interstellar Travel App

CS 211, Spring 2024

Example Execution with input.txt no splash screen

Welcome to the Interstellar Travel App

======================================

Interstellar Travel App Menu Options

   1. Read a Celestial objects data file

   2. Read a Solar System connection file

   3. Print out each Solar System's Celestial details

   4. Print out each Solar System's connection details

   5. Print loaded Celestial stats

   6. Plan flight path

   7. Validate the flight path

   8. Print path

   9. Print path connections

  10. Print Celestial objects on path

  11. Clear path data

  12. Clear each system's connection data

  13. Clear all systems data

  14. Generate a path from a start and finish

  15. Exit the application

Enter a selection:

Enter the file location and name:

Interstellar Travel App Menu Options

   1. Read a Celestial objects data file

   2. Read a Solar System connection file

   3. Print out each Solar System's Celestial details

   4. Print out each Solar System's connection details

   5. Print loaded Celestial stats

   6. Plan flight path

   7. Validate the flight path

   8. Print path

   9. Print path connections

  10. Print Celestial objects on path

  11. Clear path data

  12. Clear each system's connection data

  13. Clear all systems data

  14. Generate a path from a start and finish

  15. Exit the application

Enter a selection:

Sol1

  Star Sol1 of type G2 V with temperature 5780.000000 and mass 1.000000

  Planet Earth with orbital period 365.200000 and relative radius of 1.000000

    Satellite Moon is natural with radius of 0.270000

    Satellite Internation Space Station is human made with radius of 0.000017

  Planet Mars with orbital period 687.000000 and relative radius of 0.53000

Sol2

  Star Sol2 of type G2 V with temperature 5780.000000 and mass 1.000000

  Planet Earth2 with orbital period 365.200000 and relative radius of 1.000000

    Satellite Moon2 is natural with radius of 0.270000

Sol3

  Star Sol3 of type G2 V with temperature 5780.000000 and mass 1.000000

  Planet Uranus with orbital period 30589.000000 and relative radius of 4.00000

  Planet Neptune with orbital period 59800.000000 and relative radius of 3.90000

  Planet Pluto with orbital period 90560.000000 and relative radius of 0.20000

Interstellar Travel App Menu Options

 

 Project 6 – Interstellar Travel App

CS 211, Spring 2024

   1. Read a Celestial objects data file

   2. Read a Solar System connection file

   3. Print out each Solar System's Celestial details

   4. Print out each Solar System's connection details

   5. Print loaded Celestial stats

   6. Plan flight path

   7. Validate the flight path

   8. Print path

   9. Print path connections

  10. Print Celestial objects on path

  11. Clear path data

  12. Clear each system's connection data

  13. Clear all systems data

  14. Generate a path from a start and finish

  15. Exit the application

Enter a selection:

Enter the file location and name:

Interstellar Travel App Menu Options

   1. Read a Celestial objects data file

   2. Read a Solar System connection file

   3. Print out each Solar System's Celestial details

   4. Print out each Solar System's connection details

   5. Print loaded Celestial stats

   6. Plan flight path

   7. Validate the flight path

   8. Print path

   9. Print path connections

  10. Print Celestial objects on path

  11. Clear path data

  12. Clear each system's connection data

  13. Clear all systems data

  14. Generate a path from a start and finish

  15. Exit the application

Enter a selection:

Sol1 -> {Sol2}

Sol2 -> {Sol3, Sol1}

Sol3 -> {Sol1}

Interstellar Travel App Menu Options

   1. Read a Celestial objects data file

   2. Read a Solar System connection file

   3. Print out each Solar System's Celestial details

   4. Print out each Solar System's connection details

   5. Print loaded Celestial stats

   6. Plan flight path

   7. Validate the flight path

   8. Print path

   9. Print path connections

  10. Print Celestial objects on path

  11. Clear path data

  12. Clear each system's connection data

  13. Clear all systems data

  14. Generate a path from a start and finish

  15. Exit the application

Enter a selection:

 

 Project 6 – Interstellar Travel App

CS 211, Spring 2024

Enter the file location and name:

Interstellar Travel App Menu Options

   1. Read a Celestial objects data file

   2. Read a Solar System connection file

   3. Print out each Solar System's Celestial details

   4. Print out each Solar System's connection details

   5. Print loaded Celestial stats

   6. Plan flight path

   7. Validate the flight path

   8. Print path

   9. Print path connections

  10. Print Celestial objects on path

  11. Clear path data

  12. Clear each system's connection data

  13. Clear all systems data

  14. Generate a path from a start and finish

  15. Exit the application

Enter a selection:

Sol1 -> {Sol2, Sol3}

Sol2 -> {Sol3, Sol1}

Sol3 -> {Sol1, Sol2}

Interstellar Travel App Menu Options

   1. Read a Celestial objects data file

   2. Read a Solar System connection file

   3. Print out each Solar System's Celestial details

   4. Print out each Solar System's connection details

   5. Print loaded Celestial stats

   6. Plan flight path

   7. Validate the flight path

   8. Print path

   9. Print path connections

  10. Print Celestial objects on path

  11. Clear path data

  12. Clear each system's connection data

  13. Clear all systems data

  14. Generate a path from a start and finish

  15. Exit the application

Enter a selection:

Thank you for using the Interstellar Travel App.

 

 

51作业君

Email:51zuoyejun

@gmail.com

添加客服微信: abby12468