Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

To convert weight measurements into letter category as follows: category weight

ID: 3563499 • Letter: T

Question

To convert weight measurements into letter category as follows:

category   weight (pound)

A weight (=<)20.0

B 20.0 < weight (=<) 50.0

C 50.0 < weight (=<) 150.0

D 150.0 < weight

write a set of C++ statment that assign correct category value (A, B, C, or D ) to character variable CATEGORY based on the given value of weight . Assume that CATEGORY has been explicitly typed as a character variable. ( if you use other computer language such as Visual basic, Pascal, Fortran, etc., please specify which language you are using)

Explanation / Answer

#include<stdio.h>

int main()

{

int weight;

scanf("%d",&weight);

if(weight <= 20.0)

{

printf("A");

}

if(20 <= weight < 50.0)

{

printf("B");

}

if(50 < weight <= 150.0)

{

printf("C");

}

if(weight > 150)

{

printf("D");

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote