USE PYTHON ONLY
Please write a Python program to let you or the user play the game of rolling a dice and winning/losing money. Initially, you have 100 dollars in your account. You place a bet to roll the dice. The game will be stopped if your bet is zero. First, dealer would roll the dice and get a number from random.randint(1, 6). Then, you would roll the dice and get a number from random.randint(1, 6). Now, compare your number with dealer’s number to see whether you won or lose the bet. If you lose, the bet would be deducted from your account. If you won, the bet would be added to your account. If it’s a tie, your account is not touched. Then, continue the game of putting your bet until your bet is zero. The game is to continue even when you have zero or negative amount of money. You must test your game program 3 times with at least 10 rounds for each game. The output of your test case #1 may like as follows: Welcome to the Rolling Dice Game of TM
1 =============================================. Now, you have 100 dollars to play the game.
2 =============================================. Enter your bet to roll the dice (enter 0 to quit): 10 Dealer got 1 , and you got 5 . You won 10 dollars. Now, you have 110 dollars.
3 =============================================. Enter your bet to roll the dice (enter 0 to quit): 5 Dealer got 5 , and you got 3 . You lost 5 dollars. Now, you have 105 dollars.
4 =============================================. Enter your bet to roll the dice (enter 0 to quit): 30 Dealer got 3 , and you got 3 . It's a tie. Now, you have 105 dollars.
5 =============================================. Enter your bet to roll the dice (enter 0 to quit): 200 Dealer got 3 , and you got 4 . You won 200 dollars. Now, you have 305 dollars.
6 =============================================. Enter your bet to roll the dice (enter 0 to quit): 100 Dealer got 4 , and you got 1 . You lost 100 dollars. Now, you have 205 dollars.
7 =============================================. Enter your bet to roll the dice (enter 0 to quit): 205 Dealer got 2 , and you got 6 . You won 205 dollars. Now, you have 410 dollars.
8 =============================================. Enter your bet to roll the dice (enter 0 to quit): 400 Dealer got 3 , and you got 6 . You won 400 dollars. Now, you have 810 dollars.
9 =============================================. Enter your bet to roll the dice (enter 0 to quit): 500 Dealer got 4 , and you got 1 . You lost 500 dollars. Now, you have 310 dollars.
10 =============================================. Enter your bet to roll the dice (enter 0 to quit): 310 Dealer got 6 , and you got 2 . You lost 310 dollars. Now, you have 0 dollars.
11 =============================================. Enter your bet to roll the dice (enter 0 to quit): 10 Dealer got 3 , and you got 6 . You won 10 dollars. Now, you have 10 dollars.
12 =============================================. Enter your bet to roll the dice (enter 0 to quit): 40 Dealer got 3 , and you got 1 . You lost 40 dollars. Now, you have -30 dollars.
13 =============================================. Enter your bet to roll the dice (enter 0 to quit): 0
14 =============================================. Thank you for playing the Rolling Dice Game of TM
15 =============================================.
In: Computer Science
Exercise goals: Be able to solve the profit maximization problem
of a monopolist with third-degree price discrimination.
Understand the differences between 3DPD and single-pricing. You own
a monopoly that produces cars to be sold in two countries:
Freedonia and Sylvania. Demand for cars in Freedonia is given by PF
= 16,000-20QF, while demand in Sylvania is given by
PS = 20, 000 - 10QS. You own a single plant in Sylvania
that produces cars for both countries. Your cost function is C (Q)
= 8, 000Q, where Q = QF + QS.
1. (1 point) Initially, these two countries have a peaceful
relationship, and free trade exists between them, therefore you can
only charge a single price between the two countries. What price do
you set? How much profit do you collect? [Hint: it may be easier to
solve this maximization problem in terms of P. To do so, you can
first obtain the demand functions (i.e. Q(P) = . . .), and then
write the cost function in terms of P using the demand
functions]
2. (1 point) How much consumer surplus is generated in each country?
3. (1 points) The Freedonian government finds out that Sylvania
is secretly plotting to invade Freedonia. This discovery leads to
an interruption in free trade between the two countries. That’s
good news for you: it means you can now sell cars in Freedonia at a
different price than in Sylvania. However, in order to do so, you
have to build a factory in Freedonia as well. Suppose that you can
build a factory for free (the Freedonian government is giving you a
generous handout because they like your cars). The plants are
identical, so you have the same cost function in both countries (C
(Q) = 8, 000Q). What prices do you set? How much profit do you
collect?
4. (1 point) How much consumer surplus is generated for each
country in this new scenario? Comment on whether you think 3DPD is
good or bad for society as a whole (i.e. Freedonia + Sylvania) in
this case.
5. (1 point) Suppose that the cost of building a factory is
300,000. Does it make sense for the Freedonian government to
subsidize the plant? Why or why not? [When answering this question,
assume that the Freedonian government only cares about the
well-being of its citizens]
In: Economics
You are camping in a tent, you have some very hot water (700C) in a water bladder, but you realize that in fact you do not have enough drinking water. Your plan is to melt the block of ice you have seen in front of your tent using the boiling water you have and then treat the entire quantity. You estimate that the ice block has about 1 kg and is at a temperature of about -200C. How much water do you need to melt the ice and rise its temperature to 50C?
In: Physics
As a recently hired MBA intern, you are working in a consulting capacity to provide an analysis for Al Dente's Italian Restaurant. A financial income Statement is presented below: Sales $2,698,000 Cost of sales (all variable) $1,557,563 Gross Margin $1,140,438 Operating expenses: Variable $277,975 Fixed $213,675 Total operating expenses: $491,650 Administative expenses (all fixed) $564,375 Net operating income $84,413 This income statement presents the sales, expenses and pre-tax operating income for a local eating facility. At Al Dente, the average meal cost for lunches and dinners are $20 and $40 respectively. Al Dente serves both lunch and dinner 300 days per year and serves twice as many lunches as dinners. As the MBA intern you are to prepare a managerial accounting focused report to the owners of Al Dente's Italian Restaurant, to include the following:
2. Compute the break-even volume of the number of lunches and dinners. Assume that the CM% for each meal category is the same as the average CM% as calculated in #1. Hint: To solve a break even sales mix, use the horizontal formula:
Net operating income = ($Sales – $Variable costs) – $fixed costs
Net operating income = $CM – $fixed costs
At Breakeven, NOI = $0
Therefore, $CM = $ Fixed costs
Now solve for the unit $CM for each item. Let X be the number of dinners, 2X the number of lunches. $CM is the combined total of the $CM for dinners, and the $CM for lunches.
In: Accounting
How a California company’s domestic policies might have to be adapted or changed to be successful in a new domestic (think USA southern state) or international market?
How a California company’s strategies might have to be adapted or changed to be successful in a new domestic (think USA southern state) or international market?
In: Operations Management
Network Analysis and Theory
a) In your opinion what are the biggest threats to a network in terms of security and why?
b) Describe what you would do to protect a network from attack, mention any appliances or products you can recommend.
In: Computer Science
Risk analysis is one way to monitor security in an organization.
Risk analysis can be a time- consuming process; it involves a
number
of steps, some of which require “educated guessing.” Nevertheless,
the process alone raises awareness of security issues even if no
immediate actions are taken as a result. The steps are:
i. Identify assets (infrastructure, people, hardware, software, reputation, etc.).
For the rest of this list, we’ll concentrate on a single asset.
ii. Determine vulnerability (what event or events might happen to the asset. For example, the building could catch fire, the website could be hacked, etc.).
For the rest of this list, we’ll concentrate on a single asset vulnerable to a single event.
ii. Estimate the probability per year of this event (based on past data, expert estimates, etc.). Take current security measures into account.
iv. Estimate the expected cost if this event occurs (cost to repair or replace, cost of lost business, etc.).
v. Compute risk exposure 5 cost estimate 3 probability estimate.
vi. Identify any additional security measure X that would help protect against this event, determine what it would cost, and do a calculation of the risk exposure with the additional security measure X in place.
vii. Do a cost-benefit analysis:
(Risk exposure without X – Risk exposure with X) − Cost of X
You have a small web-based business that uses a single server to manage your webpage and your customer information. Over the past four years, your website has been hacked and taken down twice. You estimate that the cost of this event is $600 to clean the server and reload the webpage and $12,000 in lost business while the server is down.
You could purchase a backup server for a cost of $3,000, which you estimate would reduce the probability per year of losing your website to 0.2. Would this be a cost- effective security measure?
What if you reevaluate the probability per year with the backup server to be 0.3. Does this change your answer?
In: Computer Science
The current financial meltdown and mortgage crisis triggered some assertions by some people in some quarters that excessive and uncontrollable greed associated by capitalism is the reason for this crisis. Do you think Karl Marx’s conflict theory supports this point? If so, why?
In: Economics
The Drunkard’s (Random) Walk. Imagine you live on an infinite grid of streets where locations are represented as integer pairs (avenue,street). Negative numbers are okay in this example. Now consider a drunkard that randomly picks one of four directions at an intersection and then stumbles to the next intersection doing the same and so on. Write a class Drunkard to simulate this behavior given the drunkard’s initial position. Your Drunkard class should have as instance variables the drunkard’s current avenue (x location) and current street (y location). Your class should have a method called step( ) that moves the drunkard to the next randomly chosen adjacent intersection. Your class should have another method called fastForward(int steps) that takes an integer as a parameter (call it steps) and moves the drunkard steps intersections from his current location. Your class should have a method getLocation( ) that returns a String indicating the drunkard’s current location. Finally your class should have a method called howFar( ) that reports the drunkards distance in blocks from where he started calculated using the Manhattan distance metric.
You will find a test class called DrunkardTester below. Your Drunkard class must work with the test class provided without modification. You must NOT alter the test class.
DrunkardTester.java :
/**
* A tester for the Drunkard class.
*/
import java.util.Scanner;
public class DrunkardTester {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Please enter the starting
avenue integer: ");
int avenue = input.nextInt();
System.out.println("Please enter the starting street
integer: ");
int street = input.nextInt();
// make the Drunkard with initial position
Drunkard ozzy = new Drunkard(avenue,street);
// have him move 100 intersections
ozzy.fastForward(100);
// get his current location
String location = ozzy.getLocation();
// get distance from start
int distance = ozzy.howFar();
System.out.println("Current location: " +
location);
System.out.println("That's " + distance + " blocks
from start.");
}
}
Additionally, there is a completely empty Drunkard.java file that you must fill out.
(Your code goes here...)
Note that the definition of Manhattan distance is:
“The distance between two points in a grid based on a strictly horizontal and/or vertical path (that is, along the grid lines), as opposed to the diagonal or “as the crow flies” distance. The Manhattan distance is the simple sum of the horizontal and vertical components, whereas the diagonal distance might be computed by applying the Pythagorean theorem.”
In: Computer Science
Problem 13-15 The Ashland Company recently hired you to review its control procedures for the purchase, receipt, storage, and issuance of raw materials. You prepared the following comments, which describe Ashland’s procedures. Raw materials, which consist mainly of high-cost electronic components, are kept in a locked storeroom. Storeroom personnel include a supervisor and four clerks. All are well trained, competent, and adequately bonded. Raw materials are removed from the storeroom only upon written or oral authorization from one of the production foremen. There are no perpetual inventory records; hence, the storeroom clerks do not keep records of goods received or issued. To compensate for the lack of perpetual records, a physical inventory count is taken monthly by the storeroom clerks, who are well supervised. Appropriate procedures are followed in making the inventory count. After the physical count, the storeroom supervisor matches quantities counted against a predetermined reorder level. If the count for a given part is below the reorder level, the supervisor enters the part number on a materials requisition list and sends this list to the accounts payable clerk. The accounts payable clerk prepares a purchase order for a predetermined reorder quantity for each part and mails the purchase order to the vendor from whom the part was last purchased. When ordered materials arrive at Ashland, they are received by the storeroom clerks. The clerks count the merchandise and see that the counts agree with the shipper’s bill of lading. All vendors’ bills of lading are initialed, dated, and filed in the storeroom to serve as receiving reports. a. List the internal control weaknesses in Ashland’s procedures. b. For each weakness that you identified, recommend an improvement(s).
In: Accounting
A transformer contains four times as many turns in the secondary coil as it does in the primary coil. If the input voltage is 4000 V, what is the output voltage?
1000 V
2000 V
4000 V
8000 V
16000 V
In: Physics
The C5H5+ and C5Cl5+ cations, which have never been isolated, are known to be ground state triplets - that is, they have 2 unpaired electrons, thus are diradicals. But the C5(CH3)5+ cation has no unpaired electrons - it is a singlet.
Construct a schematic molecular diagram of
C5H5+ (pi system only) in
D5h point group using pz-orbitals of C.
Sketch the shape of each orbital next to the irreducible
representation of the MO. Does your MO diagram support the singlet
or triplet ground state?
Result from X-ray crystallography, NMR, and theory..... C5(CH3)5+ is an irregular pentagon.... the ring is nonplanar... the pi electrons are found to be largely localized on opposite sides of the ring - in an allyl cation fragment and in a double bond.
Now, construct a schematic molecular diagram of C5(CH3)5+ (pi system only) using px-orbitals of C, assuming allyl group and a double bond separately and simply put them on the same stack). Sketch the shape of each orbital next to the irreducible representation of the MO. Does your MO diagram support the singlet or triplet ground state?
Please help!! Super hard homework question!
In: Chemistry
A gymnast of mass 62.0kg hangs from a vertical rope attached to the ceiling. You can ignore the weight of the rope and assume that the rope does not stretch. Use the value 9.81m/s2 for the acceleration of gravity.
Calculate the tension T in the rope if the gymnast hangs motionless on the rope.
Calculate the tension T in the rope if the gymnast climbs the rope at a constant rate.
Calculate the tension T in the rope if the gymnast climbs up the rope with an upward acceleration of magnitude 1.20m/s2 .
Calculate the tension T in the rope if the gymnast slides down the rope with a downward acceleration of magnitude 1.20m/s2 .
*all answers in Newtons
In: Physics
Sharp Company manufactures a product for which the following standards have been set:
|
Standard Quantity or Hours |
Standard Price or Rate |
Standard Cost |
||||||
| Direct materials | 3 | feet | $ | 5 | per foot | $ | 15 | |
| Direct labor | ? | hours | ? | per hour | ? | |||
During March, the company purchased direct materials at a cost of $45,210, all of which were used in the production of 2,500 units of product. In addition, 4,100 direct labor-hours were worked on the product during the month. The cost of this labor time was $30,750. The following variances have been computed for the month:
| Materials quantity variance | $ | 3,600 | U |
| Labor spending variance | $ | 2,750 |
U |
| Labor efficiency variance | $ | 700 |
U |
Required:
1. For direct materials:
a. Compute the actual cost per foot of materials for March.
b. Compute the price variance and the spending variance.
2. For direct labor:
a. Compute the standard direct labor rate per hour.
b. Compute the standard hours allowed for the month’s production.
c. Compute the standard hours allowed per unit of product.
In: Accounting