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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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