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

I need help completed Chapter 7 Programming exercise 2 code and chart for Starti

ID: 3799446 • Letter: I

Question

I need help completed Chapter 7 Programming exercise 2 code and chart for Starting out with Programming Logic edition 4

this is what I have so far and as I check it, says need to initialize fatgrams:

//Constant LOW_FAT = 0.3

//Main module

Module main()

                //Local variables

                Declare Real fatgrams, calories

//Get the number of fat grams

                Call getFatGrams(fatgrams)

//Get the number of calories

                Call getCalories(calories)

//Calculate the percentage of calories that come from fat. //Percentage of calories from fat = (fatGrams*9) / Calories

                Call caloriesPercentage

//Display percentage

                Call displayPercentage(percentage)

End Module

Explanation / Answer

#include<iostream>
using namespace std;

double getFatGrams(double);
double getCalories(double);
double caloriesPercentage(double,double);
void displayPercentage(double);
float LOW_FAT = 0.3;

int main(){
double fatgram,calories,fat;
fatgram = getFatGrams(fatgram);
calories = getCalories(calories);
fat = caloriesPercentage(fatgram,calories);
displayPercentage(fat);
return 0;
}
double getFatGrams(double fatgrams){
//do the required operation and return the fatgrams
}
double getCalories(double calories){
//do the required operation and return the calories
}
double caloriesPercentage(double fatgram,double calories){
double fat = (fatgram*9) / calories;
return fat;
}
void displayPercentage(double percentage){
cout<<"The percentage of calories are: "<<percentage;
}

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