Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project 5 : Galactic Fuel w / ClassesObjectives 1 . More practice designing and implementing a class in C + + 2 . More practice

Project 5: Galactic Fuel w/ClassesObjectives1. More practice designing and implementing a class in C++2. More practice working with and indexing arrays.3. More practice working with files.BackgroundIn the outer reaches of the Andromeda Galaxy, the Zentharians, a highly advanced race ofinterstellar navigators, embark on their annual Quantum Fuel Expedition to secure the hyper-dense dark energy crystals essential for powering their formidable battleships during theGalactic War Games. The crystals, known for their exceptional energy yield, are scatteredacross the perilous Dark Quantum Nebula, and the Zentharians must traverse this chaoticregion to harvest their fuel.Navigating the inky depths of the nebula is no small feat, and each Zentharian diligently logsthe quantum fuel content of the crystals they procure, documenting the data in their QuantumEnergy Ledger. Due to the nebula's interference with advanced communication technologies,the Zentharians rely on ancient, yet reliable, manual recording methods.For instance, as the Quantum Fuel Expedition progresses, the Zentharian ledger might read asfollows:1112223334005506007008309101001This ledger signifies the quantum fuel carried by five Zentharian navigators: The first Zentharian is carrying dark energy crystals with a quantum fuel content of 111,222, and 333 units, totaling 666 units. The second Zentharian is carrying a single dark energy crystal with a quantum fuelcontent of 400 units. The third Zentharian is carrying dark energy crystals with a quantum fuel content of 550and 600 units, totaling 1150 units. The fourth Zentharian is carrying dark energy crystals with a quantum fuel content of700,830, and 910 units, totaling 2440 units. The fifth Zentharian is carrying a single dark energy crystal with a quantum fuel contentof 1001 units.In the event that the Zentharians encounter hostile forces during the Galactic War Games andrequire additional quantum fuel for their battleships, they must identify which Zentharian toapproach. Specifically, they aim to determine the Zentharian carrying the most quantum fuel.In the example above, this would be the fourth Zentharian with a total quantum fuel contentof 2440 units.The AssignmentYour task is to write a C++ program that will process a ledger file to pinpoint the Zenthariannavigator carrying the most quantum fuel and calculate the total quantum fuel they aretransporting. The ledger files will have no more than 1000 groups of data aka 1000Zentharians with mutiple crystals (but no more than 20) of fuel. May the quantum anomaliesguide your calculations!Requirements1. Use as your filenames: main.cpp, Zentharian.cpp, Zentharian.h2. You must design a class for the Zentharian that should contain the following: Data: minimally the individual crystal values in an array as the data although youmay wish to include other data members to make the main program easier toimplement. Member Functions:methods you determine are necessary to interact with the datamembers, and at least one overloaded comparison operator (I recommend >) forcomparing Zentharian objects. A global constant in the main file for the maximum number of Zentharians A global constant in the head file for the maximum number of Crystals3. All output should be spelled, spaced, and formatted according to the sample runs below.Hints Recall from the notes there is a function called std::stoi() in the string header that willaccept a string and return an integer value Also, remember that an empty string is "" and that std::getline() throws out the newlinecharacter. You may wish to refer to the example code posted for the 8 Ball and Item examples forhelp.Sample RunsSample Run 1Enter ledger file: sample.datZentharian 4 has 3 crystals worth700830910fuel each. Totaling 2440 units.Sample Run 2Enter ledger file: long_ledger.datZentharian 22 has 15 crystals worth502654062517562843925195554840462982444446034139591746235650fuel each. Totaling 70116 units.Sample Run 3Enter ledger file: medium_ledger.datZentharian 385 has 18 crystals worth288941956181881514639077192711627143873391424635437994312730385426224671904285213919241473fuel each. Totaling 1513710 units.Sample Run 4Enter ledger file: short_ledger.datZentharian 3 has 15 crystals worth24957457583039344487308573376049874361168040277944450018749363961277910348fuel each. Totaling 454808 units.Sample Run 5Enter ledger file: empty.datYou entered an invalid ledger...empty.dat

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

Next Generation Databases NoSQLand Big Data

Authors: Guy Harrison

1st Edition

1484213300, 978-1484213308

More Books

Students also viewed these Databases questions

Question

1. Where do these biases come from?

Answered: 1 week ago