1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
zhenek [66]
3 years ago
14

/* Function findBestVacation * duration: number of vacation days * prefs: prefs[k] indicates the rate specified for game k * pla

n: array with 366 positions with the sequence of games * to be played over the year. In other words, * plan[k] indicates the game planned for day k (1

Engineering
1 answer:
alexira [117]3 years ago
3 0

Answer:

This is the C++ code for the above problem:

#include<bits/stdc++.h>

using namespace std;

int computeFunLevel(int start, int duration, int prefs[], int ngames, int plan[]) {

if(start + duration > 365) { //this is to check wether duration is more than total no. of vaccation days

return -1;

}

int funLevel = 0;

for(int i=start; i<start+duration; i++) { //this loop runs from starting point till

//start + duration to sum all the funlevel in plan.

funLevel = funLevel + prefs[plan[i]];

}

return funLevel;

}

int findBestVacation(int duration, int prefs[], int ngames, int plan[]) {

int max = 0, index = 0, sum = 0 ;

for(int i=1; i<11; i++){ //this loop is to run through whole plan arry

sum = 0; //sum is initialized with zero for every call in plan ,

//in this case loop should run to 366,but for example it is 11

//as my size of plan array is 11

for(int j=0; j<duration; j++) { // this loop is for that index to index+duration to calc

//fun from that index

sum = sum + prefs[plan[i]];

}

if(sum>max) { //this is to check max funlevel and update the index from which max fun can be achieved

max = sum;

index = i;

}

}

return index;

}

int main() {

int ngames = 5;

int prefs[] = { 1,2,0,5,2 };

int plan[] = { 0,2,0,3,3,4,0,1,2,3,3 };

int start = 1;

int duration = 4;

cout << computeFunLevel(start, duration, prefs, ngames, plan) << endl;

cout << computeFunLevel(start, 555, prefs, ngames, plan) << endl;

cout << findBestVacation(4, prefs, ngames, plan) << endl;

}

The screen of the program is given below.

You might be interested in
What are the factors of production in business? Land, labor, and capital land, capital, and interest land, labor, and customer b
kozerog [31]

Answer:

  • <em><u> Land, labor, and capital </u></em>

Explanation:

The <em>factors of production </em>are the resources that are used to produce goods and services.

By definition resources are scarce.

<em>Land</em> includes everything that comes from the land, that can be used as raw material to produce other materials; for instance, water, minerals, wood.

<em>Labor</em>  is the work done by anybody, not just at a factory but at any enterpise that produce a good or a service. For instance, the work done by a person in a bank or a restaurant.

<em>Capital</em> is the facilites (buildings), machinery, equipments, tools that the persons use to produce goods or services. For instance, a computer, a chemical reactor, or a pencil.

Nowadays, also entrepreneurship is included as a <em>factor of production</em>, since it is the innovative skill of the entrepeneurs to combine land, labor and capital what permit the production of good and services.

6 0
4 years ago
Read 2 more answers
What are the two main what are the two main concerns in the research of fluid power efficiency?
Galina-37 [17]

Answer:

The correct option is;

Materials and Components

Explanation:

The efficiency of fluid power is influenced by the components and the materials used to deliver the power of the fluid as such fluid power control are focused on

1) Advances in fluid power

2) Making use of the advantages

3) Making use of the other externally available technological advantages

4) Giving allowance for disadvantages

Areas of interest in advances in fluid power are;

a. Computer optimized flow

b. The use of new and improved materials/coatings

c. The use of components that save energy, such as intelligent supply pressure adapting systems

3 0
3 years ago
Read 2 more answers
Air flows from a large reservoir in which the pressure and temperature are 1 MPa and 30°C, respectively, through a convergent–di
SSSSS [86.1K]

Answer:

The solution is attached in the attachment.

3 0
3 years ago
Read 2 more answers
The minimum requirements for engineering documents are enumerated in
vladimir1956 [14]

Answer:

The answer will be Rule 61G15-23 F.A.C, relating to Seals.

Explanation:

According to the description given by: Florida administrative code&Florida administrative register the Minimum requirements for engineering documents are in the section 'Final 61G15-23'  from 11/3/2015. This document provides specifications of materials required for the safe operation of the system that is the result of engineering calculations, knowledge and experience.

8 0
3 years ago
A data record of all of someone's online activity is called a
aev [14]

Answer:

The answer is computer cookies.

Explanation:

Smartness :D

4 0
3 years ago
Read 2 more answers
Other questions:
  • A 5 MW gas turbine power plant is reported to have a thermodynamic efficiency of 35%. Assume products of the combustion reaction
    5·1 answer
  • For a steel alloy it has been determined that a carburizing heat treatment of 11-h duration will raise the carbon concentration
    12·1 answer
  • When -iron is subjected to an atmosphere of hydrogen gas, the concentration of hydrogen in the iron, CH (in weight percent), is
    5·1 answer
  • The chart shows the bids provided by four engineers to test a prototype.
    6·1 answer
  • Which of the following are made up of electrical probes and connectors?
    8·1 answer
  • A moving-coil instrument, which gives full-scale deflection with 0.015 A has a copper coil having resistance of 1.5 Ohm at 15°C
    7·1 answer
  • PLEASE HELP WITH THIS ASAP! Thanks
    6·1 answer
  • The Eads Bridge, which crosses the Mississippi River near St Louis, Missouri, was one of the first all steel bridges built in th
    8·1 answer
  • ILL GIVE BRAINLIEST!!!
    11·1 answer
  • What is the purpose of placing a large electrolytic capacitor in the output side of a power supply
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!