CSC2310 Assignment 1 25 points due 9/5/01 Dr. Harrison Fall 2001

This project will exercise your skills with data input and objects. The goal is to write a program that will help a home brewer determine how much malt or malt extract to use to reach a certain strength of beer. Beer is produced by using yeast to ferment a sugary solution. The sugar is converted into more yeast, carbon dioxide and ethanol. The strength of the brew is determined by the initial density of the solution. The density is measured relative to pure water. Water is nominally 1000º, and sugars are added to bring the density up to higher value.


The amount of sugar to be added is given by the formula:


Weight = ((desired_density - 1000) * volume ) / constant_for_sugar


The amount of alcohol (by volume) produced is given by the formula:


abv = (density - 1000) * fermentability / 7.45


The final density is given by the formula:


Final = (density - 1000) * (1. - fermentability) + 1000


Please write a program that will prompt the user for the volume to be brewed (in liters) and the desired density. Have it estimate the amount of sugars (from the data in the table below) the final density and the final alcohol content. These should be printed out.


You should design and implement an object that takes three parameters when constructed. The parameters are: the type of sugar, the constant_for_sugar, and the fermentability. The object should have methods that calculate the amount of sugar needed to get a certain density, the final density and the abv. It should also return a string naming the kind of sugar.


name

constant_for_sugar

fermentability

Malt extract

303

0.62

Table sugar

375

1

Chocolate Malt

200

0.3


The program should perform the calculation for each of these kinds of sugar and write the type of sugar, the amount needed, the final density and the final abv. Find the values for an initial

density of 1075 and 24 liters.


The program run should resemble:


Enter the desired density: 1100

Enter the number of liters to brew: 24

With Malt extract 7.921 kg 1038 final density 8.32 percent abv

With Table sugar 6.4 kg 1000 final density 13.42 percent abv

With Chocolate malt 12 kg 1070 final density 4.027 percent abv


The sources for the programs and the output should be printed and the sources and class files should be supplied on a disk. Please label your work.