# HW02 - Control Structures BEE 1510: Introduction to...

This preview shows pages 1–4. Sign up to view the full content.

Control Structures BEE 1510: Introduction to Computer Programming Homework Exercise 02 Timothy Lin Cornell University due: October 2, 2008

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Executive Summary This exercise was meant to do two things: to calculate specific heat of soil based on its components of soil and water and to classify mineral soil based on its components of sand, silt and clay. The specific heat (c p ) is the heat required to change the temperature of one kilogram of mass by one degree Celsius. The total heat capacity is the ability of a volume of a material to store heat. Two objects of the same material can have identical specific heat values but different heat capacity values if they are not the same mass. Soil has a relatively high heat capacity because of the water that is in it. Water has a very high specific heat. Mineral soils, in contrast to the organic, muck soils, consist of four major components: mineral components (rock dust), organic components, water and air. Soils are grouped into different classes by their textures based on the relative amounts of three constituents: sand, silt and clay. These three components are graphically defined by the “soil triangle,” which maps out the type of soil based on the percentages of each of the components. Problem The problems that are faced are why does soil remain at a relatively stable temperature as the weather changes from day to day and how do we classify types of soil based on entered percentages of each component? Objective The objective of this program is to smoothly input values for a soil fraction and water fraction for a chosen type of soil (mineral or organic) and for the program to output a value of specific heat if and only if the values for soil and water fraction are appropriate and meet certain criteria. In addition, for mineral soils only, the user will input values of silt, sand, and clay percentages, and the output will be which type of soil it is based on those inputted percentages. Materials and Methods The first equation used is to determine the specific heat of both organic and mineral soils. It is the specific heat of moist soil = ((specific heat of water)(water fraction)(density of water) + (specific heat of dry soil)(soil fraction)(density of soil))/((water fraction)(density of water) + (soil fraction)(density of dry soil)). The specific heat of dry soil differs if the soil is mineral or organic so those differences are taken into account in each function file. The same goes for the density of the different soils. The second part of this exercise reviews the different percentages of the inputted sand, silt and clay components and uses the soil triangle to choose which type of mineral soil it is. Materials and Methods – algorithm for script 1. Enter Comments Homework Exercise 02: Control Structures
Timothy Lin Original Code: September 23, 2008 Last Revision: September 24, 2008 2. Inputs i. Define Inputs ask user whether organic, mineral, mineral skipping specific heat commands through menu command

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## HW02 - Control Structures BEE 1510: Introduction to...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online