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

Thanks Read all instructions before beginningyour work. COMP1200- C- Assign 05 D

ID: 3587740 • Letter: T

Question

Thanks

Read all instructions before beginningyour work. COMP1200- C- Assign 05 Due 11:59 pm- Friday- October 6, 2017 Submit assign05.c via Canva NOTE Your submitted files) MUST be spelled and cased as instnucted. Before yon start wrining your program Using a Software Development Model to plan your solution for the following problem may seem trivial, but it allows you to process (think about) the solution of the problem before starting to write your C program file. Create an algorithm and use it as comments to guide you when writing the C program statements. Problem: both English and SI (Systeme units on a regular basis Some fields use Engineers use other, but many combine the two systems. For example, the rate of energy input to a steam power plant from buming fossil fuels is usually measured in Btu/hour. However, the electricity produced by the same plant is usually measured in joules's (watts). Automobile engines, by contrast, are often rated in horsepower or in flbes Here are some conversion factors relating these different power measurements primarily one or the 1 kW = 3412.14 Btuh = 737.56 ft lb's 1hp = 550 ft lb s = 2544.5 Btu/h Moore 4e, 7.14) Instructions for all assignment scripts See Standards for Documentation of C Programs on the Canvas Resources page. Insert comments at the top and throughout each file. o Include the follow comments at the beginning of this (and ALL) files. Grade of ZERO for files with submitter name not part of Canvas group. Not in a group? GROUP# is "none" For your own protection, type "none" if submitting alone. ALL STUDENTS-AMESNU STMATCHNAMESON.CANTAS submitter's name, GROUP # 8othergroup members' names % progr file name,ex, assign02ac 8 due date of the assignment Zero points for ID comments if no collaboration statement % statements) about collaboration o Use the algorithm given as comments throughout your program o Use ALL CAPS for constants variable names. a short narrative about what the file does 5 points for absemce of any of OObserve the instructor's rule for naming variables. these required comments at the top of each file o Start other variables with lower case. Use descriptive variable names Use Sample Input Output as a guide o If you do not submit individually there will be a5 POINTS PENALTY for ot joininga sroup on Cantn Groups ean be 2-4 students. D Code clarity: o Indent blocks as needed. Use Generate CDS o Divide your solution program code into sections as noted in the algorithm

Explanation / Answer

#include<stdio.h>

int main(){

   FILE *fp;
   int n;
   int i;
   double v1,v2,v3,v4;
   double mv1,mv2,mv3,mv4;

  
   fp = fopen("Kilowatt.txt","r");
   if (fp == NULL){
       printf("Error in opening file ");
       return 0;
   }
   fscanf(fp,"%d",&n);
   printf("%-10s %-10s %-10s %-10s ","kW","Btu/hr", "hP", "ft lbf/s");
   mv1 = 0;
   for (i = 0; i<n; i++){
        fscanf(fp,"%lf",&v1);
        v2 = v1 * 3412.14;
        v3 = v2/2544.5;
        v4 = v1 * 737.56;
        printf("%-10.1f %-10.1f %-10.1f %-10.1f ",v1,v2, v3,v4);
        if (v1 > mv1){
           mv1 = v1;
           mv2 = v2;
           mv3 = v3;
           mv4 = v4;
        }
       
   }
   printf(" Maximum kw with conversion units ");
   printf("%-10s %-10s %-10s %-10s ","kW","Btu/hr", "hP", "ft lbf/s");
    printf("%-10.1f %-10.1f %-10.1f %-10.1f ",mv1,mv2, mv3,mv4);
  
   
return 0;
}

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