Write down all proofs in acceptable mathematical language: make sure that you mark the beginning and end of the proof, state every assumption, define every variable, give a justification for every assertion (e.g., by definition of…), and use complete, grammatically correct sentences.
Definitions:
• An integer ? is even if and only if there exists an integer ? such that ? = 2?. An integer ? is odd if and only if there exists an integer ? such that ? = 2? +1.
• Two integers have the same parity when they are both even or when they are both odd. Two integers have opposite parity when one is even and the other one is odd.
• An integer ? is divisible by an integer ? with ? ≠ 0, denoted ? | ?, if and only if there exists an integer ? such that ? = ??.
• A real number ? is rational if and only if there exist integers ? and ? with ? ≠ 0 such that ? = ?/?.
• For any real number ?, the absolute value of ?, denoted |?|, is defined as follows: |?| = { ? if ? ≥ 0 −? if ? < 0 2.
Prove each of the following statements using a direct proof, a proof by contrapositive, a proof by contradiction, or a proof by cases. For each statement, indicate which proof method you used, as well as the assumptions (what you suppose) and the conclusions (what you need to show) of the proof.
a. For all integers ?, ?, and ?, if ?? is not divisible by ?, then ? is not divisible by ?.
b. For all positive integers ?, ?, and ?, if ? is divisible by ? and ? is divisible by ?, then ? + ? is divisible by ?.
c. The difference of any rational number and any irrational number is irrational
d. There are no integers ? and ? such that ???+ ?? = ?.
e. Any two consecutive integers have opposite parity.
f. For all real numbers ? and ?, ???(?, ?) = ?+?−|?−?| ? and ???(?, ?) = ?+?+|?−?| ? , where ???(?, ?) and ???(?, ?) denote the minimum and the maximum of ? and ?, respectively.
In: Advanced Math
There is error in this java code. Pls debug.
// Prompt user for value to start
// Value must be between 1 and 20 inclusive
// At command line, count down to blastoff
// With a brief pause between each displayed value
import java.util.*;
public class DebugSix3
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
String userNumString;
int userNum, val;
final int MIN = 1;
final int MAX = 20;
System.out.println("Enter a number between " + MIN + " and " + MAX
+ " inclusive");
userNumString = input.next();
userNum = Interger.parseInt(userNumString);
while(userNum < MIN || userNum = MAX)
{
System.out.println("Number out of range" +
"\nEnter a number between " + MIN + " and " + MAX + "
inclusive");
userNumString = input.next();
userNum = Integer.parse(userNumString);
}
for(val = userNum; val < 0; --val)
{
System.out.print(val + " ");
for(int x = 0; x < 100000; ++x)
for(int y = 0; y < 10000; ++y);
// Adjust these numbers for faster or slower performance
}
System.out.println("Blastoff!");
}
}
In: Computer Science
13. Explain how cross-cultural considerations affect the idea of adolescent identity crisis.
14. Discuss the conditions that need to be met in order for an individual to be found " competent to stand trial."
15. Discuss three rights mental patients have in the United States with regard to treatment and how they are sometimes contradictory.
In: Psychology
Determine the utilization and the efficiency for each of these situations: a. A loan processing operation that processes an average of 4 loans per day. The operation has a design capacity of 12 loans per day and an effective capacity of 11 loans per day. (Round your answer to 1 decimal place. Omit the "%" sign in your response.) Utilization % Efficiency % b. A furnace repair team that services an average of 3 furnaces a day if the design capacity is 7 furnaces a day and the effective capacity is 5 furnaces a day. (Round your answer to 1 decimal place. Omit the "%" sign in your response.) Utilization % Efficiency % c. Would you say that systems that have higher efficiency ratios than other systems will always have higher utilization ratios than those other systems? This is not necessarily . If the design capacity is relatively , the utilization could be even though the efficiency was . Next Visit question mapQuestion 1 of 5 Total
In: Operations Management
Define Affective Disorder, give one example, Anxiety Disorder give one example
In: Nursing
Doug Turner Food Processors wishes to introduce a new brand of dog biscuits composed of chicken and liver flavored biscuits that meet certain nutritional requirements. The liver flavored biscuits contain 1 unit of nutrient A and 2 units of nutrient B; the chicken flavored biscuits contain 1 unit of nutrient A and 4 units of nutrient B. According to federal requirements, there must be at least 40 units of nutrient A and 60 units of nutrient B in a package of the new mix. In addition, the company has decided that there can be no more than 15 liver flavored biscuits in a package. It costs 1¢ to make 1 liver flavored biscuit and 2¢ to make 1 chicken flavored. Doug wants to determine the optimal product mix for a package of the biscuits to minimize the firm's cost.
The aim of the objective function should be to ▼ Minimize Maximize the objective value.
The optimum solution is:
Number of liver flavored biscuits in a package = ___ (round your response to two decimal places).
Number of chicken flavored biscuits in a package = ____ (round your response to two decimal places).
Optimal solution value = ____ (round your response to two decimal places).
In: Operations Management
In: Psychology
Chapter 9 (Pointers) – Review Questions
Short Answer
1. What does the indirection operator do?
2. Look at the following code.
int x = 7;
int *ptr = &x;
What will be displayed if you send the expression *ptr to cout? What happens if you send the expression ptr to cout?
3. So far you have learned three different uses for the * operator. What are they?
4. What math operations are allowed on pointers?
5. Assuming ptr is a pointer to an int, what happens when you add 4 to ptr?
6. Look at the following array definition.
int numbers[] = {2, 4, 6, 8, 10};
What will the following statement display?
cout << *(numbers + 3) << endl;
7. What is the purpose of the new operator?
8. What is the purpose of the delete operator?
9. Under what circumstances can you successfully return a pointer from a function?
10. What is the difference between a pointer to a constant and a constant pointer?
11. What are two advantages of declaring a pointer parameter as a constant pointer?
Fill-in-the-Blank
12. Each byte of memory is assigned a unique ___________.
13. The _________ operator can be used to determine a variable’s address.
14. ____________variables are designed to hold addresses.
15. The ___________ operator can be used to work with the variable a pointer points to.
16. Array names can be used as _________, and vice versa.
17. Creating variables while a program is running is called ____________.
18. The ____________ operator is used to dynamically allocate memory.
19. A pointer that contains the address 0 is called a(n) ________ pointer.
20. When a program is finished with a chunk of dynamically allocated memory, it should free it with the __________ operator.
21. You should only use pointers with delete that were previously used with __________.
Algorithm Workbench
22. Look at the following code:
double value = 29.7;
double *ptr = &value;
Write a cout statement that uses the ptr variable to display the contents of the value variable.
23. Look at the following array definition:
int set[10];
Write a statement using pointer notation that stores the value 99 in set[7]
24. Write a code that dynamically allocates an array of 20 integers, then uses a loop to allow the user to enter values for each element of the array.
25. Assume tempNumbers is a pointer that points to a dynamically allocated array. Write code that releases the memory used by the array.
26. Look at the following function definition:
void getNumber(int &n)
{
cout << “Enter a number: “;
cin >> n;
}
In this function, the parameter n is a reference variable. Rewrite the function so n is a pointer.
27. Write the definition of ptr, a pointer to a constant int.
28. Write the definition of ptr, a constant pointer to an int.
True or False
29. Each byte of memory is assigned a unique address. T F
30. The * operator is used to get the address of a variable. T F
31. Pointer variables are designed to hold addresses. T F
32. The & symbol is called the indirection operator. T F
33. The & operator dereferences a pointer. T F
34. When the indirection operator is used with a pointer variable, you are actually working with the value the pointer is pointing to. T F
35. Array names cannot be dereferenced with the indirection operator. T F
36. When you add a value to a pointer, you are actually adding that number times the size of the data type referenced by the pointer. T F
37. The address operator is not needed to assign an array’s address to a pointer. T F
38. You can change the address that an array name points to. T F
39. Any mathematical operation, including multiplication and division, may be performed on a pointer. T F
40. Pointers may be compared using the relational operators. T F
41. When used as function parameters, reference variables are much easier to work with than pointers. T F
42. The new operator dynamically allocates memory. T F
43. A pointer variable that has not been initialized is called a null pointer. T F
44. The address 0 is generally considered unusable. T F
45. In using a pointer with the delete operator, it is not necessary for the pointer to have been previously used with the new operator. T F
Find the Error
Each of the following definitions and program segments has errors. Locate as many as you can.
46. int ptr* = nullptr;
47. int x, *ptr = nullptr;
&x = ptr;
48. int x, *ptr = nullptr;
*ptr = &x;
49. int x, *ptr = nullptr;
ptr = &x;
ptr = 100; //Store 100 in x
cout << x << endl;
50. int numbers[] = {10, 20, 30, 40, 50};
cout << “The third element in the array is ”;
cout << *numbers + 3 << endl;
51. int values[20], *iptr = nullptr;
iptr = values;
iptr *= 2;
52. float level;
int fptr = &level;
53. int *iptr = &ivalue;
int ivalue;
54. void doubleVal(int val)
{
*val *= 2;
}
55. int *pint = nullptr;
new pint;
56. int *pint = nullptr;
pint = new int;
if (pint == nullptr)
*pint = 100;
else
cout << “Memory allocation error\n”;
57. int *pint = nullptr;
pint = new int[100]; //Allocate memory
.
.
Code that process the array.
.
.
delete pint; // Free memory
58. int *getNum()
{
int wholeNum;
cout << “Enter a number: “;
cin >> wholeNum;
return &wholeNum;
}
59. const int arr[] = {1, 2, 3};
int *ptr = arr;
60. void doSomething(int * const ptr)
{
int localArray[] = {1, 2, 3};
ptr = localArray;
}
In: Computer Science
Rossdale Co. stock currently sells for $73.31 per share and has a beta of 1.24. The market risk premium is 6.90 percent and the risk-free rate is 2.82 percent annually. The company just paid a dividend of $4.37 per share, which it has pledged to increase at an annual rate of 3.25 percent indefinitely. What is your best estimate of the company's cost of equity?
Multiple Choice
9.13%
9.53%
7.88%
10.39%
11.19%
In: Finance
***Using Java
Using the switch/case construct, write a program that takes a character from the user and classifies it as a number (‘1’,’2’, ‘3’, …), a letter from the alphabet (‘A’, ‘a’, ‘B’, ‘b’, …, ‘Z’, ‘z’), an arithmetic operator (‘+’, ‘-‘, ‘/’, ‘*’, ‘%’), a comparison operator (‘<’, ‘>’, ‘=’), punctuation (‘!’, ‘?’, ‘,’, ‘,’, ‘:’, ‘;’), and all other characters as a Special Character, and informs the user of the same.
If the user entered the character A, the system should say: “You entered a letter!”
If the user entered the character (, the system should say: “You entered a special character!”
In: Computer Science
Write a java program
The last digit of a credit card number is the check digit, which protects againts transaction errors. The following method is used to veryfy credit card numbers. For the simplicity we can assume that the credit card has 8 digits instead of 16. Follwing steps explains the algorithm in determining if a credit card number is a valid card.
Starting from the right most digit, form the sum of every other digit. For example, if the credit card is number is 43589795 then you form the sum 5+7+8+3 = 23
1
Double each digit that we have not included in the preceding step. Add all digits of resulting numbers. For example, with the number given above, doubling the digits starting with next to last one, yields 18, 18, 10, 8. Adding all digits in these values yield 1+8+1+8+1+0+8 = 27
Add sum of the two preceding steps. If the last digit of the result is zero, then the number is valid number
Write a Java program that implements this algorithm (Designing your solution and perhaps wring the algorithm in pseudocode might be helpful). Your program should ask the user 8 digit credit card number and the printout if the credit card is valid or invalid card
Grading Criteria:
a) The correctness of your program/solution
b) Variable naming (self describing)
c) Identification of proper data type and constants (if applicable)
d) Appropriate commenting and Indentation.
NOTE: the given card number 43589795 should produce a valid number
In: Computer Science
Do you think that human beings are essentially good or bad, or a combination of both? Why? Argue for, and bring evidence to support, the position you have taken. How does your position affect your approach to morality - for example, should a moral system be strict, clear, and absolutistic, or, permissive, flexible, and relativistic? Your answer should be in essay form, and a minimum of 500-700 words in length.
In: Psychology
/*
* Add operation counts
* f(N) formula (show your work)
* O(N) reduction -
*/
public static long sum2(int N)//f(N) = ; O(N) =
{
long opCount = 0;
long sum = 0;
for(int i = 0; i < N; i++)
{
for(int j = 0; j
< N; j++)
{
sum++;
}
}
System.out.println("f(N) = [your
answer]");
System.out.println("O(N) = [your
answer]");
System.out.println("OpCount :
"+opCount);
return sum;
}
In: Computer Science
The space shuttle carries about 7.35×104 kg of solid
aluminum fuel, which is oxidized with ammonium perchlorate
according to the following reaction:
10Al(s)+6NH4ClO4(s)→4Al2O3(s)+2AlCl3(s)+12H2O(g)+3N2(g)
The space shuttle also carries about 6.02×105 kg of
oxygen (which reacts with hydrogen to form gaseous water).
Part A
Assuming that aluminum and oxygen are the limiting reactants, determine the total energy produced by these fuels. (ΔH∘ffor solid ammonium perchlorate is -295 kJ/mol.)
Part B
Suppose that a future space shuttle was powered by matter-antimatter annihilation. The matter could be normal hydrogen (containing a proton and an electron) and the antimatter could be antihydrogen (containing an antiproton and a positron). What mass of antimatter would be required to produce the energy equivalent of the aluminum and oxygen fuel currently carried on the space shuttle?
In: Chemistry
Why is the applicability of statistical quality control (SQC) an important attribute of an MTS operation? Why is it not applicable to an MTO operation?
In: Civil Engineering