I need the following code completed:
#include <iostream>
#include <time.h>
#include "CSVparser.hpp"
using namespace std;
//============================================================================
// Global definitions visible to all methods and classes
//============================================================================
// forward declarations
double strToDouble(string str, char ch);
// define a structure to hold bid information
struct Bid {
string bidId; // unique identifier
string title;
string fund;
double amount;
Bid() {
amount = 0.0;
}
};
// FIXME (1): Internal structure for tree node
struct Node {
Bid data; Node *left; Node *right;
};
//============================================================================
// Binary Search Tree class definition
//============================================================================
/**
* Define a class containing data members and methods to
* implement a binary search tree
*/
class BinarySearchTree {
private:
Node* root;
void addNode(Node* node, Bid bid);
void inOrder(Node* node);
Node* removeNode(Node* node, string bidId);
public:
BinarySearchTree();
virtual ~BinarySearchTree();
void InOrder();
void Insert(Bid bid);
void Remove(string bidId);
Bid Search(string bidId);
};
/**
* Default constructor
*/
BinarySearchTree::BinarySearchTree() {
// initialize housekeeping variables
}
/**
* Destructor
*/
BinarySearchTree::~BinarySearchTree() {
// recurse from root deleting every node
}
/**
* Traverse the tree in order
*/
void BinarySearchTree::InOrder() {
}
/**
* Insert a bid
*/
void BinarySearchTree::Insert(Bid bid) {
Node p = Insert(root, bid);
p->data.bidId = bid.bidId;
p->data.title = bid.title;
p->data.fund = bid.fund;
p->data.amount = bid.amount;
}
/**
* Remove a bid
*/
void BinarySearchTree::Remove(string bidId) {
deleteNode(root,bidid);
}
/**
* Search for a bid
*/
Bid BinarySearchTree::Search(string bidId) {
// FIXME (3) Implement searching the tree for a bid
Bid bid;
if (root == NULL || root->data.bidId == bidId)
{
bid.bidId = bidId;
bid.title = root->data.title;
bid.fund = root->data.fund;
bid.amount = root->data.amount;
return bid;
}
if (root->data.bidId < bidId)
return search(root->right, bidId);
return search(root->left, bidId);
return bid;
}
/**
* Add a bid to some node (recursive)
*
* @param node Current node in tree
* @param bid Bid to be added
*/
void BinarySearchTree::addNode(Node* node, Bid bid) {
// FIXME (2b) Implement inserting a bid into the tree
Node p = insertNode(node, bid);
p->data.bidId = bid.bidId;
p->data.title = bid.title;
p->data.fund = bid.fund;
p->data.amount = bid.amount;
}
void BinarySearchTree::inOrder(Node* node) {
}
//============================================================================
// Static methods used for testing
//============================================================================
/**
* Display the bid information to the console (std::out)
*
* @param bid struct containing the bid info
*/
void displayBid(Bid bid) {
cout << bid.bidId << ": " << bid.title << "
| " << bid.amount << " | "
<< bid.fund << endl;
return;
}
/**
* Load a CSV file containing bids into a container
*
* @param csvPath the path to the CSV file to load
* @return a container holding all the bids read
*/
void loadBids(string csvPath, BinarySearchTree* bst) {
cout << "Loading CSV file " << csvPath <<
endl;
// initialize the CSV Parser using the given path
csv::Parser file = csv::Parser(csvPath);
// read and display header row - optional
vector<string> header = file.getHeader();
for (auto const& c : header) {
cout << c << " | ";
}
cout << "" << endl;
try {
// loop to read rows of a CSV file
for (unsigned int i = 0; i < file.rowCount(); i++) {
// Create a data structure and add to the collection of
bids
Bid bid;
bid.bidId = file[i][1];
bid.title = file[i][0];
bid.fund = file[i][8];
bid.amount = strToDouble(file[i][4], '$');
//cout << "Item: " << bid.title << ", Fund: " << bid.fund << ", Amount: " << bid.amount << endl;
// push this bid to the end
bst->Insert(bid);
}
} catch (csv::Error &e) {
std::cerr << e.what() << std::endl;
}
}
/**
* Simple C function to convert a string to a double
* after stripping out unwanted char
*
* credit: http://stackoverflow.com/a/24875936
*
* @param ch The character to strip out
*/
double strToDouble(string str, char ch) {
str.erase(remove(str.begin(), str.end(), ch), str.end());
return atof(str.c_str());
}
/**
* The one and only main() method
*/
int main(int argc, char* argv[]) {
// process command line arguments
string csvPath, bidKey;
switch (argc) {
case 2:
csvPath = argv[1];
bidKey = "98109";
break;
case 3:
csvPath = argv[1];
bidKey = argv[2];
break;
default:
csvPath = "eBid_Monthly_Sales_Dec_2016.csv";
bidKey = "98109";
}
// Define a timer variable
clock_t ticks;
// Define a binary search tree to hold all bids
BinarySearchTree* bst;
Bid bid;
int choice = 0;
while (choice != 9) {
cout << "Menu:" << endl;
cout << " 1. Load Bids" << endl;
cout << " 2. Display All Bids" << endl;
cout << " 3. Find Bid" << endl;
cout << " 4. Remove Bid" << endl;
cout << " 9. Exit" << endl;
cout << "Enter choice: ";
cin >> choice;
switch (choice) {
case 1:
bst = new BinarySearchTree();
// Initialize a timer variable before loading bids
ticks = clock();
// Complete the method call to load the bids
loadBids(csvPath, bst);
//cout << bst->Size() << " bids read" << endl;
// Calculate elapsed time and display result
ticks = clock() - ticks; // current clock ticks minus starting
clock ticks
cout << "time: " << ticks << " clock ticks"
<< endl;
cout << "time: " << ticks * 1.0 / CLOCKS_PER_SEC
<< " seconds" << endl;
break;
case 2:
bst->InOrder();
break;
case 3:
ticks = clock();
bid = bst->Search(bidKey);
ticks = clock() - ticks; // current clock ticks minus starting clock ticks
if (!bid.bidId.empty()) {
displayBid(bid);
} else {
cout << "Bid Id " << bidKey << " not
found." << endl;
}
cout << "time: " << ticks << " clock ticks"
<< endl;
cout << "time: " << ticks * 1.0 / CLOCKS_PER_SEC
<< " seconds" << endl;
break;
case 4:
bst->Remove(bidKey);
break;
}
}
cout << "Good bye." << endl;
return 0;
}
In: Computer Science
The goal of this problem is to design a system to manage a moving company.
Customers who are planning to move (e.g., moving from a house to another one) call the moving assistant at the company to schedule their moving. The customer provides potential moving dates as well as the moving-from address and moving-to address. The assistant replies with a list of available dates. The customer picks a moving date and time. The assistant then schedules a virtual tour (with a date and time) with the customer (typically within the following 3 days) to provide a more accurate estimate about the moving price.
At the virtual tour date and time, the assistant calls the customer (e.g., via Zoom). The customer shows the major items to be moved. At the end of the virtual tour, the assistant gives the hourly rate, estimated total price, and estimated moving duration (number of hours). The assistant also emails a contract to the customer. If interested, the customer signs the contract and emails it back to the assistant. To validate the contract, the assistant calls the customer back. The customer provides credit card information to pay a deposit. Payment information is sent to the credit card company for authorization. If authorized, a deposit receipt is given to the customer.
At moving date, a crew of the company’s movers starts the actual moving. The head of the moving crew records the start time and share it with the customer. At the end of the moving, the head of the moving crew records the end time and calculates the actual total price. The customer provides credit card information. Payment information is sent to the credit card company for authorization. If authorized, a final receipt is given to the customer.
One week after the moving, the customer receives a survey form by email to evaluate the moving experience. The customer emails back the filled out form.
In: Computer Science
What is the difference between Green IT and Green IS? Discuss TWO recent advancements in development of green data centres?
A report that includes answers to the questions on the given topic. The report should have at least two references (if one reference is a website, the other should be a scientific/formal reference).
Format of the report to answer the questions • The report that has answers to the questions of the given topics. • The report should be between 1000 to 1250 words. • The report must use 12pt font, 1.5 spacing, Arial font.
In: Computer Science
Using CrypTool2, display the results of encrypting the following plain text using the Caesar Cipher method and a left shift value of 3.
MEET YOU AT THE FOOTBALL MATCH
In: Computer Science
The Model View Controller (MVC) and Tier architecture are two of the most widely used web design architectures currently in use.
a. Explain both concepts to a team of research who want you to build a website and publish their work.
b. Make a case by thoroughly explaining why one of the architectures in ‘a’ should be chosen over the other.
c. Brief the researchers on the dangers of using the internet and the necessary steps that you would put in place to curtail such dangers.
In: Computer Science
Is it possible to improve the performance of KNN using an AdaBoost ensemble classifier that uses KNN as the base classifier? Give the detailed (qualitative) reasons on your assertions.
In: Computer Science
The title of the course is ARTIFICIAL INTELLIGENCE AND EXPERT SYSTEMS I. All answers should be based on that. Please do not copy and paste answers on chegg or on google for me. All answers should be based on your understanding on the course. Please try as much to answer the questions based on what is asked and not setting your own questions and answering them. Let it be if you want to copy and paste answers.
*********************************************************************************************************************************************************************************************************************
(a) AI concentrates on developing systems which enables the
computer to
perform human-like activities through 'reasoning' based on
programmed rules. Explain how this ‘reasoning’ is factored in
developing simple expert system for medical diagnosis that is
based
on interview and for suggesting a list of ten common drugs.
(b) The subject area of expert (knowledge based) systems is a
branch
of artificial intelligence (AI); which in turn is a branch of
computer
science that attempts to understand the nature of intelligence
and
produce new classes of intelligent machines. Considering the fields
of
engineering or business, demonstrate with five (5) practical
diagrams
and explain how they represent new classes of
intelligence.
(c) As compared to humans, computers can process more
information at a
faster rate. For instance, if the human mind can solve a
mathematics
problem in 5 minutes, AI can solve 10 problems in less than a
minute.
What could be the reasons, if rather; a computer solves 5
mathematics
problems in a minute whiles human solves 10 problems in 5
minutes.
NOTE: There is already an answer here and I'm not satisfied with it so don't copy and paste it to me again or else will have no option than discredit you.
In: Computer Science
2.10-2. Consider the system described by
x(k + 1) = c
0 1
0 3
d x(k) + c
1
1
d u(k)
y(k) = [-2 1]x(k)
(a) Find the transfer function Y(z)/U(z).
(b) Using any similarity transformation, find a different state
model for this system.
(c) Find the transfer function of the system from the transformed
state equations.
(d) Verify that A given and Aw derived in part (b) satisfy the
first three properties of similarity transformations.
The fourth property was verified in part (c).
In: Computer Science
Discuss how you can create an effective website that will attract your customers. Give some features of this website. (Assume that you have a company of your own and state what company is this.)
In: Computer Science
Choose a Topic for a Dissertation in Cyber Security in 2020
Create a 750-word document that includes the following:
In: Computer Science
In: Computer Science
In: Computer Science
Ikea is a values-driven company with a passion for life at home. According to them every product they create is their idea for making home a better place. At the IKEA, they have 389 stores worldwide. Their vision is “To create a better everyday life for many people”. Their business idea is “to offer a wide range of well-designed, functional home furnishing products at prices so low that as many people as possible will be able to afford them”.
Q. Identify 2-3user interface requirements of
IKEA.
3. External Interface Requirements
3.1 User Interfaces
<Describe the logical characteristics of each interface between
the software product and the users. This may include sample screen
images, any GUI standards or product family style guides that are
to be followed, screen layout constraints, standard buttons and
functions (e.g., help) that will appear on every screen, keyboard
shortcuts, error message display standards, and so on. Define the
software components for which a user interface is needed. Details
of the user interface design should be documented in a separate
user interface specification.>
3.2 Hardware Interfaces
<Describe the logical and physical characteristics of each
interface between the software product and the hardware components
of the system. This may include the supported device types, the
nature of the data and control interactions between the software
and the hardware, and communication protocols to be used.>
3.3 Software Interfaces
<Describe the connections between this product and other
specific software components (name and version), including
databases, operating systems, tools, libraries, and integrated
commercial components. Identify the data items or messages coming
into the system and going out and describe the purpose of each.
Describe the services needed and the nature of communications.
Refer to documents that describe detailed application programming
interface protocols. Identify data that will be shared across
software components. If the data sharing mechanism must be
implemented in a specific way (for example, use of a global data
area in a multitasking operating system), specify this as an
implementation constraint.>
3.4 Communications Interfaces
<Describe the requirements associated with any communications
functions required by this product, including e-mail, web browser,
network server communications protocols, electronic forms, and so
on. Define any pertinent message formatting. Identify any
communication standards that will be used, such as FTP or HTTP.
Specify any communication security or encryption issues, data
transfer rates, and synchronization mechanisms.>
In: Computer Science
Which of the following will give you a sum of numbers equal to 15
1. |
s = 0 |
|
2. |
All of the above. |
|
3. |
sum(list((9,5,1))) |
|
4. |
None of the above. |
|
5. |
s = 0 |
In: Computer Science
In: Computer Science