Question: C++ code only! Objective: In this assignment, you will familiarize with C++ primitive types, raw arrays, and functions. Additionally, you will have to analyze the

C++ code only!

Objective: In this assignment, you will familiarize with C++ primitive types, raw arrays, and functions. Additionally, you will have to analyze the runtime of your design. You are provided with the signatures for multiple functions. Your task is to complete the functions and solve the appropriate task

Required: bool neighborhoodIsViable () This function should take in the customer data and return true if you will break even or profit, or return false if there will be a loss. All input values are positive numbers (aside from chosenCust data). If you will return true, values should be set in chosenCust representing a set of customers making this true.

numCust: number of customers

maxBandwidth: maximum amount of bandwidth you can support (positive number) ***When selecting customers, the total bandwidth requested by the customers should be less than or equal to this maximum***.

C++ code only! Objective: In this assignment, you will familiarize with C++

#include using namespace std;

bool neighborhoodIsViable(const int& numCust, const int& maxBandwidth, const int& maintenanceCost, const int* const reqBand, const int* const reqPrice, bool* const chosenCust) {

return false; }

int main() { ////////////////////////////////////////////// // Change these values to get a new test case. int numCust = 5; int maxBandwidth = 150; int maintenanceCost = 100; int reqBand[] = {30, 40, 150, 20, 60}; int reqPrice[] = {40, 60, 100, 20, 70}; bool chosenCust[5]; double partialCust[5]; ////////////////////////////////////////////// // Check if neighboorhood is viable. bool isViable = neighborhoodIsViable(numCust, maxBandwidth, maintenanceCost, reqBand, reqPrice, chosenCust); int bandwidthUsed = 0; int moneyCharged = 0; if(isViable) { cout maintenanceCost: cost to run network in this neighborhood (positive number) u You are looking to see if you have customers you can support within your bandwidth limit who will pay greater than or equal to your maintenance cost. reqBand: array of size numCust. o reqBand is the bandwidth customer i wants (positive number). reqPrice: array of size numCust. o reqPrice[i] is the price customer i wants (positive number). chosen Cust: array of size numCust. o The values selected to be true in chosenCust should give a total amount of bandwidth less than or equal to max bandwidth. The values selected to be true in chosenCust should give a total amount ofprice that is greater than or equal to maintenance costs (you do not need to provide the best subset, simply a subset that profits/breaks even). Return value. return true if some subset of customers can allow you to break even or make a profit. o Update the values in chosencust to reflect a subset of customers to offer service. For example, if you chose to offer Customer 0 to have service, Customer 1 to have service, and Customer 2 to have no service, then the values would be chosen Cust[0] true chosen Cust[1] true chosen Cust[2] false return false if no subset of customers can make a profit

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!