1 Objective The purpose of this assignment is to test your familiarity with Java I/O, and if-else statements. Please submit your file as ”Shipping.java”
2 The Backstory Amazon.com wants to try out it’s new ‘Delivery by Drone” service and has recruited you to write a Java console application to calculate the shipping cost. They are going to charge the customer based on various criteria, as shown below:
| Weight (in kg) | Rate per 50 miles |
|
2 or less Over 2 Kg, up through 6 Kg Over 6 Kg, up through 10 Kg Over 10 Kg, up through 20 Kg |
$5.10 $10.18 $22.43 $40.60 |
Amazon Prime members get a 10% discount.
3 Specifications
• First, ask for the weight of the package (in kilograms). The user can enter this as a decimal number, so use type double. Values of 0 or less are invalid (i.e. a package has to weigh something). Do not accept weights of more than 20 Kg either, as this is the maximum weight the company will ship).
• If the user enters an invalid choice, print an appropriate error message and abort the program. (See sample outputs for error messages).
• Now ask the user to enter the distance to ship the package (in miles). This will be entered as an integer. 0 miles or less is considered invalid (must be a positive distance to ship). Also, do not accept distances of more than 3000 miles - consider 3000 miles to be the company’s maximum shipping distance.
• If the user enters an invalid choice, print an appropriate error message and abort the program. (See sample outputs for error messages).
• For a valid weight and distance, compute the shipping charges according to the chart above, noting that ”rate per 50 miles shipped” means that anything up to 50 miles is at the 50 mile rate, anything above 50 up to 100 miles is at the 100 mile rate, and so on.
• Ask if the user is an Amazon Prime member. If the user says Yes, give them a 10% discount.
• Print out the following results: – The package weight (default format), in kilograms. – The shipping rate for this package, to 2 decimal places, (money format). – The number of miles chosen. – The calculated shipping cost, to 2 decimal places (money format).
• See the Sample Runs below for expected output messages and numerical output formats.
• Also note: The System library has a method called exit(), which will cause a program to terminate immediately. It requires a parameter - usually, it is sufficient to just pass in the value 0
4 Sample Runs
Sample Run 1:
Welcome to Amazon Shipping Calculator
Please enter the weight of the package, in Kg: 19.4
Please enter the distance to be shipped (in miles): 2318 Are you an Amazon Prime member? (Yes/No): No
Package weight = 19.4 Kg Shipping rate = $40.60 per 50 miles Number of miles = 2318
Total shipping charges = $ 1908.20
Goodbye
Sample Run 2:
Welcome to Amazon Shipping Calculator
Please enter the weight of the package, in Kg: 8.4 Please enter the distance to be shipped (in miles): 134
Are you an Amazon Prime member? (Yes/No): Yes
Package weight = 8.4 Kg Shipping rate = $22.43 per 50 miles Number of miles = 134
Total shipping charges = $ 60.56
Goodbye
Sample Run 3 (error case): Welcome to Amazon Shipping Calculator
Please enter the weight of the package, in Kg: -5 Invalid package weight. Program aborted
Sample Run 4 (error case): Welcome to Amazon Shipping Calculator
Please enter the weight of the package, in Kg: 21.8 Cannot accept packages over 20 Kg. Program aborted
In: Computer Science
Determining if a column’s data functionally determines another column’s data can usually be accomplished by asking the question “Can X have only one Y or can it have more than one Y?” An example might be “Can a doctor have only one patient or more than one patient?” If the answer is only one, then doctor functionally determines patient, otherwise, if a doctor can have more than one patient, the doctor does not functionally determine the patient. In other words, if doctor functionally determines patient, then if you know the doctor, you can know the one and only patient he/she has. If doctor does not functionally determine patient (which of course it doesn’t), then you can’t just talk about the doctor and his/her patient. You have to specify the patient. This means that the key would have to include both doctor and patient.
5.) Is the following true? Why or why not? Doctor, Patient -> Prescription
6.) Is the following true? Why or why not? Doctor, Patient, Prescription -> Refills Remaining Sometimes a key that is made up of more than one attribute (like Doctor, Patient) can technically functionally determine another attribute (like the Patient’s birth date). But it is also true that you don’t need Doctor in order to functionally determine a Patient’s birth date. This situation is what 2NF is all about. Making sure that all functionally determined attributes need all of the key columns to functionally determine them. In cases where you don’t, you need to decompose the related data into two or more tables. One for the full key (and any attributes you need the full key to determine), and one for each attribute that is only determined by a part of they key (along with that part of the key). For example, if you had: Doctor, Patient -> Last Appointment Date and Time, Patient Birth Date You would want to create two tables. One for: Doctor, Patient -> Last Appointment Date and Time And one for: Patient -> Patient Birth Date The problem this solves is that if a patient is seeing more than one doctor (perhaps a general practitioner and a neurologist), you don’t have to duplicate the patient’s birth date for each doctor he/she visits. This is redundant, and additionally makes it possible for the “two” birth dates to differ in the database when clearly a person doesn’t have two birth dates.
7.) Should the following design be decomposed into two or more tables? Why or why not? And if decomposing, what columns belong in each resultant table? Patient, Hospital Room Number -> Hospital Floor
8.) Should the following design be decomposed into two or more tables? Why or why not? And if decomposing, what columns belong in each resultant table? Doctor, Patient -> Hospital Admit Date and Time, Doctor’s Pager # Sometimes a key can technically functionally determine two attributes but does so transitively. An example would be: Employee -> Employee’s Boss, Employee’s Boss’s Email Address The problem is that a boss likely has several people that report to them. So, if everywhere we record an employee’s boss, we also record their boss’s email address, it’s possible that the same boss might appear to have different email addresses when looked up by one employee vs. another. Solving this problem is what 3NF is all about. Again, this is not just about reducing redundancy but also reducing the chance for inconsistent data. To solve this problem, we’d want to decompose the design into two tables: Employee -> Employee’s Boss Boss -> Boss’s Email Address Aside: This decomposition is sufficient to meet the requirements of 3NF. However, an even better design would involve realizing that a boss is also an employee and store all employees in one table and have the relationship between employee and boss recursively refer to other rows in the same table: Employee -> Employee Email Address, Boss The Boss attribute would refer to the Employee column of another row in that same table.
9.) Should the following design be decomposed into two or more tables? Why or why not? And if decomposing, what columns belong in each resultant table? Doctor -> Department, Department Office Location (Note: a department can have only one office location)
10.) Should the following design be decomposed into two or more tables? Why or why not? And if decomposing, what columns belong in each resultant table? Doctor, Patient, Date and Time -> Diagnosis, Typical Prognosis (By Typical Prognosis, assume of the diagnosis in general, not the particular doctor diagnosing the particular patient.)
In: Nursing
A New York City daily newspaper called “Manhattan Today” charges an annual subscription fee of $135. Customers prepay their subscriptions and receive 260 issues over the year. To attract more subscribers, the company offered new subscribers the ability to pay $130 for an annual subscription that also would include a coupon to receive a 40% discount on a one-hour ride through Central Park in a horse-drawn carriage. The list price of a carriage ride is $125 per hour. The company estimates that approximately 30% of the coupons will be redeemed.
Required:
1. How much revenue should Manhattan Today recognize upon receipt of the $130 subscription price?
2. How many performance obligations exist in this contract? 3. Prepare the journal entry to recognize sale of 10 new subscriptions, clearly identifying the revenue or deferred revenue associated with each performance obligation.
In: Accounting
4) Consumer utility
|
Quantity |
Total Utility from A |
Total Utility from B |
|
1 |
40 |
37 |
|
2 |
76 |
72 |
|
3 |
108 |
105 |
|
4 |
136 |
136 |
|
5 |
160 |
165 |
|
6 |
180 |
192 |
|
7 |
196 |
217 |
|
8 |
208 |
237 |
|
9 |
216 |
252 |
|
10 |
220 |
262 |
|
11 |
220 |
267 |
|
12 |
216 |
267 |
|
13 |
208 |
262 |
|
14 |
196 |
252 |
|
15 |
180 |
237 |
You are given the above total utilities for different consumption amounts of goods A and B. The consumer has a budget of 60, the price of A is 4, and the price of B is 5.
a) Calculate all the marginal utilities and marginal utility –
price ratios and display them on a table. Show all your work.
b) Prepare a separate table that shows all the possible
combinations of A and B, and their respective utilities. Add one to
the total utility of each combination for each unspent unit from
the budget (for combinations where not all the 60 can be
spent).
2
c) Which combination maximizes utility? Explain in detail, using
two pieces of evidence.
d) Graph your result using a budget line and an indifference
map.
-The budget line should be precise with properly scaled x- and
y- axes.
- Show a few indifference curves; at least one not optimal, at
least one not attainable, and the optimal one, with correct point
of tangency.
In: Economics
Dexter Brothers Inc. reported net income available to common shareholders of $4,200,000 last financial year. The company has paid $1.20 dividend per share for the 1,000,000 common shares outstanding. The company’s capital structure is included of 40 percent debt, 10 percent preferred shares and 50 percent common shares. The company were taxed at 40 percent. *
(a) If the common shares are priced at $50 and the dividend is expected to grow at 5 percent per year for the foreseeable futures, determine the company’s cost of retained earnings. (b) If underpricing and flotation costs on new common share amount to $10.00 per share, compute the company’s cost of new common share financing. (c) The company can issue $2.00 dividend preferred shares for a market price of $25.00 per share. Flotation costs would amount to $3.00 per share. Calculate the cost of new preferred stock financing. (d) The company is considering to issue new bond with a par value of $1,000, 8 percent coupon rate with 5 years maturity. The company’s old bond currently trading at $1,100 per bond. Flotation cost would amount to $25 per bond. Calculate the new cost of debt financing. (e) Determine the Dexter Brothers new weighted average cost of capital (WACC) if the company decided to issue new shares. (f) Currently Dexter Brothers is in view of accepting a new project offering return of 8 percent. Should the company accept or reject the project. Justify your answer.
In: Finance
1. For their uniforms, the Vikings soccer team has a choice of
six different styles for the shirts, five for the shorts, and five
colours for their socks. How many different uniforms are possible?
A) 16 B) 150 C) 60 D) 55
2. The Niagara Ice Dogs have 4 people trying out for goal. Their
coach wants to try a different goalie in each of the three periods
of an exhibition game. In how many ways can the coach choose the
three different goalies for the game? A) 12 B) 24 C) 7 D) 55 E)
20
3. How many arrangements of the word ALGORITHM begin with a vowel
and end with a consonant? A) 18 B) 5040 C) 90720 D)181440 E)
362880
4. From a class of 14 boys and 9 girls, how many ways can I choose
a committee of 6 to analyze classroom productivity with and equal
number of boys and girls? A) 126 B) 252252 C) 30576 D) 448
5.A bag contains three green Christmas ornaments and four gold
ornaments. If you randomly pick a single ornament from the bag,
what is the probability that it will be green? A) 3/4 B)3/7 C)4/7
D)4/3
6. A bag contains three green Christmas ornaments and four gold
ornaments. If you randomly pick two ornaments from the bag, at the
same time, what is the probability that both ornaments will be
gold?
A) 4/7 B) 2/7 C)3/7 D) none of the above
7. How many 4 digit number can be made using 0 -7 with no repeated
digits allowed?
A) 5040 B) 4536 C) 2688 D) 1470
8. A coin is tossed three times. What is the probability of tossing
three heads in a row?
A) 3/8 B)1/8 C)1/2 D)7/8
9. Two standard dice are rolled. What is the probability of rolling
doubles (both the same number)?
A) 1/6 B)1/4 C)1/36 D) 5/36
10. There are 50 competitors in the men’s ski jumping. 30 move on
to the qualifying round. How many different ways can the qualifying
round be selected? A) 50! B) 30! C) 80 D) 1500 E) 1.25 × 1046
11. How many ways can the manager of a baseball team put together a
batting order of his nine players, if the shortstop must bat
3rd?
A) 40320 B) 504 C) 362880 D) 120960
12. If a CD player is programmed to play the CD tracks in random
order, what is the probability that it will play six songs from a
CD in order from your favourite to your least favourite? A)1/6
B)2/3 C)1/720 D)5/6 E) 1/360
13. A group of eight grade 11 and five grade 12 students wish to be
on the senior prom committee. The committee will consist of three
students. What is the probability that only grade 12 students will
be elected, assuming that all students have an equal chance of
being elected?
In: Statistics and Probability
A researcher is investigating the effects of emotion and gender
on cooperation. He randomly assigns participants to one of three
conditions: control, guilt, happiness
After inducing one of the three emotions, the researcher measures
each participant's level of cooperation in a game, on a scale from
1 to 10.
Men:
Control: 5 4 7 4 3 5 5 6
Guilt: 6 9 7 8 6 7 7 8
Happiness: 8 7 8 9 9 6 8 9
Women:
Control: 6 3 5 5 4 7 6 3
Guilt: 3 7 7 4 8 5 4 6
Happiness: 7 6 9 9 7 8 9 8
What statistical test should we do here? Report the results.
In: Statistics and Probability
2. Using two of the Magnificent Seven tools listed below (other than Cause-and-effect diagram) • Histogram or stem-and-leaf plot
• Check sheet
• Pareto chart
• Defect concentration diagram
• Scatter diagram
• Control chart
In: Statistics and Probability
Hair color in the United States is known to be 40% blond, 40% brown, and 20% black. Miranda does a study to see if the proportions match, and her survey showed 43 people with blond hair, 32 people with brown hair, and 15 with black hair. Use a chi-square test with a level of significance α=0.05.
In: Statistics and Probability
Question text
7-step Hypothesis Testing Problem
Complete the 7 steps in Excel and upload the file here
Two major automobile manufacturers have produced compact cars with the same size engines.We are interested in determining whether or not there is a significant difference in the MPG (miles per gallon) of the two brands of automobiles.A random sample of eight cars from each manufacturer is selected, and eight drivers are selected to drive each automobile for a specified distance.The following data show the results of the test.
|
Driver |
Manufacturer A |
Manufacturer B |
|
1 |
32 |
28 |
|
2 |
27 |
22 |
|
3 |
26 |
27 |
|
4 |
26 |
24 |
|
5 |
25 |
24 |
|
6 |
29 |
25 |
|
7 |
31 |
28 |
|
8 |
25 |
27 |
At the 0.05 level of significance, conduct a 7-step hypothesis test to determine whether there is a significant difference in the MPG (miles per gallon) of the two brands of automobiles.
In: Math