Need This Code finished Please
// Program Template for Cookie Calorie program
// Author -
// Header file for input output functions #include using namespace std;
// main function -
// where the execution of program begins int main()
{ // Variable declarations const int COOKIES_IN_BAG = 40; const int SERVINGS_IN_BAG = 10; const int CALORIES_PER_SERVING = 300; int cookies_eaten;
cout<<"How many cookies did you eat? ";
cin >> cookies_eaten;
// remaining code goes here return 0; }
Since you have not provided the entire problem description like what is "remaining lines of code" supposed to provide the implementation for, I am providing the code based on my assumption. Feel free to reach out in case of any query.
CODE
#include <iostream>
#include <vector>
using namespace std;
int main() {
// Variable declarations
const int COOKIES_IN_BAG = 40;
const int SERVINGS_IN_BAG = 10;
const int CALORIES_PER_SERVING = 300;
int cookies_eaten;
cout<<"How many cookies did you eat? ";
cin >> cookies_eaten;
if (cookies_eaten > COOKIES_IN_BAG) {
cout << "There are not enough cookies!!";
} else {
int calories = cookies_eaten * SERVINGS_IN_BAG * CALORIES_PER_SERVING;
cout << "Total calories = " << calories;
}
}
Need This Code finished Please // Program Template for Cookie Calorie program // Author - //...
A library maintains a collection of books. Books can be added to
and deleted from and checked out and checked in to this
collection.
Title and author name identify a book. Each book object
maintains a count of the number of copies available and the number
of copies checked out. The number of copies must always be greater
than or equal to zero. If the number of copies for a book goes to
zero, it must be deleted from the...
When the user has finished entering the sales amounts, the program should display the number of sales amount entered and the average commission. #include <iostream> using namespace std; int main() { const double rate =0.2; int sales = 0; double commission = 0.0; double totalSales =0.0; cout << "First salesperson's sales (-1 to stop) : "; cin >> sales; while (sales !=-1) { commission = sales * rate; cout << "Commission : $ " << commission << endl; cout <<...
15.6: Fix the code to print the count from 1 to x (to loop x times) #include <iostream> // include the header file using namespace std; void count(int x){ for(int i=1; i<=x; i++){ cout<<x; } } int main(){ int x,i; cin >> x; count(x); return 0; } 15.7 Fix the nested for loops to print the count from 1 to x twice, e.g. "12....x12.....x" #include <iostream> // include the header file using namespace std; int main(){...
please Code in c++ Create a new Library class. You will need both a header file and a source file for this class. The class will contain two data members: an array of Book objects the current number of books in the array Since the book array is moving from the main.cc file, you will also move the constant array size definition (MAX_ARR_SIZE) into the Library header file. Write the following functions for the Library class: a constructor that initializes...
Please Help. C++. Need 3 attributes and 3 methods added to the code below. Need the prototype added to the .h file......and the implementation in the .cpp file....thanks! edited: I just need the above and then I was told to use the methods in the main program; for the vehicle. Any 3 attributes and any three methofds. source.cpp file // Header Comment #include #include #include #include "Automobile.h" using namespace std; struct Address{ string street; string city; string state; string zip;...
In
PEP8 code.
assembly pep8 code.
30. Write an assembly language program that corresponds to the following C+ program #include <iostream> using namespace std; int num; int main() cin >> num: num = num/ 16; cout << "num = " << num << endl; return 0; 21 de
I need help with the code below. It is a C program, NOT C++. It can only include '.h' libraries. I believe the program is in C++, but it must be a C program. Please help. // // main.c // float_stack_class_c_9_29 // // /* Given the API for a (fixed size), floating point stack class, write the code to create a stack class (in C). */ #include #include #include #include header file to read and print the output on console...
PLEASE TYPE OUT IN TEXT (please no pdf or writing) C++ CODE Consider the following program in which the statements are in the incorrect order. Rearrange the statements in the following order so that the program prompts the user to input: The height of the base of a cylinder The radius of the base of a cylinder The program then outputs (in order): The volume of the cylinder. The surface area of the cylinder Format the output to two decimal...
Write a C++ Program. You have a following class as a header file (dayType.h) and main(). #ifndef H_dayType #define H_dayType #include <string> using namespace std; class dayType { public: static string weekDays[7]; void print() const; string nextDay() const; string prevDay() const; void addDay(int nDays); void setDay(string d); string getDay() const; dayType(); dayType(string d); private: string weekDay; }; #endif /* // Name: Your Name // ID: Your ID */ #include <iostream>...
61. The following program is accepted by the compiler: int sum( int x, int y ) { int result; result = x + y; } T__ F__ 62. The following implementation is accepted by the compiler: void product() { int a; int b; int c; int result; cout << "Enter three integers: "; cin >> a >> b >> c; result = a * b * c; ...