ECE 231 – Fall 2009

Programming Assignment 4

 

Due: Monday, September 28, 2009 at 11:59 PM

Construction engineers use concrete to build high-rise buildings.  Since concrete is nearly incapable of resisting tension loads, reinforcing steel, known as rebar, is embedded in concrete to resist tension.  The rebar is available in a number of sizes.  The following table shows the ASTM (American Society for Testing and Materials) standards of reinforcement using the rebar’s size, weight, and diameter.

 

Size

Weight (lb/ft)

Diameter (in)

2

0.167

0.250

3

0.376

0.375

4

0.668

0.500

5

1.043

0.625

6

1.502

0.750

7

2.044

0.875

8

2.670

1.000

9

3.400

1.128

10

4.303

1.270

11

5.313

1.410

14

7.650

1.693

18

13.600

2.257

 

The next table shows an example of the type and length of rebar used for the basement of a parking garage:

 

Size

Length (ft)

4

5000.0

10

2000.0

14

1200.0

18

900.0

 

The ASTM data is located in the input file "astm.txt" which contains the data listed in the first table.  This will need to be stored in three separate arrays (one for the size, one for the weight and one for the diameter).

 

The rebar that is used in the parking garage needs to be stored as a structure:

 

typedef struct

{

    int size;

    double length;

} rebar;

 

 

Then, you will need to create an array of these structures for the parking garage:

 

rebar r[4];

 

Your program should get the data from the data file and populate the arrays.  Then, ask the user to input the type and length of rebar used for the parking garage.  The user must enter four and only four values.  Once this data is entered, then you need to calculate the weight of each type of rebar and the total length and weight of the rebar that will be needed in the parking garage.  The output will look like:

 

Size      Diameter (in)     Length (ft)         Weight (lb)

4          0.500                5000.0              3340.0

10         1.270                …                     …

14         …                     …                     …

18         …                     …                     …

 

Total                             …                     …

 

(The weight of 3340.0 is calculated from multiplying the length – 5000.0 – by the rebar weight per foot – 0.668.)