Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Develop an application that has at least 3 classes that models or simulates

ID: 3837964 • Letter: C

Question

C++

Develop an application that has at least 3 classes that models or simulates driving a car to the gas station to purchase gas and drive home again.

You should have a least 3 classes and no more than 5 classes. I highly recommend you keep it to 3 classes and keep the project simple.Write these down on paper or 3 x 5 cards and put your name on it--this is a deliverable that you will turn in with your project.

File I/O required. You must use file operations to either read something in or write something out. I don't care which but you must show that you can do file I/O operations. For example, let's say I write an application to model driving a car to the gas station, paying for the gas, and then pumping gas in my car and driving home. You could write a message to the screen telling the user what's going on during the program and you could send those same messages to a file to prove you can open a file and write to it. Another example: Say you write an application to play a game, you could let the user quit the game before finishing and write out the state of the game to a file. Then the user could start the game application later and the application would check for the existence of a saved-game file and start the game where you left off by opening the file and reading in the game state. (My recommendation, take the easy route and just write some log messages to a file.)

Explanation / Answer

#include #include #include #include #include using namespace std; int gasoline[] = {8, 6, 30, 9, 15, 21, 2, 18}; int stations[] = {15, 8, 2, 6, 18, 9, 21, 30}; int rnd_num(const int& low, const int& high) { int rndnum = (int) (((double) rand() / (double) RAND_MAX) * (high - low + 1) + low); return rndnum; } void swap(int data[], const int& idxlow, const int& idxhigh) { int tmp = data[idxlow]; data[idxlow] = data[idxhigh]; data[idxhigh] = tmp; } void print_array(const char* label, int data[], int size) { printf("%-10s: ", label); for (int i = 0; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote