Code a program to calculate the time in minutes for someone to cut a yard. Input
ID: 3665317 • Letter: C
Question
Code a program to calculate the time in minutes for someone to cut a yard. Input the length and width of the yard in feet. Input the length and width of the house in feet. Subtract the area of the house from the area of the yard to determine the amount of grass to be cut. Using 2 square feet per second as the rate at which you can cut the grass (set this up as a constant), determine how long it will take someone to mow the lawn, in minutes.
The program should print:
Length and width of yard
Length and width of house
Area to be cut in square feet
Time to mow the yard in minutes
Input data: (run three times)
Yard - 1500 X 1600 feet
House - 500 X 700 feet
Yard – 4850 X 6000
House – 1000 X 2000
Explanation / Answer
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
long Area_Yard=0,Area_House=0;
int Lengthofyard=0,Widthofyard=0,HouseLength=0,HouseWidth=0;
long GroundArea=0;
int TimeRequiredtocut=0;
int GrassCuttingRate=2;
void main()
{
char input[256];
clrscr();
printf("GRASS CUTTER PROGRAM");
printf("please Enter the Length of Yard ");
gets(input);
Lengthofyard= atoi(input);
printf("please Enter the Width of Yard ");
gets(input);
Widthofyard=atoi(input);
printf("please Enter the Length of House ");
gets(input);
HouseLength=atoi(input);
printf("please Enter the Width of House ");
gets(input);
HouseWidth=atoi(input);
Area_House=HouseWidth *HouseLength ;
Area_Yard=Widthofyard* Lengthofyard;
GroundArea=Area_Yard-Area_House;
TimeRequiredtocut=GroundArea/GrassCuttingRate;
printf("%s%d","Grass Area is ",GroundArea);
printf("%s%d seconds"," time Required To cut it in seconds is " ,TimeRequiredtocut);
getchar();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.