Complete the following in syntactically correct Python code.
Write a program, using a for loop, that calculates the amount of money a person would earn over a period of time if his or her salary is 1 penny for the first day, 2 pennies for the second day, 4 pennies for the third day, and continues to double each day.
1. The program should ask the user for the number of days the employee worked.
2. Display a table showing the salary for each day.
3. Display the total salary at the end of the period.
4. The output should be displayed in dollar amounts, not the number of pennies.
5. Format your output to include a $ sign and 2 decimal places.
6. Be sure to comment appropriately.
In: Computer Science
Inventory Management
Your company keeps fleets of vehicles at a number of sites around the country. At each site the vehicles can be classified into two types: light and heavy. A heavy vehicle costs more per day, but it can do any task that a light vehicle can do. You would like to determine what mix of vehicles your company should have at each site. If you do not have enough vehicles of the appropriate size to meet the demand on a given day, you must rent the vehicles. Some cost data were collected on the cost of various vehicle types:
Vehicle Type Daily fixed cost Daily variable cost (if used)
Owned Light $32 $40
Owned Heavy $44 $54
Rented Light 0 $175
Rented Heavy 0 $225
At a particular site, your company collected demand data for the number of vehicles required on each of seven days:
Day Lights Heavies
1 6 0
2 3 2
3 5 4
4 8 3
5 2 1
6 4 4
7 1 2
Based on just the above data, what is your recommendation for the number of vehicles to own of each type at this site? What is your weekly cost?
Please shoe and explain using solver
In: Operations Management
A Diesel cycle engine is analyzed using the air standard method. Given the conditions at state 1, compression ratio (r), and cutoff ratio (rc) determine the efficiency and other values listed below.
Note: The gas constant for air is R=0.287 kJ/kg-K.
Given Values
T1 (K) = 338
P1 (kPa) = 130
r = 14.5
rc = 1.25
a) Determine the specific internal energy (kJ/kg) at state 1.
b) Determine the relative specific volume at state 1.
c) Determine the relative specific volume at state 2.
d) Determine the temperature (K) at state 2.
e) Determine the pressure (kPa) at state 2.
f) Determine the specific enthalpy (kJ/kg) at state 2.
g) Determine the temperature (K) at state 3.
h) Determine the pressure (kPa) at state 3.
i) Determine the specific enthalpy (kJ/kg) at state 3.
j) Determine the relative specific volume at state 3.
k) Determine the relative specific volume at state 4.
l) Determine the temperature (K) at state 4.
m) Determine the pressure (kPa) at state 4.
n) Determine the specific internal energy (kJ/kg) at state 4.
o) Determine the net work per cycle (kJ/kg) of the engine.
p) Determine the heat addition per cycle (kJ/kg) of the engine.
q) Determine the efficiency (%) of the engine.
In: Mechanical Engineering
Please solve in C++ only
class is not templated
You need to write a class called LinkedList that implements the following List operations:
public void add(int index, Object item);
// adds an item to the list at the given index, that index may be
at start, end or after or before the
// specific element
2.public void remove(int index);
// removes the item from the list that has the given index
3.public void remove(Object item);
// finds the item from list and removes that item from the list
4.public List duplicate();
// creates a duplicate of the list
// postcondition: returns a copy of the linked list
5.public List duplicateReversed();
// creates a duplicate of the list with the nodes in reverse order
// postcondition: returns a copy of the linked list with the nodes in
6.public List ReverseDisplay();
//print list in reverse order
7.public Delete_Smallest();
// Delete smallest element from linked list
8.public List Delete_duplicate();
// Delete duplicate elements from a given linked list.Retain the earliest entries.
9 Make a function that adds a linked list to itself at the end.
Input:
4 -> 2 -> 1 -> NULL
Output:
4 -> 2 -> 1 -> 4 -> 2 -> 1 -> NULL
note : code should work on Visual studio 2017 and provide screenshot of output
In: Computer Science
For this exercise, you will implement two programs that allow the user to enter grades in a gradebook. The first program will use one‐dimensional arrays, and the second program will use two‐dimensional arrays. The two programs function the same
Write an application that prints out the final grade of the students in a class and the average for the whole class. There are a total of 3 quizzes. You will need 4 arrays:
1. An array of type int to store all the ID's
2. An array of type double to store all scores for quiz 1
3. An array of type double to store all scores for quiz 2
4. An array of type double to store all scores for quiz 3
How to proceed:
1. Ask the user how many students are in the class, so you can set the length of all the arrays.
2. Allocate 4 arrays that will store the data.
3. Use a FOR loop to retrieve and store all the data.
4. Use another FOR loop to
a. Output the final score for each student.
b. Keep track of all scores to later compute the average for the class.
5. Calculate and Output the average for the class.
Format all floating‐point numbers to 2 decimal places
Your program MUST receive user input as shown in the sample output.
Please leave comments on the program so i can give you a thumbs up :)!
Also, this is for java language.
In: Computer Science
The fictional country of Sendaria finds itself in the following situation: the government has a deficit of 2% GDP, private savings is 17% of GDP, and physical investments are 15% of GDP.
a)What is the trade balance?
b) If the government budget is set at zero, how will this affect the trade balance?
Question 1 options:
|
a) Trade balance = 4%, b) Trade balance will DECREASE to 0% |
|
|
a) Trade balance = 0%, b) Trade balance will INCREASE to 2% |
|
|
a) Trade balance = 4%, b) Trade balance will INCREASE to 2% |
|
|
a) Trade balance = 0%, b) Trade balance will DECREASE to -2% |
In: Economics
A 130.0 mL sample of 0.070 M Ca 2 + is titrated with 0.070 M EDTA at pH 9.00. The value of log K f for the Ca 2 + − EDTA complex is 10.65 and the fraction of free EDTA in the Y 4 − form, α Y 4 − , is 0.041 at pH 9.00. What is K ′ f , the conditional formation constant, for Ca 2 + at pH 9.00?
What is the equivalence point volume, Ve, in milliliters?
Calculate the concentration of Ca2+ at V=(1/2)Ve.
Calculate the concentration of Ca2+ at V=Ve.
Calculate the concentration of Ca2+ at V=1.1Ve.
In: Chemistry
The velocity field of a permanent, incompressible and isothermal flow is given by u = a (x^2 - y^2) (1) v = −2axy (2) w = 0 (3) Gravitational acceleration acts on the z axis only. a) Write the Navier-Stokes equations for this flow, canceling the appropriate terms and replacing the non-zero derivatives with their detailed expression. Be sure to indicate clearly your assumptions. (4 points) b) From the result obtained in (a), demonstrate that the pressure field is continuous and therefore physically possible (2 points) c) Get the expression for the flow pressure field (4 points)
In: Civil Engineering
Your manager is trying to determine what forecasting method to use. Based upon the following historical data, calculate the following forecast and specify what procedure you would utilize.
| MONTH | ACTUAL DEMAND | ||
| 1 | 59 | ||
| 2 | 62 | ||
| 3 | 64 | ||
| 4 | 65 | ||
| 5 | 73 | ||
| 6 | 75 | ||
| 7 | 75 | ||
| 8 | 78 | ||
| 9 | 78 | ||
| 10 | 81 | ||
| 11 | 82 | ||
| 12 | 85 | ||
a. Calculate the simple three-month moving average forecast for periods 4–12. (Round your answers to 3 decimal places.)
| Month | Three-Month Moving Average |
|
| 4 | ||
| 5 | ||
| 6 | ||
| 7 | ||
| 8 | ||
| 9 | ||
| 10 | ||
| 11 | ||
| 12 | ||
b. Calculate the weighted three-month moving average for periods 4–12 using weights of 0.40 (for the period t−1); 0.50 (for the period t−2), and 0.10 (for the period t−3). (Do not round intermediate calculations. Round your answers to 1 decimal place.)
| Month | Three-Month Weighted Moving Average |
|
| 4 | ||
| 5 | ||
| 6 | ||
| 7 | ||
| 8 | ||
| 9 | ||
| 10 | ||
| 11 | ||
| 12 | ||
c. Calculate the single exponential smoothing forecast for periods 2–12 using an initial forecast (F1) of 58 and an α of 0.40. (Do not round intermediate calculations. Round your answers to 3 decimal places.)
| Month | Single Exponential Smoothing Forecast |
|
| 2 | ||
| 3 | ||
| 4 | ||
| 5 | ||
| 6 | ||
| 7 | ||
| 8 | ||
| 9 | ||
| 10 | ||
| 11 | ||
| 12 | ||
d. Calculate the exponential smoothing with trend component forecast for periods 2–12 using an initial trend forecast (T1) of 1.50, an initial exponential smoothing forecast (F1) of 57, an α of 0.40, and a δ of 0.40. (Do not round intermediate calculations. Round your answers to 3 decimal places.)
| Month | Exponential Smoothing with Trend |
|
| 2 | ||
| 3 | ||
| 4 | ||
| 5 | ||
| 6 | ||
| 7 | ||
| 8 | ||
| 9 | ||
| 10 | ||
| 11 | ||
| 12 | ||
e-1. Calculate the mean absolute deviation (MAD) for the forecasts made by each technique in periods 4–12. (Do not round intermediate calculations. Round your answers to 3 decimal places.)
| Mean Absolute Deviation |
|
| Three-month moving average | |
| Three-month weighted moving average | |
| Single exponential smoothing forecast | |
| Exponential smoothing with trend | |
e-2. Which forecasting method is best?
| Single exponential smoothing forecast | |
| Three-month weighted moving average | |
| Three-month moving average | |
| Exponential smoothing with trend forecast |
In: Math
The algorithm is basically as follows. The notation is slightly different from that in the website you were given, but there is no difference in the method.
Given the initial value problem
dy/dx=f(x,y),y(a)= y_0
Euler’s Method with step size h consists in applying the iterative formula
y_(n+1)= y_n+h∙f(x_n,y_n ),n≥0
To compute successive approximations y_1,y_2,y_3,⋯ to the (true) values 〖y(x〗_1),〖y(x〗_2),〖y(x〗_3),⋯ of the exact solution y=y(x) at the points x_1,x_2,x_3,⋯, respectively.
In plain English:
You want to approximate the value of dy/dx (or y’) at some point in
an interval.
Step 1: Depending on how accurate you need to be, divide the interval up into little pieces of equal length; this length is the step size h. For purposes of discussion, let’s use the interval [0,1] and use ten intervals, so h = 0.1.
Step 2: y_0=0
Step 3: y_1=y_0+0.1f(x_0,y_0)
Step 4: y_2=y_1+0.1f(x_1,y_1)
…
Stop after ten steps, in this case. Usually the stopping criterion
is a level of accuracy.
You can easily set this up in Excel.
Exercises
Use Euler’s Method with step sizes h =0.1,0.02, 0.004, 0.0008 (that
is, do the problem 4 times, each with a more precise value of h) ,
10 equally spaced iterations.
1. y^'=x^2+y^2,y(0)=0,0≤x≤1
2. y^'=x^2-y^2,y(0)=1,0≤x≤2
3. y^'=lny,y(1)=2,1≤x≤2
4. y^'=x^(2/3)+y^(2/3),y(0)=1,0≤x≤2
5. y^'=x+√x,y(0)=1,0≤x≤2
6. y^'=x+∛x,y(0)= -1,0≤x≤2
In: Advanced Math