Provide Comments To Fellow Students Answers And Please Dont Say Good ✓ Solved
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY GOOD WORK NICE FORMULA OR SOMETHING LIKE THAT, BUT ACTULLY HE CAN USE. THANK YOU. Hartleys Function Code Contains unread posts Actions for Hartleys Function Code Chad Hartley posted Nov 5, 2015 5:10 PM Subscribe This program will add an integer number and a decimal number up to 2 decimal places. I have included notes in the code to explain what each thing does. I hope I did this right.
It compiles successfully. PseudoCode Start Declare int O1; Stands for Output1 O1=sum; Sum is the functions name Int sum() Declare variables Int num1; Float num2; Write “Enter a number.†Scanf num1 Writeâ€Enter a decimal number.†Scanf num2 Return num1+num2 end C Code #include <stdio.h> int sum();//prototype int main()//calling program { //Declare a varaiable int O1; O1=sum();//main is calling sum one time. //if I listed this twice it would run the function 'sum' twice. // Example: if I add a new int (int O1, O2) and declare O2 to //be O2=sum then the function would run twice. } int sum ()//function 'sum' { int num1;// Declare intergers/variables float num2; printf("Enter a number.\n"); scanf("%d",&num1);// Take first input and assign it to num1 printf("Enter a decimal number.\n"); scanf("%.2f",&num2); //Can use the printf statement but when you are calling an integer you can use the return. //printf("The sum of %d, %d, is %d", num1,num2,num1+num2); return num1+num2; } ADD COMMENT HERE Chaotic Function Contains unread posts Actions for Chaotic Function Joshua Ray posted Nov 5, 2015 2:33 PM Subscribe float tmp int i function float chaos(float num) { for i < 20 num = 3.9*num*(1-num) print num } main print "Program description" print "Request input btw 0 and 1" tmp = input chaos(tmp) /* * File: main.c * Author: JaiEllRei * * Created on November 5, 2015, 2:04 PM */ #include <stdio.h> #include <stdlib.h> float chaos(float num); int main(void) { float tmp; printf("This program illustrates a choatic function. \n"); printf("Input a number between 0 and 1: "); scanf("%f", &tmp); chaos(tmp); } float chaos(float num) { for (int i=0; i<20; i++){ /*Chaotic Formula*/ num = 3.9 * num * (1-num); printf("%.3f \n", num); } } This program illustrates a choatic function.
Input a number between 0 and 1: .2 0.624 0.915 0.303 0.824 0.566 0.958 0.156 0.514 0.974 0.098 0.345 0.881 0.409 0.943 0.210 0.647 0.891 0.379 0.918 0.293 ADD COMMENT HERE //MPH to KPH Conversion Function Function KPHConv(value) as float Set KPHConv = value*1.609344 End Function Pseudocode for simple conversion program calling function //Declare function // MPH to KPH Conversion Function Function KPHConv(value) as float Set KPHConv = inMPH*1.609344 End Function //Start Main Main //Declare variables Declare inMPH, outKPH as Float //Initialize variables inMPH = 1.0f; outKPH = 0.0f; Print “Enter a positive value for Miles Per Hour (MPH) or ‘0’ to exit the program Input inMPH //Loop while positive number While inMPH > 0 //Call the MPH to KPH conversion function Set outKPH = KPHConv(inMPH) Print “inMPH miles per hour converts to outKPH kilometers per hour†Input next inMPH value END While // End of Main program End program C Code #include <stdio.h> //Week 6 Discussion //Author: Ken Hartman //CMIS //Prof.
Stephen Grady //This program will convert a value for Miles Per Hour (MPH) //to Kilometers Per Hour (KPH) /* MPH to KPH Conversion Function */ float KPHConv(float value) { return value*1.609344; } /* Start of Main program */ int main() { /* Declare variables to be used as float */ float inMPH; float outKPH; /* Initialize the variables needed */ inMPH = 0.0f; printf("Enter a value for Miles Per Hour (MPH) or 0 to exit the program \n"); scanf("%f", &inMPH); /* Loop while a positive number is entered */ while (inMPH > 0.0) { outKPH = KPHConv(inMPH); printf("\n %.2f miles per hour converts to %.4f kilometers per hour\n",inMPH, outKPH); scanf("%f", &inMPH); } return 0; } ADD COMMENT HERE!!!! Joseph Sturdivant posted Nov 6, :52 PM Subscribe #include <stdio.h> /* First question output: * High number = 4 * Low number = 7 [because gettable function receive and return integer value] */ // function which looking for largest number in array int largest(int array[], int size); int function(int x) { return x; } // main function int main() { int array[100]; // array where integers will be stored int count=0; // how many integers entered int number; // represent another integer from input printf("High = %d\n",function(7.8)); printf("Enter integers (0-terminate): \n"); do { scanf("%d",&number); // read one integer array[count++]=number; // store it into array } while(number!=0); // print result of "largest" function printf("Largest number is %d\n",largest(array,count-1)); return 0; } int largest(int array[], int size) { int i; int max=array[0]; // largest value will be stored here for(i=1; i<size; i++) { if(array[i]>max) max=array[i]; } return max; // return largest value } ADD COMMENT HERE Thomas Week 6- Solving Functions Discussion Contains unread posts Actions for Thomas Week 6- Solving Functions Discussion Thomas Blass posted Nov 5, 2015 8:08 PM Subscribe 1.
Two arrays are provided, one float array and one integer array. Functions are used to display the highest number from the float array and the lowest number from the integer array. The first function (gettable) will determine the lowest number from the designated set in the “main†function. Then the second function (getTable) will determine the highest number from the designated set in the “main†function. So the expected output for this pseudocode should be: “High number= 4 Low number= 7.8†The only possible error I see here is that there might be an error with data types.
It looks like when the “table1†array is defined it is of the float data type, but the function pseudocode for “getTable†is requesting integer data type. I thought that this might cause an error when the function “getTable†is called because of different data types. Has anyone noticed the same or am I incorrect? Professor? Class?
2. Algorithm and C code posted below! Took me a few tries to figure out the best approach here. //Pseudocode //This program will accept input of positive integers terminated by 0, then determine //the largest integer that was entered //Largest integer function Declare function largest_number as integer Declare largest,j as integer Set j=0 Set largest=user_array element 0 While(j<100000) If(largest<user_array[j]) then Set largest=user_array[j] End if Increment j End while Return largest End function Main function //Declare variables Declare user_array[100000] as integer Declare number, i, q, largest as integer //Initialize the array for(q=0;q<100000;q++) user_array[q]=0 //Initialize variables set i=0 //While loop for array entry while(i<100000) print “please enter a positive integer: “ input number if(number==0) then break end if set user_array[i]=number increment i //Print largest number largest=largest_number(user_array) print “The largest number is: “ return 0 End program C code: // // main.c // CMIS102 Solving Functions Discussion // Created by Thomas Blass on 11/5/15. #include <stdio.h> #include <stdlib.h> //largest integer function int largest_number(int user_array[]) { int largest,j; j=0; largest=user_array[0]; while(j<100000) { if(largest<user_array[j]) { largest=user_array[j]; } j++; } return largest; } int main() { //Declare variables int user_array[100000]; int number,i,q,largest; //Initialize array for(q=0;q<100000;q++) { user_array[q]=0; } //Initialize variables i=0; //while loop for array entry while(i<100000) { printf("Please enter a positive number: \n"); scanf("%d",&number); if(number==0) break; user_array[i]=number; i++; } //Print largest number largest=largest_number(user_array); printf("The largest number is: %d\n",largest); return 0; } ADD COMMENT HERE Vathavadee Smakpunt posted Nov 4, :12 PM Subscribe Hello all; 1) The output I got is: High number = 4 Low number =7.8 2) I created function to return maximum number from 3 values. #include <stdio.h> //Set getMax function from array int getMax(int number[]) { //Declare integer i, max int i, max; //Set value for max max = number [0]; //Set i to zero i=0; //Set condition while loop while (i< 3) { scanf("%d", &number[i]); if(max<number[i]) { max=number[i]; } i=i+1; } return max; } main () { /*Declare number[3], max, and i as integer*/ int number[3], max, i; /*Set value for max*/ max = getMax(number[0]); /*Print result*/ printf("Max is =%d\n",max); } ADD COMMENT HERE Follow all instructions carefully in presenting your answers.
Be sure to show all your working . (Handwritten responses are fine.) You will not need SPSS for questions 1-3. For question 4, please download the housing dataset (from Latte), then import it into SPSS for analysis. 1) Jet Blue Airlines examined the bags of 80 passengers and found that 20% of the bags were overweight. a) Based on this sample, what is the 95% confidence interval for the proportion of bags that are overweight? [6 points] b) What is the minimum sample size the airline would need to estimate with 95% confidence to obtain a margin of error of +/- 3% for this estimate of the percentage of overweight bags? [6 points] 2) A factory recently took a sample to assess the quality of its candy output, looking at three different types of candy, and how many of each type of candy were damaged during the manufacturing process: Candy # damaged Total # candies counted Apple hard candy Chocolate chew Nut cluster The factory management would like to determine whether the proportion of candy that is damaged is different for these three types of candy. a) Construct a contingency table for these data. [2 points] b) Is the proportion of candy that is damaged different for these three types of candy? (Calculate the appropriate statistic, give the p-value, and state your conclusion.) [6 points] 3) A manufacturer of headphones is interested in the sales of a particular headphone model in its stores in 8 airports.
Some of these stores are located on the West and some on the East coast of the U.S. Also, the manufacturer recently conducted an advertising campaign. The sales before and after the advertising campaign, which it ran in February using billboards in the airports, are shown below (i.e., data for sales in those stores in January and data for sales in the same stores for March.) (Some descriptive statistics have also been provided in the table. You will need to decide which ones you need for your calculations in answering the questions below.) Store Location Sales in Jan Sales in March Change in sales 1 East coast East coast East coast East coast West coast West coast West coast West coast Summary statistics All stores Mean 175...88 SD 56...68 East coast Mean 220...25 SD 20...50 West coast Mean 131...50 SD 42...14 To get full points when answering each part below be sure to: calculate an appropriate statistic, state the result of the test, and state your conclusion. a) Looking at all the stores, is there a difference in sales between January and March? [6 points] b) Did the campaign have a different effect on sales for stores on the East coast versus on the West coast? [6 points] c) Was there a difference in sales in January for stores on the East coast versus on the West coast? [6 points] 4) Below are data for 40 houses located in one of two neighborhoods (A or B). (This data is also provided in an Excel spreadsheet on the website for the class.
Open the data in SPSS and conduct the analyses required to answer the questions. Be sure to paste output (i.e., tables) from SPSS into your answers where that is requested or else you will lose points.) Neighborhood Appraised Land Value Appraised Value of Improvements Sale Price Has a yard? (yes/no) A no A no A no A no A yes A yes A yes A yes A yes A yes A yes A yes A yes A yes A yes A yes A yes A yes A yes A yes B no B no B no B no B no B no B no B no B no B no B no B no B no B no B yes B yes B yes B yes B yes B yes a) Give appropriate summary statistics (one measure of central tendency and one measure of variation) for each of the 3 variables Appraised Land Value, Appraised Value of Improvements, and Sale Price, calculated separately for neighborhoods A and B.
Important: PROVIDE ONLY ONE (APPROPRIATE) CENTRAL TENDENCY MEASURE AND ONE (APPROPRIATE) MEASURE OF VARIATION FOR EACH VARIABLE FOR EACH NEIGHBORHOOD. [6 points] b) Based on this data sample, do neighborhoods A and B differ in the number of houses with and without yards? In your answer be sure to calculate an appropriate statistic, state the result of the test, and state your conclusion. (Paste the output from SPSS for the statistical test that you do in your answer, as well as stating your conclusion and writing out the appropriate statistic that supports your conclusion.) [6 points] c) Based on this data sample, do houses in neighborhoods A and B have different sale prices? (In your answer be sure to calculate an appropriate statistic, state the result of the test and state your conclusion.) (Paste the output from SPSS for the statistical test that you do in your answer, as well as stating your conclusion and writing out the appropriate statistic that supports your conclusion.) [6 points] d) Provide a correlation matrix for Appraised Land Value, Appraised Value of Improvements and Sale Price for neighborhood B only (you will need to split the data to do this – in SPSS under the Data menu use the "split file" command, split by neighborhood, and select "organize output by groups").
In words, explain the meaning of the correlation between Sale price and Appraised Land Value and the meaning of the correlation between Appraised Land Value and Appraised Value of Improvements. [6 points] Note : make sure you deselect "split file" after doing this question part, so that you analyzing all the cases for the next two parts. e) Imagine you are interested in the relationship between house Sale price and Appraised Land Value while controlling for any effects of Appraised Value of Improvements. Conduct a linear regression that allows you to test this relationship (using data for all the houses, i.e., from both neighborhoods). State your conclusion about the relationship, and provide the statistics that support your conclusion. (Paste your SPSS output for this regression into your answer.) [6 points] f) Imagine you are interested in the relationship between house Sale price and Neighborhood, while controlling for any effects of Appraised Land Value and Appraised Value of Improvements on Sale price.
Conduct a linear regression that allows you to test this relationship. State your conclusion about the relationship, and provide the statistics that support your conclusion. (Paste your SPSS output for this regression into your answer.) [6 points]
Paper for above instructions
Comments on Fellow Students' Assignments
Chad Hartley’s Function Code Comments
Your code for summing an integer and a decimal is generally structured, but there are some areas for improvement. Firstly, you may want to clarify the data types more explicitly in your comments to enhance readability for someone just starting with C programming. For example, you define `num1` as an integer and `num2` as a float, but their conceptual purpose could be outlined clearly in the comments (like what kind of inputs are expected). Furthermore, in `scanf("%.2f", &num2);`, it should just be `scanf("%f", &num2);`. The `%.2f` format specifier is used in `printf`, not in `scanf`. This change will help the program accept float inputs correctly.
Joshua Ray’s Chaotic Function
The chaotic function you've proposed captures interesting dynamics; however, the loop structure in your pseudocode is not correctly formatted. It requires the complete syntax to maintain clarity. Instead of `for i < 20`, it should be `for (i = 0; i < 20; i++)`. Additionally, consider adding more informative output or documentation regarding the significance of the numbers produced in this chaotic model. A brief explanation of what the result indicates about chaos theory could help non-experts grasp the output's importance.
Ken Hartman’s MPH to KPH Conversion Function
Your implementation of the MPH to KPH conversion is straightforward, but it seems like you're missing an important input check. What happens if a user inputs a negative value? After checking for `0` to exit, there should ideally be a validation step to ensure the input remains positive, providing user feedback in the case of erroneous input. Additionally, consider stating which libraries are necessary at the top, enhancing clarity in your #include directives.
Joseph Sturdivant’s Largest Number Function
Your approach to finding the largest number from an array is mostly correct; however, you're overlooking edge cases. If no numbers are inputted (e.g., if the first value is `0`), this will lead to undefined behavior. It’s crucial to incorporate a check after input collection to ensure that the array actually contains values before proceeding to find the maximum. Furthermore, it may help to improve user interactivity by confirming when a number is read successfully.
Thomas Blass’s Functions for Candy Damage
Your analysis on the candy damages showcases a good understanding of proportions. However, you missed tying in the statistical reasoning in determining whether damage proportions significantly differ across candy types. Consider applying a chi-square test or ANOVA, whichever is appropriate, and clearly laying out the steps for computation and the response. Interpreting the result with a practical example could solidify the understanding of what the statistical finding means in a real-world context.
Vathavadee Smakpunt’s Max Function
Your function to determine the maximum from three values is sound, but consider modifying its flexibility concerning the number of inputs. Instead of being limited to three, parameterizing the size could allow for arbitrary inputs. Moreover, handling input errors (like non-integer values) in `scanf` with a full prompt could prevent runtime errors. Explicit comments outlining both what the function does and how it works would improve maintainability.
General Feedback
1. Data Type Handling: Across the various contributions, pay special attention to the proper use of data types and consider incorporating error checks to manage exceptions effectively.
2. Commenting Practices: While most submissions included comments, they could be more detailed. For instance, adding assumptions or expected behaviors in your comments helps future users who might not be familiar with the specific implementations.
3. Structured Output: Outputs can be enhanced for clarity. Instead of simply printing numbers, provide context about what the user is seeing. For example: "The result of adding your numbers is: X" instead of just a solitary number.
4. Input Validations: It’s critical to ensure that the user inputs are validated before performing operations, particularly with functions that involve mathematical calculations.
5. Testing and Validation: Consider adding unit tests or pseudo-tests in your pseudocode to describe what kinds of scenarios your function should handle, encouraging a systematic approach to debugging and verifying functionality.
This feedback not only aims to strengthen your one another's logic and coding skills but also to enhance the user experience through improved clarity and structure. Encourage dialogue on these aspects to foster a better understanding within the discussion group!