diff --git a/Fruits.cpp b/Fruits.cpp new file mode 100644 index 0000000..daf471a --- /dev/null +++ b/Fruits.cpp @@ -0,0 +1,39 @@ +/* Fruits.cpp Jan 25, 2017 */ + +#include "Fruits.h" +#include +using namespace std; + + Fruits::Fruits() + { + fruitName = "Apples"; + fruitWeight = 5.0; + } + Fruits::Fruits(string name, double weight) + { + fruitName = name; + fruitWeight = weight; + } + + Fruits::~Fruits() + { + + } + + string Fruits::getName() + { + return fruitName; + } + double Fruits::getWeight() + { + return fruitWeight; + } + + void Fruits::setName(string n) + { + fruitName = n; + } + void Fruits::setWeight(double weight) + { + fruitWeight = weight; + } diff --git a/Fruits.h b/Fruits.h new file mode 100644 index 0000000..6f49f46 --- /dev/null +++ b/Fruits.h @@ -0,0 +1,29 @@ +/* + * Fruits.h + * Jan 25, 2017 + * Author: Axum25 + */ +#ifndef FRUITS_H_ +#define FRUITS_H_ +#include +using namespace std; + +class Fruits { +private: + string fruitName; + double fruitWeight; + +public: + Fruits(); + Fruits(string,double); + + ~Fruits(); + + string getName(); + double getWeight(); + + void setName(string); + void setWeight(double); +}; + +#endif diff --git a/GroceryStore.cpp b/GroceryStore.cpp new file mode 100644 index 0000000..783c49c --- /dev/null +++ b/GroceryStore.cpp @@ -0,0 +1,117 @@ +/* GroceryStore.cpp Jan 25, 2017 */ + + +#include +#include "Fruits.h" +#include +#include + +using namespace std; + +int linearSearch( auto data, auto key); + +int main() +{ +vector Bags; + + +cout << "Bags needed four (4)"<> choice; + cout << "Enter Total Weight: "; + cin >> quantity; + + cout << ""<> choice; + + cout << "Enter Total Weight: "; + cin >> quantity; + + cout << ""<> choice; + cout << "Enter Total Weight: "; + cin >> quantity; + + cout << ""<> choice; + cout << "Enter Total Weight: "; + cin >> quantity; + + cout << ""<>search_key; + + while(search_key != "#")//perform searches until sentinel entered + { + result = linearSearch(Bags, search_key); + + cout<<" \""<>search_key; + } + +} + +int linearSearch(auto data, auto key) +{ + + cout<< "Search Key is \""<