When I run the program I get $85 for inputting 3 installations, and15 yards of c
ID: 3607844 • Letter: W
Question
When I run the program I get $85 for inputting 3 installations, and15 yards of cable. There must be a misunderstanding in theprogram./*
Cable Revenue Program
This program calculates the revenue generated from
installing coaxial cable, given the number ofinstallations
and the yards of cable used. Each installation earns$25
and each foot of cable earns $2. For example,
for input of 3 installations and 15 yards of cable,
the revenue earned would be $165.
*/
#include <stdio.h>
#define SERVICE_CHARGE 25 /* service chargeper installation */
#define PRICE_PER_FOOT 2 /* unit cable price */
int main(void)
{
int installations; /* number of installations */
int yardsOfCable; /* yards of cable used */
int feetOfCable; /* feet of cable used */
int revenue; /* dollars generated */
/* Input (keyboard): The number of installations*/
/* Input (keyboard): The yards of cableinstalled */
printf ("Enter the number of installations: ");
scanf("%d", &installations);
printf ("Enter the yards of cable used: ");
scanf("%d", &yardsOfCable);
/* Computations */
feetOfCable = yardsOfCable/3;
revenue = installations * SERVICE_CHARGE +PRICE_PER_FOOT * feetOfCable;
/* Output (screen): The revenue generated*/
printf("The revenue generated is %d dollars. ",revenue);
return(0);
}
Explanation / Answer
Never mind I figured it out!
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.