Define a Python function which finds the all of the odd numbers and the product of the odd numbers. (Use for loop and if conditions for this problem. Do not use existing codes. Use your own codes).(You need to use append function to obtain a list of odd numbers)
In: Computer Science
]write two main programs: one will add exception handling to a geometric object, and the other will create a Template function to find the max of three “entities” (either ints, floats, doubles, chars, and strings)
A trapezoid is a quadrilateral in which two opposite sides are parallel. (note: all squares, rectangles, and parallelograms are trapezoids)
Note 1: the length of Base 1 is always greater than or equal to Base 2
Note 2: To form a valid trapezoid, if must satisfy the side/length rule, namely, the sum of the lengths of Leg1,Leg2 , and Base 2 must be greater than the length of Base 1
Note 3:If a default trapezoid is created, set all the sides equal to 1 (i.e., a square, or rhombus)
The following is the UMs for a trapezoid:
Trapezoid |
-base1 : double -base2: double -leg1: double -leg2: double |
+Trapezoid() +Trapezoid (base1, base2, leg1, leg2) // setters and getters +print(void): void +toString(void) : string |
For the driver program:
Note 1: If the user creates a trapezoid that violates the side/length rule (including 0 or negative side lengths), throw an exception
Note 2: If the user sets one of the sides that violates the side/length rule, do not change the side, and throw an exception
A main drvier (main8a.cpp) :
#include <iostream> #include "trapezoid.h" using namespace std; int main() { cout << "Welcome to Lecture 16: Exceptions and Templates" << endl; cout << "The Trapezoid Program!\n"; cout << "\nTry creating t1 (no parameters, which is valid):\n"; try { Trapezoid t1; // this is valid, by design t1.print(); } catch(string errorMsg) { cout << errorMsg << endl; } cout << "\nTry creating t2(15,3,3,3) (which is invalid):\n"; try { Trapezoid t2(15,3,3,3); // this is invalid t2.print(); } catch(string errorMsg) { cout << errorMsg << endl; } cout << "\nTry creating t3(5,3,4,4) (which is valid):\n"; try { Trapezoid t3(5,3,4,4); // this is valid t3.print(); } catch(string errorMsg) { cout << errorMsg << endl; } cout << "\nTry changing base1 of default t4 to 10 (which is invalid):\n"; try { Trapezoid t4; t4.setBase1(10); // this is invalid t4.print(); } catch(string errorMsg) { cout << errorMsg << endl; } cout << "\nTry changing leg2 of t5(55,30,15,12) to 6 (which is invalid):\n"; try { Trapezoid t5(55,30,15,12); t5.setLeg2(6); // this is invalid t5.print(); } catch(string errorMsg) { cout << errorMsg << endl; } cout << "\nTry changing leg1 of default t6 to .5 (which is valid):\n"; try { Trapezoid t6; t6.setLeg1(.5); // this is valid t6.print(); } catch(string errorMsg) { cout << errorMsg << endl; } return EXIT_SUCCESS; }
In: Computer Science
The air in a building is to be maintained at 25°C dry bulb temperature and 60% relative humidity when the outside conditions are 35°C, 50% saturation with a barometric pressure of 101.3 kPa. The total heat gains to the room are 15 kW sensible heat and 3 kW latent heat. There is no recirculation and the fresh air passes over a cooling coil to dehumidify it, and then a heater before entering the room. The cooling coil by pass factor is 0.18; the volume flow of fresh air is 5m3/s. Calculate (a) the temperature of the air leaving the cooling coil; (b) the refrigeration load for the coil in kW; (c) the heat supplied in the heater in kW.
In: Mechanical Engineering
Wk 4 dis 2 Please advise and provide example
The just-in-time (JIT) movement has long argued that firms should:
Using the economic order quantity (EOQ) and reorder point (ROP) formulas, explain how such efforts would be consistent with JIT's push for lower inventory levels
In: Operations Management
Using C language:
void show_array (int data[ ], int n);
void InsertionSort (int data[ ], int n);
void SelectionSort (int data[ ], int n);
where data[] is the array and n is the size of the array.
If you implement both sort routines you will need to make a copy of the original unsorted array before using the first sort, or else the second sort will be working on a sorted version of the array.
In: Computer Science
Select a Database of your own choice and apply the
first three normalization processes. (1NF, 2NF & 3NF)
• The minimum number of records in the table must be 10
• Make sure you carry the same table from 1NF to 2NF and 3NF, do
not use separate tables from scratch for all the three forms.
• Brief explanation of the normalization processes must be
specified
In: Computer Science
ETHICS IN IT
The general moral imperatives involving individuals is to:
a. Contribute to society and human well-being.
b. Avoid harm to others.
c. Be honest and trustworthy.
d. Be fair and take action not to discriminate.
e. Honour property rights including copyrights and patent.
You are required to discuss the above general moral imperatives in
relation to
Information and Communication Technology (ICT).
In: Computer Science
Consider the following relation and convert to the normal form indicated. Make sure your Primary Key and its attribute(s) is/are underlined for full credit. Also indicate foreign keys using (FK) if any.
0NF:
ORDER[order_num, date, SSN, cust_name, phone, email, (SKU, item_name, price)]
Notes:An order has only one customer, but a customer can place many orders. Each order can have multiple items.
1NF:
2NF:
3NF:
In: Computer Science
In c++ please. Write a program that opens a specified text tile then displays a list of all the unique words found in the file. Hint: Store each word as an element of a set.
In: Computer Science
For this problem, carry at least four digits after the decimal
in your calculations. Answers may vary slightly due to
rounding.
In a random sample of 70 professional actors, it was found that 42
were extroverts.
(a)
Let p represent the proportion of all actors who are
extroverts. Find a point estimate for p. (Round your
answer to four decimal places.)
1
(b)
Find a 95% confidence interval for p. (Round your
answers to two decimal places.)
lower limit 2
upper limit 3
Give a brief interpretation of the meaning of the confidence
interval you have found.
We are 95% confident that the true proportion of actors who are extroverts falls outside this interval. We are 5% confident that the true proportion of actors who are extroverts falls within this interval. We are 5% confident that the true proportion of actors who are extroverts falls above this interval. We are 95% confident that the true proportion of actors who are extroverts falls within this interval.
(c)
Do you think the conditions n·p > 5 and n·q > 5 are satisfied in this problem? Explain why this would be an important consideration.
Yes, the conditions are satisfied. This is important because it allows us to say that p̂ is approximately binomial. No, the conditions are not satisfied. This is important because it allows us to say that p̂ is approximately binomial. No, the conditions are not satisfied. This is important because it allows us to say that p̂ is approximately normal. Yes, the conditions are satisfied. This is important because it allows us to say that p̂ is approximately normal.
In: Math
A 6 kg sled is initially at rest on a horizontal road. The sled is pulled a distance of 2.8 m by a force of 36 N applied to the sled at an angle of 30o to the horizontal. Find the change in the kinetic energy of the sled.
In: Physics
SuFi Inc. is expected to pay the following dividends over the next four years: $9, $7, $5, and $2.74. Their CFO, Mr. Dane Cook, pledges to maintain a constant 5 percent growth rate in dividends forever. If the required return on the stock is 13 percent, what is the current share price?
In: Finance
You are an analyst for a venture capital fund. The firm you are valuing is expected to have free cash flows next year of $1,000, and they are expected to grow at 4% every year forever (if they survive). Further, using CAPM and accounting for the fees that your VC charges, the cost of capital for the firm is 23%. What is the value of the firm, assuming it survives?
$813
$5263
$961.54
$25000
A rival VC fund put in a bid for the firm. They are offering to invest $100 for 16.67% of the firm. What is the implied pre-money valuation? What is the implied probability of survival for the firm?
100 ; about 25%
300 ; about 15%
500 ; about 10%
700 ; about 75%
In: Finance
in the context of access control , explain the concepts of access control matrix, access control list ,privilege control list and capability
In: Computer Science
Must a Huffman tree be a two-tree? Explain
In: Computer Science