Write a function called dicegame that takes in a vector

Assignment Help Basic Computer Science
Reference no: EM13308240

You are playing a game where you roll a die 6 times. If you roll a 5 or 6 four or more times, you win 4 dollars, two or three times,you win 2 dollar, and if you roll a 5 or 6 one or less times, you win no money. Write a function called diceGame that takes in a vector representing the dice values and returns the amount of money won.
For example:
diceGame([5 1 4 6 5 5]) should return 4
Test your program for the following three cases:
diceGame([2 4 1 3 6 6])
diceGame([1 4 3 2 5 3])
Note: This function should work for any length vector.

Reference no: EM13308240

Questions Cloud

Estimate the maximum aggregate i/o transfer rate : A 32-bit computer has two selector channels and one multiplexor channel. Each selector channels supports two magnetic disk and two magnetic tape units. The multiplexor channel has two line printers, two card readers, and 10 VDT terminals connected..
Calculate the absolute viscosity of the oil in a large tank : A 6-inch diameter steel sphere (sg = 8.0) is released in a large tank of oil (sg = 0.86). The terminal velocity of the sphere is measured at 13.5 ft/s. Calculate the absolute viscosity of the oil.
Calculate each atmospheric condition and note the trend : Find the change in volume of 16.15 lb of water at ordinary atmospheric pressure for three conditions: Calculate each condition and note the trend.
Effective internal marketing programme to an organisation : Assignment TaskThis is an individual assignment. Complete the following in report format (2500words).Outline and explain the concept of internal marketingand why it is important in service products. How wouldyou introduce an effective internal market..
Write a function called dicegame that takes in a vector : Write a function called diceGame that takes in a vector representing the dice values and returns the amount of money won.
Find which energy is greater : A 1.0E-6 F capacitor has a charge of 10.0 microC. It is connected to a 1.0 H inductor at t=0. Which energy is greater
Why is it considered to be problematic : Suppose, during the last year, in a closed economy (net exports=0), consumption expenditures were $20 billion, investment was $12 billion, government purchases were $20 billion, and the underground economy produced $10 billion worth of goods and serv..
What will be gage reading if atmospheric pressure increases : a bourdon pressure gauge attached to the outside of a tank containing air reads 77.0 psi when the local atmospheric pressure is 760 mm Hg. what will be the gage reading if the atmospheric pressure increases to 773 mm Hg
What is the average drift speed : Consider a 4.7mm-diameter wire made from copper (mass density of 8.9 g/cc). THe wire is carrying a current of 8milliamp. What is the average drift speed

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Find max score and display

Write a program using functions to do the following tasks.

  Advantages and disadvantages of asymmetric or symmetric key

The Institute has collaborated with XYZ inc. for research on genetics. Information should be kept top secret at any cost. At ABC Institute, researchers are not sure about kind of key.

  Clash of atoms and reactions generated in brains

Do you think that Hobbes was on to something with his theory? Is there joy or fear out there, or is it all inside of us and how we perceive and react to a situation?

  Kind of information monitor check to see if it sanitize

Which kind of information should the monitor check to see if it must sanitize the data to conceal the names of the users and the names and addresses of the computers involved?

  Solving problem by permutation on set is a one-to-one

Prove that PERM=POWER P, the obvious algorithm doesn't run in polynomial time as problem size is logarithmic (and no linear) with respect to the value of t.

  How do we implement the posix api

how do we implement the POSIX API

  Comparing accuracies using test options

Compare the accuracies obtained using the three "test options": "Use training set", "cross-validation" and "percentage split".

  Write algorithm to save few new phone numbers

write algorithm to save few new phone numbers in the address book of cell phone. algorithm should work even if there's only one new phone number or several new phone numbers to save. ke sure to handle the scene if the address book is full.

  Continue to keep a journal

Continue to keep a journal of your activities and experience of using SAP. Include a copy of your full journal as an appendix to the reflective essay.

  List and describe three guidelines for sound policy

List and describe briefly the three guidelines for sound policy, as stated by Bergeron and Bérubé. Are policies different from standards? In what way? Are policies different from procedures? In what way?

  What is an object lock and which object have locks

What is an object's lock and which object's have locks?

  Compare computerized process to manual process

ompare a computerized process to manual process. Write differences and the advantages and disadvantages of the computerized systems.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd