Create a c program that takes 1 parameter, a number
using that number, dynamically allocate a memory so you store that number of integers
write integers in order starting from 1 until you fill all that memory
print the address and values of the first and the last integer stored in the memory
In: Computer Science
9. Generate a random number between 1 and 8, which is the computer’s number. Ask the user to guess a number between 1 and 8. Write a sentinel-controlled loop to continue to executed until the user’s guess matches the computer’s number. If the user's guess matches the random number, print a message in green on the SenseHat congratulating the user and then break out of the loop. Otherwise, print a message in red on the SenseHat to ask the user to try again.
10. Write nested for loops that print out the value of each index
for each iteration through the loop. The first loop should start at
1 and end at 3 and the second loop should start at 10 and end at
1.
11. Create a grocery store application. Prompt the user to input
the number of the number of items, name of the item, and the price
each. Use a while with sentinel control to exit the loop when the
user enters a number of items less than or equal to 0. At each
iteration of the loop, compute the cost of the items as the number
of items times the price each. Print out the name of the item and
the cost formatted with seven spaces and two decimal places of
precision at each iteration. (Hint: Use a priming read for the
number of items before you enter the while loop. Within the loop
read in the name of the item and the price each and perform the
calculation of the cost. Add a loop read that will read in the
number of items at the end of the loop code.)
12. Modify the grocery store application in problem 11 to compute
the accumulated cost of all items purchased. Prompt the user for
the sales tax rate. Compute the sales tax as the sales tax rate
times the accumulated cost. Compute the total cost as the
accumulated cost plus the sales tax. Print out the total cost
formatted with seven spaces and two decimal places of
precision.
In: Computer Science
For this grouped data;
Number pieces produced Number of workers
5 - 19 6
20 - 34 17
35 - 49 21
50 - 64 29
65 - 79 23
80 - 94 15
95 - 109 10
a) Find the class boundaries (5p)
b) Find the class marks (5p)
c) Find the class interval (5p)
d) Draw a histogram of the distribution (10p)
e) Estimate and draw to a cumulative "less than" distribution
(10p)
f) Calculate the mean, the median and the standard deviation of the
distribution and
determine the Pearsonian coefficient of skewness (10 p)
In: Statistics and Probability
Credit Card Number Check. The last digit of a credit card number is the check digit, which protects against transcription errors such as error in a single digit or switching two digits. The following method is used to verify actual credit card number but, for simplicity, we will describe it for numbers with 8 digits instead of 16: Starting from the rightmost digit, form the sum of every other digit. For example, if the credit card number is 43589795, then you form the sum 5 + 7 + 8 + 3 = 23. Double each of the digits that were not included in the preceding step. Add all the digits of the resulting numbers. For example, with the number given above, doubling the digits, starting with the next-to-last one, yields 18 18 10 8. Adding all digits in these values 1 + 8 + 1 + 8 + 1 + 0 + 8 = 27. Add the sums of the two preceding steps. If the last digit of the result is 0, the number is valid,. In our case, 23 + 27 = 50, so the number is valid. Write a program that implements this algorithm. The user should supply an 8-digit number, and you should print out whether the number is valid or not. If it is not valid, you should print out the value of check digit that would make the number valid.
thanks for help :)
In: Computer Science
Credit Card Number Check. The last digit of a credit card number is the check digit, which protects against transcription errors such as an error in a single digit or switching two digits. The following method is used to verify actual credit card numbers but, for simplicity, we will describe it for numbers with 8 digits instead of 16:
• Starting from the rightmost digit, form the sum of every other digit. For example, if the credit card number is 4358 9795, then you form the sum 5 + 7 + 8 + 3 = 23.
• Double each of the digits that were not included in the preceding step. Add all digits of the resulting numbers. For example, with the number given above, doubling the digits, starting with the next-to-last one, yields 18 18 10 8. Adding all digits in these values yields 1 + 8 + 1 + 8 + 1 + 0 + 8 = 27.
• Add the sums of the two preceding steps. If the last digit of the result is 0, the number is valid. In our case, 23 + 27 = 50, so the number is valid. Write a program in Java that implements this algorithm without utilizing arrays. The user should supply an 8-digit number, and you should print out whether the number is valid or not. If it is not valid, you should print the value of the check digit that would make it valid.
In: Computer Science
Number of patients = 3,293
Number of patients who had a positive test result and had the disease = 2,184
Number of patients who had a negative test, and did not have the disease = 997
Number of patients who had a positive test result, but did not have the disease = 55
Number of patients who had a negative test result, but who had the disease = 57
In: Statistics and Probability
Match a student number: Write a function MatchStudentNumber that takes a student number from the StudentNumber column in the reference table and determine if there is a match with a student number from the StudentNumber column in the second table. The output is a logical flag that is true if at least one match was found, and integer array that points to rows in table where a match occurred. Note that the function should find all matches.
function [iflag, matchPosition] =MatchStudentNumber(studentnumber, tableToFindRecord)
% Inputs: studentnumber: studentname from StudentNumber column in the reference table
% tableToFindRecord: table of any size
% Outputs: iflag: logical flag that is true if at least one match was found, and
% matchPosition: integer array that points to rows in table where matches occurred.
%MATLAB
end
In: Computer Science
1.Write a Java program that inputs a binary number and displays the same number in decimal.
2.Write Java program that inputs a decimal number and displays the same number in binary.
In: Computer Science
String inputStr;
double number;
try
{
inputStr =
JOptionPane.showInputDialog(null,
"Please input a number.");
if (inputStr.equals(""))
throw new IllegalArgumentException("Please enter a number");
number =
Double.parseDouble(inputStr);
JOptionPane.showMessageDialog(null,
"The square of the number is " + number * number);
}
catch (NumberFormatException e)
{
JOptionPane.showMessageDialog(null,
"Please enter a valid number to square");
}
catch (IllegalArgumentException e)
{
JOptionPane.showMessageDialog(null,
e.getMessage());
}
finally
{
System.exit(0);
}
1) First,Why must the two catch blocks be listed in the order that they appear? What is the expected output if the user does not enter anything into the input dialog? What is the expected output if the user enters “ten” into the input dialog? And then-What is the purpose of the throw statement located within the try block? What is the purpose of the finally block at the end of the code? Now assume the user must enter only positive numbers. Provide a very brief example of a customly thrown exception when the user enters a negative number. Then,What is the relationship between binary files and performing a random file access? Given a binary file consisting of a sequence of integers (int in Java), how must the file pointer be managed to correctly move to the start of each integer? Then, Briefly describe the process of object serialization and object deserialization. And How would you determine the size of an object in bytes?
All parts must be answered for question 1 to receive any credit.
In: Computer Science
Number of Police Officers (X) Number of Crimes
(Y)
0 10
20 10
30 40
a. Calculate the correlation coefficient and the covariance
b. Calculate the regression coefficient of the slope.
c. State the regression equation.
d. Interpret the meaning of the intercept and slopes in this equation. Be sure to explain using units.
e. Predict the number of crimes when the number of police officers is 7.
In: Math