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

  Recognize the types of each variable as nominal and ordinal

Suppose you are working on data analysis project about laptop computers. Each computer is explained by following variables. Recognize the types of each variable as nominal, ordinal, interval or ratio.

  Plan for processing the potential crime incident scene

Describe your plan for processing the potential crime/incident scene. Some of the items you will want to cover include

  What would the data dictionary

what would the data dictionary look like for question 5a pg. 88

  Differences between technical and technology skills

Describe in scholarly detail differences between technical and technology skills as they associate to telecommunications and how they relate to general expectations

  Find speedup gain of using simd computer over sisd computer

If both SISD and SIMD machines run at same clock speed, determine the speedup gain of using the SIMD computer over the SISD computer?

  Diagnos application which has changed from original state

How does third-party plug-ins change process of diagnosing and troubleshooting errors within application? What steps would you take in diagnosing the application which has been changed from its original state?

  Business reprocess engineering-strategic information system

Some people may say that Business Reprocess Engineering (BPR) is special case of strategic information system, whereas, others may say opposite is true. Describe this statement in scholarly detail.

  Design a case structure that tests the month variable

Design a case structure that tests the month variable and does the following

  Determine slas are necessary and identify monitoring points

Determine if internal service-level agreements (SLAs) are necessary, and identify the monitoring points and levels for an SLA

  Using sequential logic, counters and shift registers propose

using sequential logic, counters and shift registers propose a more complex system utilizing some of the more complex sub systems. example a motion acitavated light. Needs to be somthing other then a light example like motors or somthing

  Why the sdlc is adequate to develop any system

Why the SDLC is adequate to develop any system. Explain by giving at least two examples of systems, such as client-management systems and decision-support systems.

  Techniques attacker use to access information on system

Recognize all potential security threats on home personal computer. Recognize some of techniques the attacker might use to access some information on system.

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