I'm doing another coding exercise and my code is not giving me correct answers.
For example:
What was the total amount of milk produced in the morning: 3590.56
- Number of cartons = 949 supposed to be 950
- Cost of producing = 1364.41 correct
- Profit of producing = 256.47 supposed to be 256.5
Below is my code
#include<iostream>
#include<string>
#include<iomanip>
#include<fstream>
using namespace std;
const double CARTON = 3.78;
const double PRODUCECOST = 0.38;
const double PROFIT = 0.27;
int main() {
double milkProduced, numCartons;
double costOfProducing, profitOfProducing;
cout << fixed << showpoint << setprecision(2);
cout << "What was the total amount of milk produced in the morning: " << endl;
cin >> milkProduced;
numCartons = milkProduced / CARTON;
costOfProducing = milkProduced * PRODUCECOST;
profitOfProducing = numCartons * PROFIT;
cout << static_cast<int>(numCartons) << endl;
cout << costOfProducing << endl;
cout << profitOfProducing << endl;
return 0;
}