Copy Link
Add to Bookmark
Report

The Hogs of Entropy 0557

eZine's profile picture
Published in 
The Hogs of Entropy
 · 5 years ago

  

[--------------------------------------------------------------------------]
ooooo ooooo .oooooo. oooooooooooo HOE E'ZINE RELEASE #557
`888' `888' d8P' `Y8b `888' `8
888 888 888 888 888 "My First C++ Program"
888ooooo888 888 888 888oooo8
888 888 888 888 888 " by Seaya
888 888 `88b d88' 888 o 4/6/99
o888o o888o `Y8bood8P' o888ooooood8
[--------------------------------------------------------------------------]

// Hello hoe readers! I, Seaya, have accomplished a most
// amazing feat! I have completed my first C++ program.
// It is a bootlegging program in which you enter the
// number of desired quarts, and the price of certain
// ingredients on the market, and voila it spits out
// the suggested price per quart. Below is the code,
// plus comments from my T.A. as to the stupendousness
// of my first effort and the lacking of proper formatting.
//
// The url of the assignment is:
// http://www.cs.georgetown.edu/~maloof/cosc071/project1.html
//
// Compile and enjoy!!!

#include <iostream.h>
#include <iomanip.h>
#include <stdlib.h>
#include <math.h>
#include <conio.h>

int main ( )
{

double fullRecipes; //#of full recipes needed, apple bushels, sugar bags
int waterVolume, // gallons of original mash and packages of yeast
yieldQuarts; // desired yield in quarts
float yieldGallons, // the desired yield in gallons
appleCost, // cost of 1 bushel of apples
cost, // cost of all the jars plus the bribe and ingredients
sheriffBribe, // pay the sheriff some dough
jarPrice; // suggestions of what to charge for 100% profit

cout << "
Enter desired number of full quarts: "; // request for quarts
cin >> yieldQuarts; // input of quarts of yield

if (yieldQuarts > 128) {
cout << "
\nGallons of mash exceeds volume of still." << endl; //
overflowing!
getch();
exit(1); // sends failure message ands exits
}
else {
cout << "
\nEnter cost of apples per bushel: "; // request for bushels
cin >> appleCost; // input of the cost of an apple bushel
cout << "
\nEnter sheriff payoff: "; // sneaky bribe to sheriff he he he!
cin >> sheriffBribe; // how much to the sheriff

yieldGallons = yieldQuarts/4; // 4 quarts in a gallon
fullRecipes = ceil(yieldGallons/3.2); // each recipe yields 3.2 gals
waterVolume = fullRecipes*5; // 5 gallons in 1 recipe
cost = sheriffBribe + (yieldQuarts * 2.75) + (fullRecipes * 2.75) +
(appleCost * fullRecipes);

// the cost of the entire batch of moonshine =
// the number of quarts yielded times the price of a jar
// plus the number of full recipes made times the prices of the
// ingredients in one recipe (assuming water is free)
// plus the pesky bribe to the sheriff

jarPrice = (cost/yieldQuarts) * 2;

// The price of one jar is
// the total cost divided by the number of quarts yielded
// then multiplied by 2 for a 100% profit

cout << "
\nNeeded ingredients:\n";
cout << "
" << waterVolume << " gallons of water,\n"; // initial gallons
h2o
cout << "
" << fullRecipes << " bushels of apples,\n"; // how many
bushels
cout << "
" << fullRecipes << " bags of sugar,\n"; // # bags of
sugar=bushels
cout << "
" << waterVolume << " packages of yeast.\n\n"; // pkgs
yeast=gal. h2o
cout << "
Yield: " << yieldQuarts << " quarts\n"; // yield in quarts
cout << "
Suggested Quart Price: $" << setprecision(2) // set for cents
<< setiosflags(ios:: fixed | ios::showpoint) // necessary for dollar
format
<< jarPrice << endl; // what to charge per jar

}// end of else
getch();
return (0); // sends success

}// end of main

/* Good job, Leah. Try to work on formatting your program a little
more clearly,
it makes it much more readable and easier to follow. Your comments
in the
program are excellent. 5/5
-Seth */


end text

[--------------------------------------------------------------------------]
[ (c) !LA HOE REVOLUCION PRESS! HOE #557 - WRITTEN BY: SEAYA - 4/6/99 ]

← previous
next →
loading
sending ...
New to Neperos ? Sign Up for free
download Neperos App from Google Play
install Neperos as PWA

Let's discover also

Recent Articles

Recent Comments

Neperos cookies
This website uses cookies to store your preferences and improve the service. Cookies authorization will allow me and / or my partners to process personal data such as browsing behaviour.

By pressing OK you agree to the Terms of Service and acknowledge the Privacy Policy

By pressing REJECT you will be able to continue to use Neperos (like read articles or write comments) but some important cookies will not be set. This may affect certain features and functions of the platform.
OK
REJECT