subject
Engineering, 14.11.2019 19:31 hindjssnsk

You are playing a game where you roll a fair dice 7 times. we set the sum of maximum value and minimum value as s. if s is 2, 5, or 12, you win 3 times s dollars; that is respectively 6,15, or 36. if s is 7 or 11, you win 2 times s dollars; that is respectively 14 or 22. if s is anything else, you win no money. write a function, called dicegame, which takes in a vector representing the dice values and returns the amount of money won.

for example: m = dicegame([1 2 3 4 5 6 1]) should return m = 14

m = dicegame([[1 1 1 1 1 1 1]]) should return m = 6

m = dicegame([2 1 2 2 5 1 5]) should return m = 0

test your program for the following three cases:

m = dicegame([5 1 2 3 4 6 6])

m = dicegame([6 6 6 3 4 2 5])

ansver
Answers: 3

Another question on Engineering

question
Engineering, 03.07.2019 14:10
Amass of 1.5 kg of air at 120 kpa and 24°c is contained in a gas-tight, frictionless piston-cylinder device. the air is now compressed to a final pressure of 720 kpa. during the process, heat is transferred from the air such that the temperature inside the cylinder remains constant. calculate the boundary work input during this process.
Answers: 2
question
Engineering, 04.07.2019 18:20
Avolume of 2.65 m3 of air in a rigid, insulated container fitted with a paddle wheel is initially at 264 k, 5.6 bar. the air receives 432 kj by work from the paddle wheel. assuming the ideal gas model with cv = 0.71 kj/kg • k, determine for the air the amount of entropy produced, in kj/k
Answers: 2
question
Engineering, 04.07.2019 18:20
Asimple rankine cycle uses water as the working fluid. the water enters the turbine at 10 mpa and 480c while the condenser operates at 6 kpa. if the turbine has an isentropic efficiency of 80 percent while the pump has an isentropic efficiency of 70 percent determine the thermal efficiency
Answers: 1
question
Engineering, 04.07.2019 19:10
Apressure vessel with an r/t 20 cannot be treated as thin walled vessel. a)-trune b)- false
Answers: 3
You know the right answer?
You are playing a game where you roll a fair dice 7 times. we set the sum of maximum value and minim...
Questions
question
Mathematics, 28.01.2020 05:31
Questions on the website: 13722362