Question

In: Computer Science

construct c program flow chart #include <stdio.h> #include <math.h> #include <string.h> #define num 6 #define b...

construct c program flow chart

#include <stdio.h>
#include <math.h>
#include <string.h>

#define num 6
#define b 6
#define t 6

double bmical(double w, double h){
double o;
double bmi;

o = pow(h,2);
bmi = w/o;
return bmi;
}

double maxheartrate(int num1, int age){
double mhr;

mhr = num1 - age;
return mhr;
}

double heartratereserve(double mhr, double rhr){

double hrr;
hrr = mhr - rhr;

return hrr;
}

double minrange(int hrr, int rhr){

double mirt;
mirt = (hrr * 0.7) + rhr;

return mirt;
}

double maxrange(int hrr, int rhr){

double mart;
mart = (hrr * 0.85) + rhr;

return mart;
}

int main() {

printf("Online Application for Sports Teacher's Position 2019\n\n");

char N[90];
int A;
double P;
char E[20];
char grade;
double score;
char G;
double S;
int count;
double g;
double total;
double cgpa;
double h;
double w;
double bmi;
double hbpm;
int n = 220;
int mark[10];
int sum;
int average;
int i;
int marks[10];
int ave;
int s;
int tot;

printf("Name: ");
scanf("%s%s%s", &N,&N,&N);

printf("Phone number: ");
scanf("%lf", &P);

printf("Email address: ");
scanf("%s", &E);

printf("Age: ");
scanf("%d", &A);

if(A>=21&&A<=26){
printf("You are qualified!\n\n");
}
else if(A<21){
printf("You are not qualified!\n\n");
return 0;
}
else if (A>26) {
printf("You are not qualified!\n\n");
return 0;
}

printf("---------------------------------------------- \n\n");

printf("Enter your Sport Science Grade [A,B,C,D,F]: ");
scanf("%s", &grade);

if(grade == 'A')
score = 4.0;
else if(grade == 'B')
score = 3.0;
else if(grade == 'C')
score = 2.0;
else if(grade == 'D')
score = 1.0;
else if(grade == 'F')
score = 0.0;

else {
score = -1;
printf("Invalid grade '%c'\n", grade);
}
if(score != -1)
printf("Your score is %.2f\n", score);

if(score>=2&&score<=4){
printf("You are qualified!\n\n");
}
else if(score<1){
printf("You are not qualified!\n\n");
return 0;
}


printf("Enter your English grade [A,B,C,D,F]: ");
scanf("%s", &G);

switch(G){
case'A':
S = 4.0;
break;
case 'B':
S = 3.0;
break;
case 'C':
S = 2.0;
break;
case 'D':
S = 1.0;
break;
case 'F':
S = 0.0;
break;
default:
S = -1;
printf("Invalid grade '%c'\n", G);
break;

}
if(S !=-1)
printf("Your score is %.2f\n", S);

if(S>=2&&S<=4){
printf("You are qualified!\n\n");
}
else if(S<1){
printf("You are not qualified!\n\n");
return 0;
}

count = 0;
total = 0;

while(count < num){
printf("Enter you GPA each sem: ");
scanf("%lf", &g);
total += g;
count++;
}

cgpa = total/num;
printf("Your CGPA is: %.2f\n", cgpa);

if(cgpa>=2.5&&cgpa<=4){
printf("You are qualified!\n\n");
}
else if(cgpa<2.5){
printf("You are not qualified!\n\n");
return 0;
}

for(i=0; i< b; ++i)
{
printf("Enter your 'Fitness Test' mark for each sem: ");
scanf("%d", &mark[i]);

sum += mark[i];

}

average = sum/b;
printf("Average marks = %d\n\n", average);


if(average < 12){
printf("You are not qualified!\n\n");
return 0;
}
else if(average>=12&&average<=20){
printf("You are qualified!\n\n");
}
else if (average>=21) {
printf("Invalid, please enter correctly!\n\n");
return 0;
}

for(s=0; s< t; ++s)
{
printf("Enter your 'Bleep Test' mark for each sem: ");
scanf("%d", &marks[s]);

tot += marks[s];

}

ave = tot/t;
printf("Average marks = %d\n\n", ave);

if(ave<5.0){
printf("You are not qualified!\n\n");
return 0;
}
else{
printf("You are qualified!\n\n");
}

printf("----------------------------\n\n");

printf("Enter your weight (kg): ");
scanf("%lf", &w);
printf("Enter your height (m): ");
scanf("%lf", &h);

bmi = bmical(w,h);
printf("Your BMI is %.2f\n\n", bmi);

if(bmi < 18.5){
printf("You are underweight!\n");
}
else if(bmi>=18.5&&bmi<=24.9){
printf("You are healthy!\n");
}
else if(bmi>=25&&bmi<=29.9){
printf("You are overweight!\n");
}
else{
printf("You are obese!\n");
}

if(bmi < 18.5){
printf("You are not qualified!\n\n");
return 0;
}
else if(bmi>=18.5&&bmi<=24.9){
printf("You are qualified!\n\n");
}
else if (bmi>=25) {
printf("You are not qualified!\n\n");
return 0;
}

printf("-----------------------------------------------------------\n\n");
printf("Enter your heart beats per min when you are at rest: ");
scanf("%lf", &hbpm);

if(hbpm < 40){
printf("You are not qualified!\n\n");
return 0;
}
else if(hbpm>=40&&hbpm<=100){
printf("You are qualified!\n\n");
}
else if (hbpm > 100) {
printf("You are not qualified!\n\n");
return 0;
}

int res = maxheartrate(n, A);
printf("Maximum heart rate = %d\n\n", res);

printf("'Resting heart rate = Heart beats per min when you are at rest' \n");

int res1 = heartratereserve(res, hbpm);
printf("Heart Rate reserve (HRR) = %d\n\n" , res1);

double res2 = minrange(res1, hbpm);
printf("Mininum range target heart zone is %.2f\n" , res2);

double res3 = maxrange(res1, hbpm);
printf("Maximum range target heart zone is %.2f\n\n" ,
res3);

printf("Average target heart rate zone for exercise intensity; \n");
printf("Moderate exercise intensity: %.2f\n", res2);
printf("Vigorous exercise intensity: %.2f\n", res3);

printf("------------------------------------------------------------------------\n\n");

printf("Congratulations! You are shortlisted for Sports Teacher's Position 2019.\n");
printf("Results will be announced next week via email, Thank You!\n\n");

return 0;
}

Solutions

Expert Solution


Related Solutions

Flow chart and IPO chart ( no handwritten please ) #include <stdio.h> #include <string.h> #include <conio.h>...
Flow chart and IPO chart ( no handwritten please ) #include <stdio.h> #include <string.h> #include <conio.h> #include <ctype.h> char vs[26][26]; void encrypt(char input[], char key[], char cipher[]) { char inputWithoutSpaces[50], repeatedKeyWord[50], tempCipher[50]; int cnt = 0, i = 0, keyLen = strlen(key), len3 = strlen(input); // loop to remove the spaces from input & store in other char array inputWithoutSpaces for (i = 0; i < len3; ++i) { if (input[i] != ' ') { inputWithoutSpaces[cnt++] = toupper(input[i]); } }...
C program. librarys that are in use; stdio.h, stdlib.h, time.h, stddef.h, ctype.h, math.h, string.h. Need to...
C program. librarys that are in use; stdio.h, stdlib.h, time.h, stddef.h, ctype.h, math.h, string.h. Need to rewrite the functions linked in the code: "return add_move_lib ( board, col, colour ) ;" "return board_full_lib ( board ) ;" "return display_board_lib ( board ) ; // TASKS // board_full() display_board() add_move() // adds a token of the given value (1 or 2) to the board at the // given column (col between 1 and COLS inclusive) // Returns 0 if successful, -1...
i need this program to also print out the number of combinations #include <stdio.h> #include <string.h>...
i need this program to also print out the number of combinations #include <stdio.h> #include <string.h> #define N 10 void generate(char *array, int n) {    if (n==0)    {        printf("%s\n",array);        return;    }    for (int i = 0; i < n; ++i)    {        // generate all of the permutations that end with the last element        generate(array, n-1);        // swap the element        char temp = array[n-1];...
Can you translate this C code into MIPS assembly? #include <stdio.h> #include <math.h> #include <stdlib.h> double...
Can you translate this C code into MIPS assembly? #include <stdio.h> #include <math.h> #include <stdlib.h> double fact (double); void main () { int angle_in_D; double term, angle_in_R; float sine = 0; unsigned int i = 1; double sign = 1; int n = 1000; printf ("Please enter an angle (Unit: Degree): "); scanf ("%d", &angle_in_D); angle_in_R = angle_in_D * M_PI / 180.0; do { term = pow(-1,(i-1)) * pow (angle_in_R, (2*i - 1)) / fact (2*i - 1); sine =...
I have the following code #include <stdio.h> #include<string.h> #define BUFLEN 128 typedef struct { int numPhrases;...
I have the following code #include <stdio.h> #include<string.h> #define BUFLEN 128 typedef struct { int numPhrases; }SyncInfo; char buffer[BUFLEN] ; char *phrases[] = {"educated", "educated cat", "educated lion", "serious person" , "serious panda","curious student","curious art student", "obnoxious web developer"}; char localBuffer[BUFLEN]; int allVowelsPresent; void *checker(void *param) { int a=0, e=0, i=0, o = 0, u= 0 ; int* n = (int*)param; // typecasting a void* to int* //printf("%d\n",*n); for (int q=0; q< (*n); ++q) { // dereferencing to get the...
#include <stdio.h> #include <stdlib.h> #include <math.h> #include "../include/cis1057.h" /* * Programmer: << MA >> * Class:...
#include <stdio.h> #include <stdlib.h> #include <math.h> #include "../include/cis1057.h" /* * Programmer: << MA >> * Class: Introduction to C Programming 1057 Spring 2019 Section 004 * Assignment: Number 5 “estimate the value of a factorial using Gosper's algorithm." * Date: << 02-19-2019 >> * Version: 1 * Description: Program will prompt for some data, read in the values, perform the calculation using library math functions, and display the result. * File: lab5.c */ # define M_PI 3.14159265358979323846 /* pi */...
Please paraphrase this c code #include <stdio.h> #include <stdlib.h> #include <string.h> void sortGrades(int arr[], int size,...
Please paraphrase this c code #include <stdio.h> #include <stdlib.h> #include <string.h> void sortGrades(int arr[], int size, int status, char names[][20]); void printer(int grades[], int size, char names[][20]); void sortNames(char arr[][20], int size, int status, int grades[]); void nameSearch(int grades[], int size, char names[][20]); void numSearch(int grades[], int size, char names[][20]); int main() { int i; int size; int option; do { printf("\n\nInput Number of Students or 0 to exit : "); scanf("%d", &size); if (size == 0) { break; }...
C programming #include <stdio.h> #include <math.h> int main() { printf("============== Problem #1 =================\n"); printf("This should print...
C programming #include <stdio.h> #include <math.h> int main() { printf("============== Problem #1 =================\n"); printf("This should print down from 2 to 0 by 0.1 increments\n"); float f = 2.0; while (f != 0) { printf("%0.1f\n",f); f = f - 0.1; } printf("============== Problem #2 =================\n"); printf("This should find that the average is 5.5\n"); int total_score = 55; int total_grades = 10; double avg = total_score/total_grades; printf("Average: %0.2f\n",avg); printf("============== Problem #3 =================\n"); printf("If the population increases by 2.5 people per second, how...
CODE A #include<stdio.h> #include<math.h> #include<stdlib.h> #define PI 3.14159265358979323846 int main(){ int diameter; printf("Enter value of diameter...
CODE A #include<stdio.h> #include<math.h> #include<stdlib.h> #define PI 3.14159265358979323846 int main(){ int diameter; printf("Enter value of diameter between 8 to 60 inches: "); scanf("%d",&diameter); // if(diameter>60 || diameter<=8){ // printf("Error! invalid input"); // exit(0); // } // else{ // float radius = diameter/2; // float volume = (4/3)*PI*radius*radius*radius; // printf("%.2f",volume); // } //check through the while loop if it is valid or in valid while(diameter>60 || diameter<=8){ printf("Invalid input Enter again: "); scanf("%d",&diameter); }    //caluclate the volume of sphere float...
Please implement the 5 questions in source code: #include <stdio.h> #include <stdlib.h> #include <math.h> int main(...
Please implement the 5 questions in source code: #include <stdio.h> #include <stdlib.h> #include <math.h> int main( int argc, char* argv[] ) { // Size of vectors int n = 10000; // Input vectors double *restrict a; double *restrict b; // Output vector double *restrict c; // Size, in bytes, of each vector size_t bytes = n*sizeof(double); /* Q1: Allocate memory for vector a (10 points)*/ /* Q2: Allocate memory for vector b (10 points)*/ /* Q3: Allocate memory for vector...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT