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 19:10
Aplate of dimensions 3 m x 3 m is placed 0.37 mm apart from a fixed plate. the plate requires a force of 2n to move at speed of 45 cm/s. evaluate the viscosity of the fluid in between the plates
Answers: 3
question
Engineering, 06.07.2019 03:10
Steel balls 12 mm in diameter are annealed by heating to 1150 k and then slowly cooled to 400 k in an air att 325 k and h -20 w/m2 k. assume the properties of the steel to be k- 40 w/m k,p 7800 kg/m3, and cp 600 j/kg k. a. determine whether lumped system method can be used to analyze this problem and if so why" b. determine the time required for the cooling process. c. determine the total amount of heat lost from each ball to the ambient air
Answers: 1
question
Engineering, 06.07.2019 03:10
Air is flows through an adiabatic nozzle with an inlet pressure of 400 psia at a temperature of 300°f and a velocity of 20 ft/s. the outlet pressure is 40 psia and the velocity is 800 ftl/s. determine the outlet temperature of the air using: a) property tables b) specific heat (using the specific heat value for air at 300°f)
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
English, 27.06.2019 11:30