Answer:
See explaination
Explanation:
Please kindly check attachment for the step by step solution of the given problem.
Create an abstract class DiscountPolicy. It should have a single abstract method computeDiscount that will return the discount for the purchase of a given number of a single item. The method has two parameters, count and itemCost. 2. Derive a class BulkDiscount from DiscountPolicy, as described in the previous exercise. It should have a constructor that has two parameters, minimum and percent. It should define the method computeDiscount so that if the quantity purchased of an item is more than minimum, the discount is percent percent. 3. Derive a class BuyNItemsGetOneFree from DiscountPolicy, as described in Exercise 1. The class should have a constructor that has a single parameter n. In addition, the class should define the method computeDiscount so that every nth item is free. For example, the following table gives the discount for the purchase of various counts of an item that costs $10, when n is 3: count 1 2 3 4 5 6 7 Discount 0 0 10 10 10 20 20
4. Derive a class CombinedDiscount from DiscountPolicy, as described in Exercise 1. It should have a constructor that has two parameters of type DiscountPolicy. It should define the method computeDiscount to return the maximum value returned by computeDiscount for each of its two private discount policies. The two discount policies are described in Exercises 2 and 3. 5. Define DiscountPolicy as an interface instead of the abstract class described in Exercise 1.
Answer:
Java Code was used to define classes in the abstract discount policy,The bulk discount, The buy items get one free and the combined discount
Explanation:
Solution
Code:
Main.java
public class Main {
public static void main(String[] args) {
BulkDiscount bd=new BulkDiscount(10,5);
BuyNItemsGetOneFree bnd=new BuyNItemsGetOneFree(5);
CombinedDiscount cd=new CombinedDiscount(bd,bnd);
System.out.println("Bulk Discount :"+bd.computeDiscount(20, 20));
System.out.println("Nth item discount :"+bnd.computeDiscount(20, 20));
System.out.println("Combined discount :"+cd.computeDiscount(20, 20));
}
}
discountPolicy.java
public abstract class DiscountPolicy
{
public abstract double computeDiscount(int count, double itemCost);
}
BulkDiscount.java
public class BulkDiscount extends DiscountPolicy
{
private double percent;
private double minimum;
public BulkDiscount(int minimum, double percent)
{
this.minimum = minimum;
this.percent = percent;
}
at Override
public double computeDiscount(int count, double itemCost)
{
if (count >= minimum)
{
return (percent/100)*(count*itemCost); //discount is total price * percentage discount
}
return 0;
}
}
BuyNItemsGetOneFree.java
public class BuyNItemsGetOneFree extends DiscountPolicy
{
private int itemNumberForFree;
public BuyNItemsGetOneFree(int n)
{
itemNumberForFree = n;
}
at Override
public double computeDiscount(int count, double itemCost)
{
if(count > itemNumberForFree)
return (count/itemNumberForFree)*itemCost;
else
return 0;
}
}
CombinedDiscount.java
public class CombinedDiscount extends DiscountPolicy
{
private DiscountPolicy first, second;
public CombinedDiscount(DiscountPolicy firstDiscount, DiscountPolicy secondDiscount)
{
first = firstDiscount;
second = secondDiscount;
}
at Override
public double computeDiscount(int count, double itemCost)
{
double firstDiscount=first.computeDiscount(count, itemCost);
double secondDiscount=second.computeDiscount(count, itemCost);
if(firstDiscount>secondDiscount){
return firstDiscount;
}else{
return secondDiscount;
}
}
}
6. For the following waste treatment facility, chemical concentration (mg/gal) within the tank can be considered uniform. The initial chemical concentration inside the tank was 5 mg/gal, the concentration of effluent coming in is 20 mg/gal. The volume of the tank is 600 gallons. The fluid coming in rate is equal to fluid going out is equal to 60 gal/min. (a) Establish a dynamic model of how the concentration of chemical inside the tank increases over time. Specify the units for your variables. (Hint: establish a mass balance of the waste chemical. The concentration inside the tank = concentration going out) (b) Find the Laplace transformation of the concentration (transfer function) for this step input of 20 mg/gal.
Answer:
mass of chemical coming in per minute = 60 × 20 = 1200 mg/min
at a time t(min) , M = mass of chemical = 1200 × t mg
concentration of chemical = 1200t / 600 = 2t mg / gallon
Explanation:
Since it is only fluid that is leaving and not chemical.
How does a car batteray NOT die?
Answer:
bye hooking plugs up to it to amp it up
what is the Economic
Consider a Carnot heat pump cycle executed in a steady-flow system in the saturated mixture region using R-134a flowing at a rate of 0.264 kg/s. The maximum absolute temperature in the cycle is 1.15 times the minimum absolute temperature, and the net power input to the cycle is 5 kW. If the refrigerant changes from saturated vapor to saturated liquid during the heat rejection process, determine the ratio of the maximum to minimum pressures in the cycle.
Answer:
7.15
Explanation:
Firstly, the COP of such heat pump must be measured that is,
[tex]COP_{HP}=\frac{T_H}{T_H-T_L}[/tex]
Therefore, the temperature relationship, [tex]T_H=1.15\;T_L[/tex]
Then, we should apply the values in the COP.
[tex]=\frac{1.15\;T_L}{1.15-1}[/tex]
[tex]=7.67[/tex]
The number of heat rejected by the heat pump must then be calculated.
[tex]Q_H=COP_{HP}\times W_{nst}[/tex]
[tex]=7.67\times5=38.35[/tex]
We must then calculate the refrigerant mass flow rate.
[tex]m=0.264\;kg/s[/tex]
[tex]q_H=\frac{Q_H}{m}[/tex]
[tex]=\frac{38.35}{0.264}=145.27[/tex]
The [tex]h_g[/tex] value is 145.27 and therefore the hot reservoir temperature is 64° C.
The pressure at 64 ° C is thus 1849.36 kPa by interpolation.
And, the lowest reservoir temperature must be calculated.
[tex]T_L=\frac{T_H}{1.15}[/tex]
[tex]=\frac{64+273}{1.15}=293.04[/tex]
[tex]=19.89\°C[/tex]
the lowest reservoir temperature = 258.703 kpa
So, the pressure ratio should be = 7.15
Air at 100°F, 1 atm, and 10% relative humidity enters an evaporative cooler operating at steady state. The volumetric flow rate of the incoming air is 1765 ft3/min. Liquid water at 68°F enters the cooler and fully evaporates. Moist air exits the cooler at 70°F, 1 atm. There is no significant heat transfer between the device and its surroundings and kinetic and potential energy effects can be neglected. Determine the mass flow rate at which liquid enters, in lb(water)/min.
Answer:
Check the explanation
Explanation:
Kindly check the attached image below to see the step by step explanation to the question above.
Sludge wasting rate (Qw) from the solids residence time (Thetac = mcrt) calculation. Given the following information from the previous problem. The total design flow is 15,000 m3/day. Theoretical hydraulic detention time (Theta) = 8 hours. The NPDES limit is 25 mg/L BOD/30 mg/L TSS.
Assume that the waste strength is 170 mg/L BOD after primary clarification.
XA=MLSS = 2200 mg/L,
Xw = Xu = XR = 6,600 mg/L,
qc = 8 days.
Make sure you account for the solids in the discharge.
What volume of sludge (Qw=m3/day) is wasted each day from the secondary clarifiers?
Answer:
The volume of sludge wasted each day from the secondary classifiers is Qw = 208.33 m^3 / day
Explanation:
Check the file attached for a complete solution.
The volume of the aeration tank was first calculated, V = 5000 m^3 / day.
The value of V was consequently substituted into the formula for the wasted sludge flow. The value of the wasted sludge flow was calculated to be Qw = 208.33 m^3 / day.
Problem Statement: Air flows at a rate of 0.1 kg/s through a device as shown below. The pressure and temperature of the air at location 1 are 0.2 MPa and 800 K and at location 2 the pressure and temperature are 0.75 MPa and 700 K. The surroundings are at 300 K and the surface temperature of the device is 1000 K. Determine the rate that the device performs work on its surroundings if the rate of heat transfer from the surface of the device to the environment is 1 kW. Justify your answer. Note that the flow direction for the air is not specified so you need to consider all possibilities for the direction of the airflow. Assume that the air is an ideal gas, that R
Answer:
The answer is "+9.05 kw"
Explanation:
In the given question some information is missing which can be given in the following attachment.
The solution to this question can be defined as follows:
let assume that flow is from 1 to 2 then
Q= 1kw
m=0.1 kg/s
From the steady flow energy equation is:
[tex]m\{n_1+ \frac{v^2_1}{z}+ gz_1 \}+Q= m \{h_2+ \frac{v^2_2}{2}+ gz_2\}+w\\\\\ change \ energy\\\\0.1[1.005 \times 800]-1= 0.01[1.005\times 700]+w\\\\w= +9.05 \ kw\\\\[/tex]
If the sign of the work performed is positive, it means the work is done on the surrounding so, that the expected direction of the flow is right.
A steady green traffic light means
Answer:
Its C. you may proceed, but only if the path is clear
Explanation:
I just gave Quiz and its correct
Two Electric field vectors E1 and E2 are perpendicular to each other; obtain its base
vectors.
Answer:
<E1, E2>.
Explanation:
So, in the question above we are given that the Two Electric field vectors E1 and E2 are perpendicular to each other. Thus, we are going to have the i and the j components for the two Electric Field that is E1 and E2 respectively. That is to say the addition we give us a resultant E which is an arbitrary vector;
E = |E| cos θi + |E| sin θj. -------------------(1).
Therefore, if we make use of the components division rule we will have something like what we have below;
x = |E2|/ |E| cos θ and y = |E1|/|E| sin θ
Therefore, we will now have;
E = x |E2| i + y |E1| j.
The base vectors is then Given as <E1, E2>.
is sampled at a rate of to produce the sampled vector and then quantized. Assume, as usual, the minimum voltage of the dynamic range is represented by all zeros and the maximum value with all ones. The numbers should increase in binary order from bottom to top. Find the bit combination used to store each sample when rounded to the nearest integer between and (clipping may occur). Note: A partially-correct answer will not be recognized. You must answer all three correctly on the same
Answer:
d[0] = 11111111
d[1] = 11011101
d[2] = 1111011
Explanation:
Assume that the number of bits is 8. The voltage range input is -8 to 7 volts. The range is thus 15V, and the resolution is 15/2^8 = 0.0586 volts. We will first add +8 to the input to convert it to a 0-15v signal. Then find the equivalent bit representation. For 7.8 volts, the binary signal will be all 1's, since the max input voltage for the ADC is 7 volts. For 4.95, we have 4.95+8 = 12.95 volts. Thus, N = 12.95/0.0586 = 221. The binary representation is 11011101. For -0.8, we have -0.8 + 8 = 7.2. Thus, N = 7.2/0.0586 = 123. The binary representation is 1111011.
Thus,
d[0] = 11111111
d[1] = 11011101
d[2] = 1111011
Find a negative feedback controller with at least two tunable gains that (1) results in zero steady state error when the input is a unit step (1/s). (and show why it works); (2) Gives a settling time of 4 seconds; (3) has 10% overshoot. Use the standard 2nd order approximation. Plot the step response of the system and compare the standard approximation with the plot.
Answer:
Gc(s) = [tex]\frac{0.1s + 0.28727}{s}[/tex]
Explanation:
comparing the standard approximation with the plot attached we can tune the PI gains so that the desired response is obtained. this is because the time requirement of the setting is met while the %OS requirement is not achieved instead a 12% OS is seen from the plot.
attached is the detailed solution and the plot in Matlab
An air conditioning unit is used to provide cooling during summer for a house. If the air conditioner provides 450 kW cooling by using 150 kW electrical power, determine the coefficient of performance (COP) of the air conditioner. The outside temperature and inside temperature are 40 and 20°C, respectively. Using the inequality of Clausius determine if the cycle is possible. Determine the COP of an air conditioner working based on the Carnot cycle between the same temperature difference. Compare the COPs of the Carnot and actual air conditioners and comment on them based on your answer for the previous part (the inequality of
Answer:
See explaination
Explanation:
Please kindly check attachment for the step by step solution of the given problem.