Oxygen ( molecular weight 32) is compressed reversibly and polytropically in a cylinder
from 1.05 bar, 15oC to 4.2bar in such a way that one- third of the work input is rejected
as heat to the cylinder walls . calculate the final temperature of the oxygen. Assume
oxygen to be a perfect gas and take Cv = 0.649kJ/kg.K
0.05 kg of carbon dioxide (molecular weight 44), occupying a volume of 0.03m3 at
1.025bar , is compressed reversibly until the pressure is 6.15bar. calculate the final
temperature the work done on the CO2 and the heat flow to or from the cylinder walls ,
1- when the process is according to the law p.ν1.4 = constant , 2- when the process is
isothermal , assume carbon dioxide to be a perfect gas , and take γ = 1.3
Create a Python script that will reduce an input fraction to its lowest term. The program requirements will be:
Sample Output:
Input a fraction? : 4/6
Reduced fraction is 2/3
I need the code to have an output stated above and that the requirements are met in the code.
The following code is supposed to display the positive even numbers less than 12. That is, it will
output the numbers 2, 4, 6, 8 and 10. However, there is a logical error in the code. Explain what the output
of the code below will be. Then write a small program including the code below and make the necessary
changes to fix the code so that it displays what it is intended to display. Ensure that your program works
correctly. Only submit the program, not the output.
Hint: Use variable diagrams to trace the program to help you find the logical error.
int x = 1;
while (x
!= 12)
{
cout << x <<
endl; x = x +
2;
}
Include the for loop below in a small program and complete the program. The loop should execute 10
times. Do not change the for loop below. Compile and run your program to see for yourself that it works.
You do not have to submit this program and output.
for (int i = 1; i <= n;
i++) cout << i * i;
Now convert the for loop into a while loop and add any variable initialisations that you think are
necessary. Compile and run your program and submit only the program containing the while loop and its
output
You are requested to write a very simple calculator. Calculator should be able to handle the five basic mathematic operations – add, subtract, multiply, divide and modulus – on two input values. Your program should have the following structure:
Ask the user to enter two float variables named var1 and var2
Ask the user to enter a character variable named operation to represent the operation to be
performed on the two variables.
Perform the appropriate operation by using if-statements
The output must be given in fixed-point notation with two digits after the decimal point
Teacher at Leva P School needs to divide her class in different group sizes due to activity they have to do. Help her to prepare workstations for each group. For art projects the class divided in groups of 6; science projects in groups of 4. She asked to write program to get number of groups and number of pupils left to form a smaller group. There are 56 pupils in the class.
Declare three int variables nrPupils, nrGroups, and nrLeft. nrPupils represents the
number of pupils in a class, nrGroups number of groups the class divided into, and nrLeft number of pupils remaining smaller group. Assign the value 56 to nrPupils. Declare an int variable groupSize that is used by a cin statement to input a value from the keyboard and store the size of the groups the teacher requested. Display an appropriate message. Please enter the size of each group? Write the statement to calculate the number of groups of groupSize. Write the statement to calculate the number of pupils who are in the remaining smaller group
The user should enter the following values: Gross monthly income (before deductions) Estimated monthly tax deducted,Estimated monthly expenditures in each of the following categories,Groceries,Water and lights Travel costs (including petrol),Cell phone and telephone,Other expenses. The user shall be able to choose between renting accommodation or buying a property. 3. If the user selects to rent, the user shall be able to enter the monthly rental amount. 4. If the user selects to buy a property, the user shall be required to enter the following values for a home loan: a. Purchase price of the property b. Total deposit c. Interest rate % d. Number of months to repay (between 240 and 360) 5. The software shall calculate the monthly home loan repayment for buying a property based on the values that the user entered If the monthly home loan repayment is more than a third of the user’s gross monthly income, the software shall alert the user that approval of the home loan is unlikely. NB:MAKE USE OF GENERIC CLASSES
Is sitting on a chair considered work
Evaluate the following argument: ‘Since pollution is a negative externality, it would be socially optimal to declare illegal the use of any production process that create pollution’.