From 12a3223b60aa33dbaef172a2f7f5d1bc841b51c6 Mon Sep 17 00:00:00 2001 From: Axum25 Date: Sat, 28 Jan 2017 15:04:11 -0400 Subject: [PATCH 1/4] Added header file --- Fruits.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Fruits.h 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 From 7539cc4a03182aeb479bdb9a634d94bbf5edc10d Mon Sep 17 00:00:00 2001 From: Axum25 Date: Sat, 28 Jan 2017 15:06:29 -0400 Subject: [PATCH 2/4] Added Implementation File --- Fruits.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Fruits.cpp 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; + } From 0066b0f68aa7faede48f9774485271dca3592c1a Mon Sep 17 00:00:00 2001 From: Axum25 Date: Sat, 28 Jan 2017 15:07:46 -0400 Subject: [PATCH 3/4] Added Client File --- GroceryStore.cpp | 65 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 GroceryStore.cpp diff --git a/GroceryStore.cpp b/GroceryStore.cpp new file mode 100644 index 0000000..9abdec0 --- /dev/null +++ b/GroceryStore.cpp @@ -0,0 +1,65 @@ +/* GroceryStore.cpp Jan 25, 2017 */ + + +#include +#include "Fruits.h" +#include +#include +using namespace std; + +int main() +{ +vector Bags; + +cout << "Bags needed four (4)"<> choice; + cout << "Enter Total Weight"; + cin >> quantity; + + Fruits Bag1(choice, quantity); + Bags.push_back(Bag1); + + cout << "Enter Fruit Name"; + cin >> choice; + cout << "Enter Total Weight"; + cin >> quantity; + + Fruits Bag2(choice, quantity); + Bags.push_back(Bag2); + + cout << "Enter Fruit Name"; + cin >> choice; + cout << "Enter Total Weight"; + cin >> quantity; + + Fruits Bag3(choice, quantity); + Bags.push_back(Bag3); + + cout << "Enter Fruit Name: "; + cin >> choice; + cout << "Enter Total Weight: "; + cin >> quantity; + + Fruits Bag4(choice, quantity); + Bags.push_back(Bag4); + + cout<<"Fruits:"< Date: Thu, 23 Feb 2017 15:45:00 -0400 Subject: [PATCH 4/4] Lab #3 Forgot to Upload Changes --- GroceryStore.cpp | 72 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 62 insertions(+), 10 deletions(-) diff --git a/GroceryStore.cpp b/GroceryStore.cpp index 9abdec0..783c49c 100644 --- a/GroceryStore.cpp +++ b/GroceryStore.cpp @@ -5,38 +5,50 @@ #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"; + cout << "Enter Total Weight: "; cin >> quantity; + cout << ""<> choice; - cout << "Enter Total Weight"; + + cout << "Enter Total Weight: "; cin >> quantity; + cout << ""<> choice; - cout << "Enter Total Weight"; + cout << "Enter Total Weight: "; cin >> quantity; + cout << ""<> 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 \""<