Questions
Please generate code in PYTHON: In the game of Lucky Sevens, the player rolls a pair...

Please generate code in PYTHON:

In the game of Lucky Sevens, the player rolls a pair of dice. If the dots add up to 7, the player wins $4; otherwise, the player loses $1.

Suppose that, to entice the gullible, a casino tells players that there are lots of ways to win: (1, 6), (2, 5), and so on. A little mathematical analysis reveals that there are not enough ways to win to make the game worthwhile; however, because many people’s eyes glaze over at the first mention of mathematics, your challenge is to write a program that demonstrates the futility of playing the game.

Your program should take as input the amount of money that the player wants to put into the pot, and play the game until the pot is empty. At that point, the program should print:

  1. The number of rolls it took to break the player
  2. The maximum amount of money in the pot.

An example of the program input and output is shown below:

How many dollars do you have? 50

You are broke after 220 rolls.
You should have quit after 6 rolls when you had $59

In: Computer Science

The Person Class Uses encapsulation Attributes private String name private Address address Constructors one constructor with...

The Person Class

  • Uses encapsulation
  1. Attributes
    • private String name
    • private Address address
  1. Constructors
    • one constructor with no input parameters
      • since it doesn't receive any input values, you need to use the default values below:
        • name - "John Doe"
        • address - use the default constructor of Address
    • one constructor with all (two) parameters
      • one input parameter for each attribute
  2. Methods
    • public String toString()
      • returns this object as a String, i.e., make each attribute a String, concatenate all strings and return as one String.
      • toString() is a special method, you will learn more about it in the next lessons
        • it needs to be public
        • it needs to have @override notation (on the line above the method itself). Netbeans will suggest you do it.
    • Get and Set methods
      • public int getName()
      • public void setName(String name)
      • public Address getAddress()
      • public void setAddress(Address address)

The Player Class (with updates from the last lab)

  • Player is a Person with some extra attributes
  • Uses encapsulation
  • Player now is an abstract class because it has an abstract method
    • public double getRatings( );
      • an abstract method is an incomplete method that has to be implemented by the subclasses.
  1. Attributes
    • private int number
    • private String sports
    • private gamesPlayed
  1. Constructors
    • one constructor with no input parameters
      • since it doesn't receive any input values, you need to use the default values below:
        • number - 0
        • sports - "none"
        • gamesPlayed - 0
    • one constructor with all (three) parameters
      • one input parameter for each attribute
  2. Methods
    • public String toString()
      • returns this object as a String, i.e., make each attribute a String, concatenate all strings and return as one String.
      • toString() is a special method, you will learn more about it in the next lessons
        • it needs to be public
        • it needs to have @override notation (on the line above the method itself). Netbeans will suggest you do it.
    • Get and Set methods
      • public int getNumber()
      • public void setNumber(int number)
      • public String getSports()
      • public void setSports(String sports)
      • public int getGamesPlayed()
      • public void setGamesPlayed(int gamesPlayed)
    • public abstract getRatings();

The SoccerPlayer Class

  • SoccerPlayer is a Player with some extra attributes
  • Uses encapsulation
  • SoccerPlayer will implement the method getRatings (an abstract method from the superclass Player)
  • toString has to include the result of getRatings() too
  1. Attributes
    • private int goals
    • private int yellowCards
  1. Constructors
    • one constructor with no input parameters
      • since it doesn't receive any input values, you need to use the default values below:
        • goals - 0
        • yellowCards - 0
    • one constructor with all (two) parameters
      • one input parameter for each attribute
  2. Methods
    • public String toString()
      • returns this object as a String, i.e., make each attribute a String, concatenate all strings and return as one String.
      • toString() is a special method, you will learn more about it in the next lessons
        • it needs to be public
        • it needs to have @override notation (on the line above the method itself). Netbeans will suggest you do it.
        • should also include the value of getRatings() in the string
    • Get and Set methods
      • public int getGoals()
      • public void setGoals(int goals)
      • public int getYellowCards()
      • public void setYellowCards(int yellowCards)
    • public double getRatings()
      • calculate and return the rates using this formula:
        • (double) (goals - yellowCards)/gamesPlayed
          • the (double) is called casting, forcing the expression that comes afterwards to become a double.
          • it is necessary to avoid getting 0 as a result because of the precision loss in the division by integers
          • if goals or gamesPlayed is 0, return 0 (you need to do this test to avoid the application crashing in case one of them is 0)

The FootballPlayer Class

  • FootballPlayer is a Player with some extra attributes
  • Uses encapsulation
  • FootballPlayer will implement the method getRatings (an abstract method from the superclass Player)
  • toString has to include the result of getRatings() too
  1. Attributes
    • private int yards
    • private int minutesPlayed
  1. Constructors
    • one constructor with no input parameters
      • since it doesn't receive any input values, you need to use the default values below:
        • yards - 0
        • minutesPlayed - 0
    • one constructor with all (two) parameters
      • one input parameter for each attribute
  2. Methods
    • public String toString()
      • returns this object as a String, i.e., make each attribute a String, concatenate all strings and return as one String.
      • toString() is a special method, you will learn more about it in the next lessons
        • it needs to be public
        • it needs to have @override notation (on the line above the method itself). Netbeans will suggest you do it.
        • should also include the value of getRatings() in the string
    • Get and Set methods
      • public int getYards()
      • public void getYards(int yards)
      • public int getMinutesPlayed()
      • public void setMinutesPlayed(int minutesPlayed)
    • public double getRatings()
      • calculate and return the rates using this formula:
        • (double) ( (yards - minutesPlayed/10.0) ) /gamesPlayed
          • be careful with the parenthesis to avoid getting 0 as a result
          • the (double) is called casting, forcing the expression that comes afterwards to become a double.
            • it is necessary to avoid getting 0 as a result because of the precision loss in the division by integers
          • use 10.0 instead of 10 to force Java to use more precision in the calculation
          • if yards or gamesPlayed is 0, return 0 (you need to do this test to avoid the application crashing in case one of them is 0)

The Address Class

  • Uses encapsulation
  1. Attributes
    • private int number
    • private String name
    • private String type
    • private ZipCode zip
    • private String state
  1. Constructors
    • one constructor with no input parameters
      • since it doesn't receive any input values, you need to use the default values below:
        • number - 0
        • name - "N/A"
        • type - "Unknown"
        • zip - use the default constructor of ZipCode
        • state - " " (two spaces)
    • one constructor with all (five) parameters
      • one input parameter for each attribute
  2. Methods
    • public String toString()
      • returns this object as a String, i.e., make each attribute a String, concatenate all strings and return as one String.
      • toString() is a special method, you will learn more about it in the next lessons
        • it needs to be public
        • it needs to have @override notation (on the line above the method itself). Netbeans will suggest you do it.
    • Get and Set methods
      • public int getNumber()
      • public void setNumber(int number)
      • public String getName()
      • public void setName(String name)
        • this method will receive an input parameter name and will correct if necessary to make its first letter upper case and the remaining part of the word lower case (correcting MAIN to Main, for instance)
        • it will work for at least 2 words (correcting north atherton to North Atherton, for instance)
        • the attribute name will be updated with the corrected value
      • public String getType()
        • this method will return a corrected value depending on the value of the attribute type.
        • it will return "Dr." if the attribute type is "Drive"
        • it will return "Ave." if the attribute type is "Avenue"
        • it will return "St." if the attribute type is "Street"
        • it will return the value of the attribute type for any other cases
      • public void setType(String type)
      • public ZipCode getZip()
      • public void setZip(ZipCode zip)
      • public String getState()
      • public void setState(String state)

The ZipCode Class (updated to include encapsulation)

  • Uses encapsulation
  1. Attributes
    • private String fiveDigit
    • private String plus4
  2. Constructors
    • one constructor with no input parameters
      • since it doesn't receive any input values, you need to use the default values below:
        • private fiveDigit - "00000"
        • private plus4 - "0000"
    • one constructor with one parameter
      • one input parameter for fiveDigit
      • use the default value from the no-parameter constructor to initialize plus4
    • one constructor with all (two) parameters
      • one input parameter for each attribute
  3. Methods (updated to include Get and Set methods)
    • public String toString()
      • returns this object as a String, i.e., make each attribute a String, concatenate all strings and return as one String.
      • toString() is a special method, you will learn more about it in the next lessons
        • it needs to be public
        • it needs to have @override notation (on the line above the method itself). Netbeans will suggest you do it.
      • the toString method will have a similar functionality as App had in the first lab.
        • it returns all the data from each object as a String
          • if the second attribute, plus4, is blank, display only the first attribute fivedigit, for instance, 16801
          • if the second attribute, plus4, is not blank, display only the first attribute fivedigit followed by a "-" and then the plus4 attribute, for instance, 16802-1503
    • Get and Set methods for each of the two attributes
    • display()
      • this method gets the "toString()" value (whatever is returned by toString() ) and uses "System.out.println" to display it.
      • you need to decide what is the type of this method
    • displayPrefix(int p)
      • this method receives an input parameter, an int number p
      • based on p's value
        • if p's value is 1
          • uses "System.out.println" to display the zipcode's prefix, i.e., its 3 first digits.
          • if the fiveDigit is "10022", displays "100"
        • if p's value is2
          • uses "System.out.println" to display the zipcode's area, i.e., its fourth and fifth digits.
          • if the fiveDigit is "10022", displays "22"
        • for any other value of p, it should not display anything

The App class

  1. create a SoccerPlayer object sp0 using the no-parameter constructor
  2. create a SoccerPlayer object sp1 using the all-parameter constructor with the value
    • name "Julia Dohle"
    • address
      • number - 10
      • name - Old Main
      • type - Street
      • zip
        • fiveDigit - 16802
        • plus4 - 0001
      • state - PA
    • number - 7
    • sports - "Soccer"
    • gamesPlayed - 10
    • goals - 5
    • yellowCards - 1
  3. create a FootballPlayer object fp0 using the no-parameter constructor
  4. create a FootballPlayer object fp1 using the all-parameter constructor with the value
    • name "Saquon Barkley"
    • address
      • number - 10
      • name - Old Main
      • type - Street
      • zip
        • fiveDigit - 16802
        • plus4 - 0001
      • state - PA
    • number - 26
    • sports - "Football"
    • gamesPlayed - 10
    • yards - 80
    • minutesPlayed - 220
  5. display all the data from each object using the method toString()

In: Computer Science

TABLE 4 Project Year 0 Year 1 Year 2 Year 3 Year 4 Year 5 Cash...

TABLE 4

Project

Year 0

Year 1

Year 2

Year 3

Year 4

Year 5

Cash Flow

Cash Flow

Cash Flow

Cash Flow

Cash Flow

Cash Flow

A

-15000

6000

7000

6000

6000

6000

B

-15000

7000

7000

7000

7000

7000

C

-18000

12000

2000

2000

2000

2000

  1. "Consider the cash flow of the three projects depicted in Table 4. The cost of capital is 7.5%. If an investor decided to take projects with a payback period of 2 years or less, which of these projects would he take?"

    A) Investment A

    B) Investment B

    C) Investment C

    D) none of these investments

In: Finance

A research laboratory was developing a new compound for the relief of severe cases of hay...

A research laboratory was developing a new compound for the relief of severe cases of hay fever. In an experiment with 36 volunteers, the amounts of the two active ingredients (A & B) in the compound were varied at three levels each. Randomization was used in assigning four volunteers to each of the nine treatments. The data on hours of relief can be found in the following .csv file: Fever.csv State the Null and Alternate Hypothesis for conducting one-way ANOVA for both the variables ‘A’ and ‘B’ individually. 1.2) Perform one-way ANOVA for variable ‘A’ with respect to the variable ‘Relief’. State whether the Null Hypothesis is accepted or rejected based on the ANOVA results. 1.3) Perform one-way ANOVA for variable ‘B’ with respect to the variable ‘Relief’. State whether the Null Hypothesis is accepted or rejected based on the ANOVA results. 1.4) Analyse the effects of one variable on another with the help of an interaction plot. What is an interaction between two treatments? [hint: use the ‘pointplot’ function from the ‘seaborn’ function] 1.5) Perform a two-way ANOVA based on the different ingredients (variable ‘A’ & ‘B’) with the variable 'Relief' and state your results. 1.6) Mention the business implications of performing ANOVA for this particular case study. use python to solve this

1.6) Mention the business implications of performing ANOVA for this particular case study.

A B Volunteer Relief
1 1 1 2.4
1 1 2 2.7
1 1 3 2.3
1 1 4 2.5
1 2 1 4.6
1 2 2 4.2
1 2 3 4.9
1 2 4 4.7
1 3 1 4.8
1 3 2 4.5
1 3 3 4.4
1 3 4 4.6
2 1 1 5.8
2 1 2 5.2
2 1 3 5.5
2 1 4 5.3
2 2 1 8.9
2 2 2 9.1
2 2 3 8.7
2 2 4 9
2 3 1 9.1
2 3 2 9.3
2 3 3 8.7
2 3 4 9.4
3 1 1 6.1
3 1 2 5.7
3 1 3 5.9
3 1 4 6.2
3 2 1 9.9
3 2 2 10.5
3 2 3 10.6
3 2 4 10.1
3 3 1 13.5
3 3 2 13
3 3 3 13.3
3 3 4 13.2

In: Statistics and Probability

Project Year 0 Year 1 Year 2 Year 3 Year 4 A    -$ 49 $ 25...

Project Year 0 Year 1 Year 2 Year 3 Year 4

A    -$ 49 $ 25 $ 22 $ 22 $ 15

B -$ 101 $ 19 $ 39 $ 51 $ 61

a. What are the IRRs of the two​ projects?

b. If your discount rate is 4.8%​, what are the NPVs of the two​ projects?

c. Why do IRR and NPV rank the two projects​ differently?

In: Finance

Java Problem 3: The Snake Box Factory Overview Dear Respectable Software Engineer, Here at the world...

Java Problem 3: The Snake Box Factory

Overview Dear Respectable Software Engineer,

Here at the world renowned Snake Box Factory, we pride ourselves on our ability to deliver the highest quality, custom sized, cardboard boxes to our customers. Our boxes are filled with the highest quality, custom-ordered snakes. We service thousands of accounts worldwide and have a solid 98% satisfaction rating with customers. However, the entire ordering process is currently written on cardboard, which is transported between departments via carrier snake. We thought this would be a good way to show confidence in the quality and usefulness of our product. But as our business continues to grow, we’re realizing this was a bad idea. We believe it’s time for a more conventional and digitized approach to our operations. Would you be able to help us develop the software we need to make this happen?

Sincerely,

President George Johnson, The Snake Box Factory

Tasks:

Read the scenario found in the overview and consider what objects could be modeled as part of creating a software solution. Identify 3 objects from this scenario (remember, objects can be either tangible or abstract. List 3 properties and 3 behaviors belonging to each object.

Write your solution as a document rather than a .java file.

In: Computer Science

In this assignment, you will be writing a 1,000-1,250-word essay describing the differing approaches of nursing...

In this assignment, you will be writing a 1,000-1,250-word essay describing the differing approaches of nursing leaders and managers to issues in practice. To complete this assignment, do the following:

Select an issue from the following list: nursing shortage and nurse turn-over, nurse staffing ratios, unit closures and restructuring, use of contract employees (i.e., registry and travel nurses), continuous quality improvement and patient satisfaction, and magnet designation.

Compare and contrast how you would expect nursing leaders and managers to approach your selected issue. Support your rationale by using the theories, principles, skills, and roles of the leader versus manager described in your readings.

Identify the approach that best fits your personal and professional philosophy of nursing and explain why the approach is suited to your personal leadership style.

Identify a possible funding source that addresses your issue. Consider looking at federal, state, and local organizations. For example: There are many grants available through the CDC, HRSA, etc.

Use at least two references other than your text and those provided in the course.

Prepare this assignment according to the APA guidelines found in the APA Style Guide, located in the Student Success Center. An abstract is not required.

This assignment uses a rubric. Please review the rubric prior to beginning the assignment to become familiar with the expectations for successful completion.

You are required to submit this assignment to Tu

In: Nursing

Find a web-based system with simple functions that you are familiar with, use natural language to describe the customer’s requirements.

Experiment 1

Find a web-based system with simple functions that you are familiar with, use natural language to describe the customer’s requirements.

User requirements are statements, in natural language plus diagrams, of the services the system provides and its operational constraints. They are written for customers. Requirements elicitation, sometimes called requirements discovery, involves technical staff working with customers to find out about the application domain, the services that the system should provide and the system’s operational constraints. Interviewing and Ethnography are two approaches to requirements elicitation. But People find it easier to relate to real-life examples than abstract descriptions. Scenarios and user stories are real-life examples of how a system can be used. They are a description of how a system may be used for a particular task. Because they are based on a practical situation, stakeholders can relate to them and can comment on their situation with respect to the story. As an example of a scenario, the following figure describes what happens when a student uploads photos to the KidsTakePics system.



In this experiment, you need to describe the five most important user requirements in the system. The format of your requirements description is as follows:

Experiment 1

URL of your selected web-based system:

xxx

User requirement 1:xxx (name of this requirement)

Descriptions:

xxx xxx

User requirement 2:xxx (name of this requirement)

Descriptions:

xxx xxx

……

User requirement 5:xxx (name of this requirement)

Descriptions:

xxx xxx

In: Computer Science

{Exercise 4.19 (Algorithmic)} The National Sporting Goods Association conducted a survey of persons 7 years of...

{Exercise 4.19 (Algorithmic)} The National Sporting Goods Association conducted a survey of persons 7 years of age or older about participation in sports activities (Statistical Abstract of the United States: 2002). The total population in this age group was reported at 248.5 million, with 120.9 million male and 127.6 million female. The number of participants for the top five sports activities appears here. Participants (millions)             Activity                                     Male                                     Female             Bicycle riding                                     20.7                                     22.5             Camping                                     24.1                                     25.8             Exercise walking                                     30.2                                     59.2             Exercising with equipment                                           18.9                                     25.9             Swimming                                     24.9                                     32.9                                     For a randomly selected female, estimate the probability of participation in each of the sports activities (to 2 decimals). Note that the probabilities do not sum to 1 because of participation in more than one sports activity. Bicycle riding Camping Exercise walking Exercising with equipment Swimming For a randomly selected male, estimate the probability of participation in each of the sports activities (to 2 decimals). Note that the probabilities do not sum to 1 because of participation in more than one sports activity. Bicycle riding Camping Exercise walking Exercising with equipment Swimming For a randomly selected person, what is the probability the person participates in exercise walking (to 2 decimals)? Suppose you just happen to see an exercise walker going by. What is the probability the walker is a woman (to 2 decimals)? What is the probability the walker is a man (to 2 decimals)?

In: Statistics and Probability

After thoroughly reading this article: “Deater-Deckard, K., Dodge, K. A., Bates, J. E., & Pettit, G....

After thoroughly reading this article: “Deater-Deckard, K., Dodge, K. A., Bates, J. E., & Pettit, G. S. (1996). Physical discipline among African American and European American mothers: Links to children's externalizing behaviors. Developmental Psychology, 32, 1065-1072.”

Please, identify and critique the following:

The research design

The sampling technique

The threats to validity

The measurements

The ethical issues

Abstract

The aim of this study was to test whether the relation between physical discipline and child aggression was moderated by ethnic-group status. A sample of 466 European American and 100 African American children from a broad range of socioeconomic levels were followed from kindergarten through 3rd grade. Mothers reported their use of physical discipline in interviews and questionnaires, and mothers, teachers, and peers rated children's externalizing problems annually. The interaction between ethnic status and discipline was significant for teacher- and peer-rated externalizing scores; physical discipline was associated with higher externalizing scores, but only among European American children. These findings provide evidence that the link between physical punishment and child aggression may be culturally specific. (PsycINFO Database Record (c) 2016 APA, all rights reserved)

Link; http://www.thecampuscommon.com/library/ezproxy/ticketdemocs.asp?sch=auo&turl=http://search.proquest.com/docview/218060199

In: Statistics and Probability