Math

Ok so I want my program to calculate the math once a user imputs how many pallets they are receiving. I am having trouble with this. The questions pop up and the user can enter it but no math is solved. Any help would be much appreciated. Also I had to upload the picture because I am using a virtual desktop and it will not let me copy and paste.

http://imgur.com/3qCQ5gT
no math is solved


How do you know? You're not printing anything.
How do I print it? It should do all this. I have the math and conversions done. Just the coding is tricky.

You know that the customer needs 2 pallets of full liter and 4 pallets of half-liter bottles of purified water to be delivered to the his warehouse. The program asks the warehouse owner to enter the number of full and half-liter pallets to be delivered by our company. Your program calculates and reports the total number of cases of each drink, total servings of each drink, as well as total liters for the entire order, and the US gallons and weight (in pounds) of all the product delivered. We’ll assume a serving is a complete bottle. That is, one half-liter bottle is a serving and one full-liter bottle is a serving. One gallon of water is equivalent to 3,785 cubic centimeters or 3.785 liters.
Last edited on
after line 32
1
2
3
cout << "Total Full Cases: " << total_full_CASES << endl;
cout << "Total Half Cases: " << total_half_CASES << endl;
...


Then, see if your math is solved correctly.
No sir, didnt work.
What exactly didn't work?
It didn't tell the user weight ect.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
using namespace std;
int main()
{
	//variable declaration
	int full, half;
	int total_full_bottles, total_half_bottles, total_bottles;
	int total_liters, total_full_cases, total_half_cases;
	
	double total_gallons, total_weight, total_constant_weight;

	const int CASES_PER_PALLET = 80, BOTTLES_PER_CASE = 24;
	const double LITERS_PER_GALLON = 3.785;
	const double POUNDS_PER_GALLON = 8.346;
	const double POUNDS_PER_CONTAINER = 0.5 / 16;

	//Class Header

		cout << "\n How many pallets of 1 liter bottles?";
		cin >> full;
		cout << "\n How many pallets of 1/2 liter bottles?";
		cin >> half;
		//Do work
		int total_full_cases = (CASES_PER_PALLET*full);
		int total_half_cases = (CASES_PER_PALLET*half);
		int total_full_bottles = (total_full_cases*BOTTLES_PER_CASE);
		int total_half_bottles = (total_half_cases*BOTTLES_PER_CASE);
		int total_Bottles = (total_full_bottles + total_half_bottles);
		int total_container_weight = (total_bottles*POUNDS_PER_CONTAINER);
		int total_liters = (total_full_bottles + total_half_bottles/2);
		int total_weight = (total_gallons*POUNDS_PER_GALLON + total_container_weight);
		//output
		cout << "Total Full Cases: " << total_full_CASES << endl;
		cout << "Total Half Cases: " << total_half_CASES << endl;
		return 0;
Last edited on
Of course it didn't work, what you have above won't even compile. You have to fix all the errors before the program will run.

Look closely, I changed a bunch of stuff, but mostly removed the int's on line 24-31. I also fixed some typos by both you and me.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <iostream>
using namespace std;
int main()
{
	//variable declaration
	int full, half;
	int total_full_bottles, total_half_bottles, total_bottles;
	int total_liters, total_full_cases, total_half_cases;
	
	int total_Bottles;
	
	double total_gallons, total_weight, total_container_weight;

	const int CASES_PER_PALLET = 80, BOTTLES_PER_CASE = 24;
	const double LITERS_PER_GALLON = 3.785;
	const double POUNDS_PER_GALLON = 8.346;
	const double POUNDS_PER_CONTAINER = 0.5 / 16;

	//Class Header

		cout << "\n How many pallets of 1 liter bottles?";
		cin >> full;
		cout << "\n How many pallets of 1/2 liter bottles?";
		cin >> half;
		//Do work
		 total_full_cases = (CASES_PER_PALLET*full);
		 total_half_cases = (CASES_PER_PALLET*half);
		 total_full_bottles = (total_full_cases*BOTTLES_PER_CASE);
		 total_half_bottles = (total_half_cases*BOTTLES_PER_CASE);
		 total_Bottles = (total_full_bottles + total_half_bottles);
		 total_container_weight = (total_bottles*POUNDS_PER_CONTAINER);
		 total_liters = (total_full_bottles + total_half_bottles/2);
		 total_weight = (total_gallons*POUNDS_PER_GALLON + total_container_weight);
		//output
		cout << "Total Full Cases: " << total_full_cases << endl;
		cout << "Total Half Cases: " << total_half_cases << endl;
		return 0;
}
Topic archived. No new replies allowed.