Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

My goal is to store and collect a list of bottles and display that information using classes, I was wondering if anyone could help complete

My goal is to store and collect a list of bottles and display that information using classes, I was wondering if anyone could help complete my code? (Written in c++)

Here is all of my code I have written so far, anything you can suggest will help!

image text in transcribed

// CST126_2_91.cpp : This file contains the 'main' function. #include "bottle.h" using namespace std; Untitled - Notepad #define maximum 30 File Edit Format View Help bottle globalArray[maximum); //bottle.cpp// bool Open InputFile(ifstream& input_file, string filename); #include "bottle.h" void readfile(ifstream& input_file); bottle:: bottle() { bool Open InputFile(ifstream& input_file, string filename) m_color = ""; m_type = ""; input_file.open(filename); m_age = 0; m_value = 0.0; if (input_file.fail() bottle:: bottle(const string& color, const string& type, int age, double value) { cout // string operation void readfile(ifstream& infile) { #include bottle[maximum); using namespace std; string color; string category; #include // to file operation int age; double value; class bottle In 18, Col2 100% Windows (CRLF) int temp; int count = 0; public: while (!inFile.eof> color; bottle(const string& color, const string& type, int age, double value); infile >> category; inline const string getColor() {return m_color; } infile >> age; inline const string getType() {return m_type; } infile >> value; inline const int getAge() {return m_age; } //create temp bottle inline const double getValue() {return m_value;} bottle. temp (color, category, age, value); //add temp bottle to global structure void print(); //globalArray[count] = temp; private: //count++; string m_color; //endwhile string m_type; //testing read, constructor, print functions int m_age; temp.print(); double m_value; UTF-8 Search Error List oject File #endif int main() string fileName; cout // string operation void readfile(ifstream& infile) { #include bottle[maximum); using namespace std; string color; string category; #include // to file operation int age; double value; class bottle In 18, Col2 100% Windows (CRLF) int temp; int count = 0; public: while (!inFile.eof> color; bottle(const string& color, const string& type, int age, double value); infile >> category; inline const string getColor() {return m_color; } infile >> age; inline const string getType() {return m_type; } infile >> value; inline const int getAge() {return m_age; } //create temp bottle inline const double getValue() {return m_value;} bottle. temp (color, category, age, value); //add temp bottle to global structure void print(); //globalArray[count] = temp; private: //count++; string m_color; //endwhile string m_type; //testing read, constructor, print functions int m_age; temp.print(); double m_value; UTF-8 Search Error List oject File #endif int main() string fileName; cout

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

MongoDB Applied Design Patterns Practical Use Cases With The Leading NoSQL Database

Authors: Rick Copeland

1st Edition

1449340040, 978-1449340049

More Books

Students also viewed these Databases questions

Question

4. What decision would you make and why?

Answered: 1 week ago

Question

3. Review the evidence. Do you believe the testimony presented?

Answered: 1 week ago