Questions
C++ Programming Chapter 7 Assignment: Assignment #4 – Student Ranking : In this assignment you are...

C++ Programming Chapter 7 Assignment:

Assignment #4 – Student Ranking :

In this assignment you are going to write a program that ask user number of students in a class and their names. Number of students are limited to 100 maximum. Then, it will ask for 3 test scores of each student. The program will calculate the average of test scores for each student and display with their names. Then, it will sort the averages in descending order and display the sorted list with students’ names and ranking.

Follow the Steps Below

  1. Save the project as A4_StudentRanking_yourname.
  2. Use functions to divide your program into manageable pieces. Define three functions: displayList, findAverage, and sort.
    1. Write function prototypes at the top and define the functions after the main function.
  3. findAverage function:
    1. This function will get 4 parameters: array of student names, 2D array of grades from 3 tests of each student, array of averages to fill in, number of students as the arrays size.
    2. You need nested for loop to calculate average of 3 test scores for each student and record it to the array of averages. (You may define array of names and 2D array of grades as constants in the parameter list since you don’t need to make any changes.)
    3. No return value needed; changes will apply on the original array of averages.
  4. displayList function:
    1. This function has 3 parameters: array of student names, array average scores, and the size of the arrays.
    2. The function doesn’t make any changes on the arrays, so define them as constants in the parameter list.
    3. Call the function twice in your program
      1. When averages are calculated
      2. When averages are sorted
  5. sort function:
    1. This function gets 3 parameters: array of students, array of averages, and number of students as the size of the arrays.
    2. Use selection sort algorithm. Sort both arrays based on the average scores in descending order. (You will apply the sort on the array of averages by comparing the scores, but apply the swapping on both arrays. They are parallel arrays. This means they use the same index numbers.)
  6. Define constants as global constants. Do not use any literal in the program, use their identifiers.
  7. Write function prototypes.
  8. Keep variable definitions local.
  9. At the beginning of the program inform user about the program. Display a message stating that they can enter 3 test scores and any number of students limited to 100.
  10. Ask for number of the students to user.
  11. Array of students, test scores, and averages are parallel arrays. This means they store related data in the same subscript.
  12. The array of test scores is a two-dimensional array. First subscript holds number of students and second subscript holds number of test scores.
  13. Validate user input with a while or do-while loop. They shouldn’t exceed the maximum number; also, it can’t be less than 1.
  14. Ask for the student names and their test scores. Use getline function to get the students’ full names. You must use cin.ignore() before using the getline function since you also use cin object.
  15. Call findAverage function.
  16. Call displayList function.
  17. Call sort function.
  18. Call displayList function.
  19. Use comment lines to describe block of code statements in the program.

In: Computer Science

2. A student brings 8 chocolate chip cookies, and 7 oatmeal raisin cookies, to his seminar...

2. A student brings 8 chocolate chip cookies, and 7 oatmeal raisin cookies, to his seminar of 5 students and 1 teacher. If all the cookies are eaten, how many distributions of the cookies to the class are there?
(a) (5 points) List some possible distributions of the chocolate chip cookies, and symbolize each of these using
c’s and |’s.
(b) (5 points) Use o’s and |’s to list an impossible distribution of the oatmeal raisin cookies.

(c) (5 points) How many distributions of the cookies are there?

In: Statistics and Probability

Juan Reyes Dela Cruz, single and a Filipino citizen, died on February 14, 2020. At the...

Juan Reyes Dela Cruz, single and a Filipino citizen, died on February 14, 2020. At the time of his death, he resides in N. Reyes St., Sampaloc, Manila.

In filing his estate tax return, the BIR RDO No. 032 – Manila assigned Taxpayer Identification No. 123-456-789-0000 to his estate. On the other hand, YOU, as the administrator of his estate was given TIN no. 987-654-321-0000.

The following are the composition of his estate:

Lot                                                                 
House and Lot (Family home)                       
Cash (Bank of Macabebe – Account No. 14344) – Php 2,000,000.00                                               

Additional information:

Details

Lot

House and Lot

Title No.

001

002

Tax Declaration No. - Land

11-01

11-02

Tax Declaration No. - House

11-03

Location

San Isidro, Macabebe, Pampanga

N. Reyes St, Manila

Area

100 sqm

100sqm

Classification

Agricultural

Residential

Details

Zonal Value

Assessed Value

Lot in Pampanga

Php 3,000,000.00

Php 1,000,000.00

Lot in Manila

Php 3,000,000.00

Php 2,000,000.00

House

Php 2,000,000.00

In: Accounting

A cohort study of smoking and bladder cancer was conducted in a small island population. There...

  1. A cohort study of smoking and bladder cancer was conducted in a small island population. There were a total of 1,000 people on the island. Four hundred were smokers and 600 were not. Fifty of the smokers developed bladder cancer. Ten of the non-smokers developed bladder cancer.
    1. What is the exposure and what is the disease?
    2. Set up the two by two table for these data with labels for exposures and disease status.
    3. Which measure of association/comparison should we use to assess the strength of the relationship between the exposure and disease?
    4. Calculate the correct measure and show your work.
    5. How do we interpret this effect estimate?

In: Nursing

You are interested in doing research on COVID-19. Provide example questions/objectives that you can research with...

You are interested in doing research on COVID-19. Provide example questions/objectives that you can research with each of the following designs: cross-sectional survey, case report, case series, retrospective cohort, and randomized-controlled trial. Make sure it is clear to me that you understand the type of study (give enough information; provide direction; what would be ascertained first in terms of outcomes and exposure/risk).

In: Statistics and Probability

Detail, with very specific examples of each item, the meaning of the following concepts related to...

Detail, with very specific examples of each item, the meaning of the following concepts related to statistical data gathering: Be sure that the concept is first defined, IN YOUR OWN WORDS, and that you use a concrete example (including visual examples) to illustrate your understanding of the statistical concept: Cohort; Placebo; Prospective Study; Retrospective Study; Cluster; Control Group; Mean; Median; Mode; Histogram; Outlier; Pie Chart;

In: Psychology

Shown here is the sort.c program which takes data.txt and sorts it. If I have found...

Shown here is the sort.c program which takes data.txt and sorts it. If I have found the addresses for system(), exit(), and “/bin/sh”, how would I do the following by ONLY changing the contents of data.txt?: 1) open the shell code 2) exit cleanly fron the shell code all while 3) not receiving a seg fault.

I beleive the correct answer is to have about 18-19 rows of aaaaaaaa followed by the three addresses so that when the stack starts to pop off one of the new addresses will be in the olace of the sort return address.

Here is the code in plain text:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

/*
* a toy program for learning stack buffer
* overflow exploiting
* It reads a list of hex data from the
* specified file, and performs bubble sorting
*/

#define SORT_ME 1 //Comment this out and recompile if you do not want the function to sort your values.

long n = 0, c = 0, d = 0, v = 0;

FILE *fp = NULL;

void SortData()
{
long swap = 0;
long array[17];

// loading data to array
printf("Source list:\n");
char line[sizeof(long) * 2 + 1] = {0};
while(fgets(line, sizeof(line), fp)) {
if (strlen((char *)line) > 1) {
sscanf(line, "%lx", &(array[n]));
printf("0x%lx\n", array[n]);
++n;
}
}
fclose(fp);

#ifdef SORT_ME   
for (c = 0; c < (n - 1); c++)
{
v = c;
for (d = ( c + 1 ); d < n; d++)
{
if (array[d] < array[v])
{
// Swap the found minimum element with the first element
swap = array[d];
array[d] = array[v];
array[v] = swap;
}
}
}
#endif

// output sorting result
printf("\nSorted list in ascending order:\n");
for ( c = 0 ; c < n ; c++ )
printf("%lx\n", array[c]);

}

int main(int argc, char **argv)
{
if(argc!=2)
{
printf("Usage: ./sort file_name\n");
return -1;
}

// From http://stackoverflow.com/questions/5141960/get-the-current-time-in-c
time_t rawtime;
struct tm * timeinfo;

time(&rawtime);
timeinfo = localtime(&rawtime);
printf("Current local time and date: %s\n\n", asctime(timeinfo));
  
fp = fopen(argv[1], "rb");
SortData();

return 0;
}

In: Computer Science

1. The following is the frequency distribution table of the marks scored by candidates in an...

1. The following is the frequency distribution table of the marks scored by candidates in an examination.
Marks 0-9 10-19 20-29 30-39 40-49 50-59 60-69 70-79 80-89 90-99
frequency 2 7 8 13 24 30 6 5 3 2

A. Make a cumulative frequency table and use it to draw the cumulative frequency curve for the distribution
B. Use your graph to estimate
I. The median mark
II. The lower quartile
III. The upper quartile
IV. The inter quartile range
V. The pass mark if the 60 percent of students passed
VI. The 40th percentile
VII. The 20th percentile
C. Calculate the following
I. Mode
II. Median
III. Standard deviation
IV. Co efficient of variation
V. Skewness

In: Statistics and Probability

Place 4 charges at the corners of a square which is 2 meters by 2 meters...

Place 4 charges at the corners of a square which is 2 meters by 2 meters (4 large squares along each length). Place two +1 nC charges at adjacent corners and two -1 nC charges at the other two corners.

Determine the direction of the electric field at the following three points:
Point E halfway between two like charges. (-120 degrees, 50 V/m)
Point F halfway between two opposite charges. (-90.5 degrees, 309 V/m)
Point G at the center of the square. (90 degrees, 210 V/m)

1. For the points E, F and G, draw a diagram showing both charges and the two individual field vectors (one for each charge) and explain why their vector sum points in the direction that you.

2. Determine the electric potential at the points E, F and G. List them numerically and give an explanation for their value  

In: Physics

lamda1 = 3.7 uC/cm pic for#1 1) A cylinder of radius a = 6.4 cm and...

lamda1 = 3.7 uC/cm




lambda 1 = 3.7 uC/cm A cylinder of radius a = 6.4pic for#1


1) A cylinder of radius a = 6.4 cm and height h = 11.9 cm is aligned with its axis along the y-axis as shown. What is the total flux ? that passes through the cylindrical surface? Enter a positive number if the net flux leaves the cylinder and a negative number if the net flux enters the cylnder.








lambda 1 = 3.7 uC/cm A cylinder of radius a = 6.4pic for #2


2)Another infinite line of charge with charge density ?2 = -11.1 ?C/cm parallel to the y-axis is now added at x = 3.05 cm as shown.

What is the new value for Ex(P), the x-component of the electric field at point P?



3)What is the total flux ? that now passes through the cylindrical surface? Enter a positive number if the net flux leaves the cylinder and a negative number if the net flux enters the cylnder.







lambda 1 = 3.7 uC/cm A cylinder of radius a = 6.4pic for #4

4)The initial infinite line of charge is now moved so that it is parallel to the y-axis at x = -3.05cm.

What is the new value for Ex(P), the x-component of the electric field at point P?



5)What is the total flux ? that now passes through the cylindrical surface? Enter a positive number if the net flux leaves the cylinder and a negative number if the net flux enters the cylnder.




lambda 1 = 3.7 uC/cm A cylinder of radius a = 6.4 cm and height h = 11.9 cm is aligned with its axis along the y-axis as shown. What is the total flux ? that passes through the cylindrical surface? Enter a positive number if the net flux leaves the cylinder and a negative number if the net flux enters the cylnder.

In: Physics