Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Project 5 : Galactic Fuel w / ClassesObjectives 1 . More practice designing and implementing a class in C + + 2 . More practice
Project : Galactic Fuel wClassesObjectives More practice designing and implementing a class in C More practice working with and indexing arrays 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 hyperdense 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:This ledger signifies the quantum fuel carried by five Zentharian navigators: The first Zentharian is carrying dark energy crystals with a quantum fuel content of and units, totaling units. The second Zentharian is carrying a single dark energy crystal with a quantum fuelcontent of units. The third Zentharian is carrying dark energy crystals with a quantum fuel content of and units, totaling units. The fourth Zentharian is carrying dark energy crystals with a quantum fuel content of and units, totaling units. The fifth Zentharian is carrying a single dark energy crystal with a quantum fuel contentof 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 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 groups of data aka Zentharians with mutiple crystals but no more than of fuel. May the quantum anomaliesguide your calculations!Requirements Use as your filenames: main.cpp Zentharian.cpp Zentharian.h 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 Crystals 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 Ball and Item examples forhelp.Sample RunsSample Run Enter ledger file: sample.datZentharian has crystals worthfuel each. Totaling units.Sample Run Enter ledger file: longledger.datZentharian has crystals worthfuel each. Totaling units.Sample Run Enter ledger file: mediumledger.datZentharian has crystals worthfuel each. Totaling units.Sample Run Enter ledger file: shortledger.datZentharian has crystals worthfuel each. Totaling units.Sample Run Enter ledger file: empty.datYou entered an invalid ledger...empty.dat
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started