Lv 1131 points

?

• Program to calculate the mean, standard deviation and letter grades in C++?

My task is: Letter grades are sometimes assigned to numeric scores by using the grading scheme commonly known as grading on the curve. In this scheme, a letter grade is assigned to a numeric score as follows (where m is the mean grade and sd is the standard deviation):

<m-(sd*1.5) F

between 0.5 and 1.5 * sd below mean D

between 0.5*sd below and 0.5*sd above mean C

between 0.5 and 1.5*sd above mean B

>1.5*sd above mean A

The mean is the sum of all the scores divided by the number of scores.

Write a program to read in a list of real numbers, representing numeric scores storing them in a static array or a dynamic array (created using new), call functions to calculate the mean and standard deviation, and then call a function to calculate and display the letter grade & corresponding numeric score.

I have the following:

#include <iostream>

#include <cmath>

using namespace std;

double calculate_mean_sd (int arrcal[], int num);

double calculate_and_print_grades (int arrcal [], int num);

int main (void)

{ int arrcal [10],

num;

cout<<"Please enter the number of scores that you would like to determine the grades for: ";

cin>>num;

for (int i=0; i<num; i++)

cin>>arrcal[i];}

return 0;}

1 AnswerProgramming & Design6 years ago
• Linked list sorting in C programming?

Hello,

I am writing a program that queries a user for employee information such as a first name, last name, and a three digit employee id number. A struct and linked list are used to store the data. Traversing across the linked list occurs and the information of the employee with the highest id number is displayed.

I am not very certain on how to go about coding a way to determine the employee with the highest id number and printing that out.

I have the following:

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#define NO_EMP 4

typedef struct employee

{ char fname [21];

char lname [21];

int id;

struct employee *next;

}DATA;

DATA* insertit (DATA *first, char firstn[], char lastn[], int idnum);

int main (void)

{

*p;

char firstname[21];

char lastname[21];

int idnumber,

j,

k;

char ch,

nl;

for (j=0; j<21; j++)

firstname[j]=' ';

for(k=0; k<NO_EMP; k++)

{ printf("Please enter the employee's first name: \n");

scanf("%s", firstname);

printf("Please enter the employee's last name: \n");

scanf("%s", lastname);

printf("Please enter the employee's three digit id number: \n");

scanf("%d", &idnumber);

scanf("%c", &nl);

for (j=0; j<21; j++)

firstname[j]= ' ';

}

1 AnswerProgramming & Design6 years ago
• If else statement in C?

Hello,

I have a UPC program that I completed. Whenever I enter a valid UPC, the output reads that the UPC is incorrect. I have spent several hours reading and attempting to find a solution with no luck. I would appreciate it greatly if you could explain why the results are always incorrect based on my code. Thank you so much in advance!

void get_check (int upc[], int n)

/*Function to calculate the check digit if the last digit of the even numbered set is not the value of 0 by subtracting the last digit of sum_even from 10.

Version 1.0

Language: C (gcc target)

Post-condition: Check digit of array calculated, stored and then printed, but the array is not disturbed.

*/

{

int ans_even, /*Calculated value of the even numbered positions.*/

last_digit, /*Last digit of the even numbered position calculated value.*/

check_digit; /*Digit to determine if CPU is correct.*/

ans_even=last_digit;

if (last_digit==0)

{

check_digit=0;

}

else

{

check_digit=10-last_digit;

}

return;

}

void print_results(int upc[], int n)

/*Prints out the correctness or incorrectness of the UPC.

Version 1.0

Language: C (gcc target)

October/November 2014*/

{

int check_digit,

last_digit,

ans_even;

ans_even=last_digit;

if (check_digit==last_digit)

{

printf("The entered Universal Product Code (UPC) is correct.\n");

}

else

{

printf("The entered Universal Product Code (UPC) is incorrect.\n");

}

return;

}

1 AnswerProgramming & Design6 years ago
• UPC program in C language?

My professor sent me the following message: 'I entered an invalid UPC and your program reports it is valid....hint your problem is in your if statement....how many = signs are need for a test of equality?'

I changed the = signs and now all inputted UPCs are considered invalid even if they are correct.

Thank you so much!!

void get_check (int upc[], int n)

/*Function to calculate the check digit if the last digit of the even numbered set is not the value of 0 by subtracting the last digit of sum_even from 10.

Correctness or incorrectness of the check digit is then printed.

October/November 2014

Version 1.0

Language: C (gcc target)

Post-condition: Check digit of array calculated, stored and then printed, but the array is not disturbed.

*/

{

int ans_even, /*Calculated value of the even numbered positions.*/

last_digit, /*Last digit of the even numbered position calculated value.*/

check_digit; /*Digit to determine if CPU is correct.*/

last_digit=ans_even;

if (last_digit==0)

{

check_digit=0;

}

else check_digit=10-last_digit;

if (check_digit==upc[0])

{

printf("The entered Universal Product Code (UPC) is correct.\n");

}

else

{

printf("The entered Universal Product Code (UPC) is incorrect.\n");

}

return;

}

1 AnswerProgramming & Design6 years ago
• How to pass variables by reference in C?

I received an e-mail from my professor that stated: ' get_amount needs to get the user entry back to main, so you will have to change that from pass by value to pass by reference.'

/*Program to calculate to the least number of bills being dispensed from

an ATM based on the inputted amount desired with the limitation that the ATM only stocks \$50, \$20 and \$10 bills. A single function was used and three results were sent back to the calling function using

output parameters.Version 1.0 Language: C (gcc target)*/

#include <stdio.h>

#include <math.h>

void introduction (void);

void get_amount (int *amount_desired);

void calculate_and_print (int amount_desired,int * fifties, int * twenties, int * tens);

void print_results (int amount_desired, int * fifties, int * twenties, int * tens);

int main (void)

{ int amount_desired;

char do_again, junk;

do

{introduction( );

get_amount (int *amount_desired);

calculate_and_print (amount_desired, * fifties, * twenties, * tens);

print_results (amount_desired, * fifites, *twenties, *tens);

printf("Would you like to run this program again, Y/N: ");

scanf("%c %c", &junk, &do_again);}

while ((do_again =='Y') || (do_again=='y'));

return 0;}

2 AnswersProgramming & Design6 years ago
• Redeclared as different kind of symbol in C?

/*Program to calculate to the least number of bills being dispensed from

an ATM based on the inputted amount desired with the limitation that

the ATM only stocks \$50, \$20 and \$10 bills. A single function was

used and three results were sent back to the calling function using

output parameters.

Version 1.0 Language: C (gcc target)*/

#include <stdio.h>

#include <math.h>

void introduction (void);

void get_amount (int amount_desired);

void calculate_and_print (int amount_desired,int *fifties, int *twenties, int *tens);

void print_results (int amount_desired, int * fifties, int * twenties, int * tens);

int main (void)

{int amount_desired;}

void introduction (void)

/*Function to present purpose to user.

Version 1.0 Language: C (gcc target)*/

{printf ("This is a program to calculate the least number of bills needed to be\n");

printf ("dispensed from an ATM based on an entered desired amount.\n");

return;}

void get_amount (int amount_desired)

/*Function to capture the amount desired from the user.

Version 1.0 Language: C (gcc target)*/

{int amount_desired;

printf("Please enter an amount desired to be withdrawn from the ATM that\n");

printf("is some even multiple of \$10.\n");

scanf("%d", &amount_desired);

return;}

2 AnswersProgramming & Design6 years ago
• INF in C language?

Hello!

I am writing a program in the C language for homework about calculating a monthly payment based on the following formula: (i*P)/(1-(1+i)^-n).

I wrote the code and compiled it. However, when I attempted to execute the program, the monthly interest rate resulted in the value of inf.

I am certain that inf means infinite, however, this value definitely should not be the answer.

Please give a possible explanation to why the value is calculated to be inf.

Thank you all so much! (:

2 AnswersProgramming & Design6 years ago
• Using pow function in C?

Hello!

I have to write a program using the formula:

payment= (i*P)/(1-(1+i)^n).

i= monthly interest rate

P= principal or amount borrowed

n= number of payments

I was briefly taught that pow involves raising a number to a power with a simple example. However, now I am not so certain how to write the formula in C.

I thought: payment= (i*P)/(1(pow(1+i,-n))

Please explain the correct method of writing this formula in C.

Thank you all so much!! (:

1 AnswerProgramming & Design6 years ago
• Master Harold and the boys help?

Hello, I have various comprehension questions for the play "Master Harold and the boys". Upon discussion in my English class, my teacher said that Sam diagnosed Hally with something. I searched my book and could not find anything,

So, what is Sam's diagnosis of what is 'wrong' with Hally?

Thank you!! Have a great day!! (:

• "No oyes ladrar los perros" comprehension question?

I read this short story for Spanish class over break and I understand the story but I am not so certain of one of the comprehension questions.

The question was a true or false question in which I need o correct if it is wrong. The statement is: El padre creía que su hijo ya no continuaría siendo un delincuente. (The father believed that the son will not continue to be a delinquent. )

I read the story a few times and I am still not sure. I greatly appreciate your help. Thank you very much in advance! Have a nice day! (:

Hello, so I am going to the ball this spring. I have a friends who's name I will not say. I really like this friend--- he is amazing with his way of always making me smile no matter what is going in my life. He also wants to go to the ball and wants to ask a girl. He sits with me and another one of his friends at my lunch table. His friend mentioned twice that he was lonely and did not have a girlfriend. However, the actual boy does not say anything, he just eats his lunch, smiles, and stares at me when his friend mentions these things. The only thing the boy said once was that he was trying to find a girl and that he was going to ask one girl but she is really mean and does not really like him. This boy constantly tries to hug me too and smiles at me all of the time.

So in your opinion, what do you think is going on? Do you think he is trying to ask me to the prom and does not know how? What do you think I should do? Please give me your honest opinion because my friends never give me a straight, honest answer of what they think.

Thank you so much! I will take all opinions in mind! I appreciate it! Have a great day! (:

1 AnswerSingles & Dating7 years ago
• Can too much of a substance in an experiment cause an underreaction?

I performed an experiment in my chemistry class today. The directions said to place various different substance the size of a small pea into a test tube. This instruction was not extremely precise so if I added to much of the substance, is it possible that an underreaction occurred?

For example: In one section of the experiment, I worked with sodium chloride, nitric acid and silver nitrate. If I put more than the size of a small pea into the test tube of sodium chloride could the reaction be altered in any way? Under or over reaction possibly?

Please explain thoroughly! Thank you so much! I appreciate it! Have a nice day. (:

• How do I transfer a Facebook photo to Instagram?

I took senior pictures this past summer, and I received a CD. From there I inserted the disk into my computer and I uploaded some of my pictures onto Facebook. Now, I wish to add one of these pictures FROM Facebook TO Instagram. I watched a Youtube video about this topic, and I am extremely confused.

Thank you in advanced! I appreciate it! (:

• Is it possible to have more than 100% recovery of matter?

I performed a lab in my chemistry class, and got the recovery of matter to be 251%. Is this possible or is there an error? I appreciate it! Thank you very much! (:

• How to find the density of antifreeze?

I have three trials in an experiment:

Trial #1:

Mass of flask with antifreeze: 81.24 grams

Mass of empty flask: 71.96 grams

Mass of antifreeze: 9.28 grams

Trial #2:

Mass of flask with antifreeze: 81.00 grams

Mass of empty flask: 71.98 grams

Mass of antifreeze: 9.02 grams

Trial #3:

Mass of flask with antifreeze: 82.22 grams

Mass of empty flask: 71.96 grams

Mass of antifreeze: 10.26 grams

How do I find the density of antifreeze for each trial? I am confused, I look in my book, and online and do not understand. I appreciate your help in advance! Thank you very much! (:

• If sinx= -5/13 and cosx>0. Find the other 5 trig functions.?

If sinx= -5/13 and cosx>0. Find the other 5 trig functions.

I know that sin=opposite/hypotenuse (so opposite= -5 and hypotenuse= 13). I am confused on how to find the adjacent term. When I use a^2+b^2=c^2 I got an odd number. I understand the process of the finding the other 5 trig functions, but I am lost on how to get the adjacent number.

Please explain and show your work! Thank you very much! I appreciate it! Have a great day! (:

• Tan theta = cos theta Which quadrant does it lie?

Tan theta = cos theta.

I have the graph of the positive functions in each quadrant in my notes, but I am not sure. Is the answer quadrant I? because quadrant I has all positive trig functions?? I am very confused.

• Reference angle and exact value?

Re-write cos(-110 degrees) as a function of a positive acute angle.

I know that a positive acute angle is known as a reference angle. Also, my teacher said to sketch the graph to get a better understanding (which I did). I did -110 degrees minus 180 and got the answer of -cos 290. Am I correct? I was not in school the day we learned reference angles and exact value!

What is the exact value of: tan 5pi/3?

I am not sure if I am correct. So, I converted 5pi/3 into degrees by multiplying this radian measure with 180/pi. I got tan300 degrees. Then I used a trick that I found to get - radical 3. Am I correct?

Please explain thoroughly if I am incorrect. Thank you very much!! I appreciate it a lot!! Have a great day! (:

• In right triangle abc c is the right angle bc=5 and ab=13. what is the value of sec...?

In right triangle ABC, C is the right angle BC=5 and AB=13. What is the value of sec A?

Do I use a^2+b^2=c^2?? I am confused. Please explained thoroughly! Thank you very much! I appreciate it! (:

• Find the exact sum of sin pi/3 +cos pi/2.?

Find the exact sum of sin pi/3 +cos pi/2.

I missed this class and her notes confused me. Please help! Thank you very much! I appreciate it! (: