Questions
For C++ Use arrays and or vectors, no classes. Visualize and consider 100 lockers all lined...

For C++ Use arrays and or vectors, no classes.

Visualize and consider 100 lockers all lined up horizontally in a row
Each locker is numbered from 1 to 100 in sequential order

Every locker can be fully closed (open state = 0.00)
Every locker can be fully opened (open = 1.00)
Every locker can be partially open with any possible value between 0.00 and 1.00 inclusive on both ends
A locker cannot ever be more closed than fully closed (open cannot be less than 0.00)
A locker cannot ever be more open than fully opened (open cannot be greater than 1.00)

All 100 lockers start in the fully closed state
100 students will be walking by the lockers and opening/closing them in the following manner:

The 1st student will OPEN EVERY LOCKER       1/2 of the way (ADD 0.50 TO LOCKERS 1,2,3,4...)

The 2nd student will CLOSE EVERY SECOND LOCKER 1/3 of the way (SUBTRACT 0.333333333333 FROM LOCKERS 2,4,6,8...)

The 3rd student will OPEN EVERY THIRD LOCKER   1/4 of the way (ADD 0.25 TO LOCKERS 3,6,9,12...)

The 4th student will CLOSE EVERY FOURTH LOCKER 1/5 of the way (SUBTRACT 0.20 FROM LOCKERS 4,8,12,16...)

The 5th student will OPEN EVERY FIFTH LOCKER   1/6 of the way (ADD 0.166666666666 TO LOCKERS 5,10,15,20...)

The 6th student will CLOSE EVERY SIXTH LOCKER 1/7 of the way (SUBTRACT 0.142857142857 FROM LOCKERS 6,12,18,24...)

The 99th student will OPEN EVERY 99TH LOCKER   1/100 of the way (ADD 0.01 TO LOCKER 99)

The 100th student will CLOSE EVERY 100TH LOCKER 1/101 of the way (SUBTRACT 0.009900990099 FROM LOCKER 100)

NOTE: Remember that the locker open state must always stay within 0.00 <= value <= 1.00

1) Develop C++ code that will generate the open state values for all 100 lockers

2) Also develop C++ code that will output answers to the following questions:

Which lockers are left fully closed (open state == 0.00)?

Which lockers are left fully open (open state == 1.00)?

Which locker is the one opened the least and what is its value (open state closest to 0.00)?

Which locker is the one closed the least and what is its value (open state closest to 1.00)?

In: Computer Science

Construct two small C programs, compile and set up two executable files for the two commands...

Construct two small C programs, compile and set up two executable files for the two commands world and mars. Both commands simply print out messages on the screen:

world n - print the message hello world on the screen n times

mars n - print the message HELLO MARS on the screen n times

Thanks a lot for your help!!!

In: Computer Science

When creating the Academic Database, there were several instances of data validation. Data types were assigned...

When creating the Academic Database, there were several instances of data validation. Data types were assigned to each field in the table to stop undesirable values from being placed into certain fields. A presence check was used on fields that were listed as NOT NULL, requiring some data to be input. Uniqueness validation was automatically assigned for fields that were primary keys. Describe at least one field in the Academic Database a table where range validation could have been used and describe at least one field in the Academic Database where choice validation could have been used. Your answer should be addressed in 100 to 150 words.

In: Computer Science

OpenGL problem Draw the entire scene composed with more than 5 objects. Scene should Include rigid...

OpenGL problem

Draw the entire scene composed with more than 5 objects. Scene should Include rigid transformations such as scale, rotate, translate, etc.

And please write down the code of the application program.cpp file (files containing main, render, etc). Also, show the picture of captured result screen.

you should give 1. code of the application program.cpp, 2. picture of captured result screen(entire scene). Please don't give incomplete answer.

In: Computer Science

suppose i have a list in python that is [hello,yo,great,this,cool,fam] how do I get all the...

suppose i have a list in python that is [hello,yo,great,this,cool,fam]

how do I get all the possible 2 combination that I can have from this list in tuples for example output

[ {hello,hello},{hello,yo},{hello,great},....... {yo,hello},{yo,yo} and so on and son}

no packages allowed

In: Computer Science

5.25. The following pseudocode (next page) is a correct implementation of the producer/consumer problem with a...

5.25. The following pseudocode (next page) is a correct implementation of the producer/consumer problem with a bounded buffer:

Labels p1, p2, p3 and c1, c2, c3 refer to the lines of code shown above (p2 and c2 each cover three lines of code). Semaphores empty and full are linear semaphores that can take unbounded negative and positive values. There are multiple producer processes, referred to as Pa, Pb, Pc, etc., and multiple consumer processes, referred to as Ca, Cb, Cc, etc. Each semaphore maintains a FIFO (first-in-first-out) queue of blocked processes. In the scheduling chart below, each line represents the state of the buffer and semaphores after the scheduled execution has occurred. To simplify, we assume that scheduling is such that processes are never interrupted while executing a given portion of code p1, or p2, . . . , or c3. Your task is to complete the following chart.

item[3] buffer; // initially empty

semaphore empty; // initialized to +3

semaphore full; // initialized to 0

binary_semaphore mutex; // initialized to 1

void producer()

void consumer()

{

{

   ...

   ...

   while (true) {

   while (true) {

       item = produce();

c1:     wait(full);

p1:   wait(empty);

 /    wait(mutex);

 /         wait(mutex);

c2:     item = take();

p2:   append(item);

 \    signal(mutex);

 \      signal(mutex);

c3:     signal(empty);

p3:   signal(full);

         consume(item);

   }

   }

}

}

Scheduled Step of Execution

full’s State and Queue

Buffer

empty’s State and Queue

Initialization

full=0full=0

OOO

empty=+3empty= +3

Ca executes c1

full=−1full= −1 (Ca)

OOO

empty=+3empty= +3

Cb executes c1

full=−2full= −2 (Ca, Cb)

OOO

empty=+3empty= +3

Pa executes p1

full=−2full= −2 (Ca, Cb)

OOO

empty=+2empty= +2

Pa executes p2

full=−2full= −2 (Ca, Cb)

X   OO

empty=+2empty= +2

Pa executes p3

full=−1full= −1 (Cb) Ca

X   OO

empty=+2empty= +2

Ca executes c2

full=−1full= −1 (Cb)

OOO

empty=+2empty= +2

Ca executes c3

full=−1full= −1 (Cb)

OOO

empty=+3empty= +3

Pb executes p1

full= full=

empty= empty=

Pa executes p1

full= full=

empty= empty=

Pa executes __

full= full=

empty= empty=

Pb executes __

full= full=

empty= empty=

Pb executes __

full= full=

empty= empty=

Pc executes p1

full= full=

empty= empty=

Cb executes __

full= full=

empty= empty=

Pc executes __

full= full=

empty= empty=

Cb executes __

full= full=

empty= empty=

Pa executes __

full= full=

empty= empty=

Pb executes p1-p3

full= full=

empty= empty=

Pc executes __

full= full=

empty= empty=

Pa executes p1

full= full=

empty= empty=

Pd executes p1

full= full=

empty= empty=

Ca executes c1-c3

full= full=

empty= empty=

Pa executes __

full= full=

empty= empty=

Cc executes c1-c2

full= full=

empty= empty=

Pa executes __

full= full=

empty= empty=

Cc executes c3

full= full=

empty= empty=

Pd executes p2-p3

full= full=

empty=

In: Computer Science

You’ve implemented the Academic Database in a local school in your community. The school’s administrator decides,...

  1. You’ve implemented the Academic Database in a local school in your community. The school’s administrator decides, there’s no need for database backup and recovery plan because all their computers are new. Explain in 100 to 150 words why there needs to be a disaster recovery plan.

In: Computer Science

Scenario:             Startup company established on 01/01/20XX has 12 people personnel of which one executive director,...

Scenario:

            Startup company established on 01/01/20XX has 12 people personnel of which one executive director, one CIO one manager of software one manager of hardware one CFO and 5 engineers and one secretary, which plays role of public relations as well apart from day to day data management duties.

            The company develops hardware and software for resolvers which sells on larger companies. Some of the contracts include the company to be supplier of a larger company which has government contracts.

            The company exploits one central server with 100 nodes, shared storage, shared data space similar to DropBox, shared scanner and 10 printers.

            All workstations were placed in cubicles in main room and the secretary desk and workstation along with 2 printers was set up at main entrance hallway.

Q1. On March 10/20XX the new server was delivered and mangers along with CIO and executive director made a meeting to establish a policy of use of the resource. It was decided that:

  • All engineers’ personnel and CIO will have access to all files 365/24 remotely and from their office workstations.
  • The CFO will have access only to data dealing with matherials for current month.
  • The Executive director will have access only to CIO reports and CFO reports but not data on projects.
  • Secretary will have all access to all documents and data all the time.

Do you think this set up have security risks? Describe these risks if any and propose a better solution and describe why your solution is better.   

In: Computer Science

C++ give some examples of where you could use the stream manipulators to format output.

C++ give some examples of where you could use the stream manipulators to format output.

In: Computer Science

Demonstrate, with a program, if this is true or false :Scope is the portion of a...

Demonstrate, with a program, if this is true or false

:Scope is the portion of a program that can refer to an entity by its simple name

In: Computer Science

I need the following code completed: #include <iostream> #include <time.h> #include "CSVparser.hpp" using namespace std; //============================================================================...

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...

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.

  1. Give the context level diagram for the “Moving Company System”.
  2. Give Diagram 0. IMPORTANT: in your diagram 0, you are required to have a process named “Manage Virtual Tours” that includes all tasks summarized in the underlined paragraph (see description above). Other processes need also to be included in Diagram 0.
  3. Give the child diagram of the process “Manage Virtual Tours” mentioned in the previous question. IMPORTANT: All processes included in this child diagram should be primitive.

In: Computer Science

What is the difference between Green IT and Green IS? Discuss TWO recent advancements in development...

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...

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...

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