Ok the first part is my incomplete program that I am writing and the second half is the instructions. We are using g++ compiler with vim editor on ssh secure shell. Please someone help me because I am lost. Thank you
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
/* File: lab2.cpp
* Author: Tyler Cate
* Description: This program calculates the log volume of forest tree products
* and gives the price of that tree product.
*/
#include<iostream>
using namespace std;
//Declare the constant volume given based on log grade and type
const int Crosstie_Logs = 1;
const int White_Oak_Stave_Logs = 2;
const int Softwood_Logs = 3;
const int Crosstie_Grade1 = 375;
const int Crosstie_Grade2 = 275;
const int White_Oak_Stave_Grade1 = 950;
const int White_Oak_Stave_Grade2 = 750;
const int White_Oak_Stave_Grade3 = 425;
const int Softwood_Type1 = 125;
const int Softwood_Type2 = 225;
const int Softwood_Type3 = 180;
double Log_Type;
double Log_Grade;
double Log_Length;
double Log_DIB;
double Log_Price;
double Log_Volume;
double wood_type;
int main ()
{
//Welcomes the user to the program
cout << "Welcome to Forest Products of Tennessee. \n";
//Prompts the user for log type
cout << "1 Crosstie Log \n";
cout << "2 White Oak Stave Log \n";
cout << "3 Softwood Log \n";
cout << "Enter log type by number: ";
cin >> Log_Type;
//Prompts the user for log length in feet
cout << "Enter log length in feet: ";
cin >> Log_Length;
//Prompts user for DIB in inches
cout << "Enter Log DIB in inches: ";
cin >> Log_DIB;
//Reads the user input based on log grade
if (Log_Type == Crosstie_Logs || Log_Type == White_Oak_Stave_Logs)
{
cout << "Enter log grade: ";
cin >> Log_Grade;
}
//Prompts the user for wood type when log type is softwood
else (Log_Type == Softwood_Logs);
{
cout << "1 SY Pine \n";
cout << "2 White Pine \n";
cout << "3 Hemlock \n";
cout << "Enter wood type by number: ";
cin >> wood_type;
}
return (0);
}
|
Instructions:
General Information
This application calculates the price of certain delivered forest products in East Tennessee
Detailed Information
This program calculates the price of a single log from a tree in East Tennessee. Use the following chart to determine volume and cost:
Crosstie Logs
Length 8.75’ min
DIB (Diameter Inside Bark) 11” min
Grade 1: $375/MBF (1000 Board Feet)
Grade 2: $275/MBF
White Oak Stave Logs
Length 8.5’ min
DIB 12” min
Grade 1: $950/MBF
Grade 2: $750/MBF
Grade 3: $425/MBF
Softwood Logs
Length 8’ min
DIB 6” min
Softwood Logs wood type
SY Pine: $125/MBF
White Pine: $225/MBF
Hemlock: $180/MBF
The log volume formula below, called the Doyle Log Rule, calculates the number of 1’ boards you can get out of a log. You need to know the number of boards a log will generate to compute price since prices above are per 1000, one-foot boards.
V = (D-4)^2*L/16
where V is log volume in board feet, D is the DIB in inches, L is the log length measured in feet.
Inputs are below. You may assume all user inputs will be valid/in range for this program.
Log type: Crosstie Logs, White Oak Stave Logs or Softwood Logs.
Log length in feet
DIB in inches
Log grade (if Crosstie or White Oak). Log type if Softwood.
Use constants for full credit on your lab! I used 14 constants!
Outputs (in exactly the format specified!)
A welcome message:
Welcome to Forest Products in Tennessee.
Menu and prompt for log types:
1 Crosstie Log
2 White Oak Stave Log
3 Softwood Log
Enter log type by number:
Prompt for log length:
Enter log length in feet:
Prompt for log DIB (Diameter Inside Bark):
Enter log DIB in inches:
Prompt for grade (when log type is Crosstie or White Oak):
Enter log grade:
Prompt for wood type (when log is Softwood):
1 SY Pine
2 White Pine
3 Hemlock
Enter wood type by number:
The volume of the log and its price (with exactly one digit to the right of the decimal for volume and two digits to the right of the decimal for price):
Log volume: 30.9 board feet
Log price: $11.59
A good-bye message:
Thank you for using this program!
Sample execution 1:
1 Crosstie Log
2 White Oak Stave Log
3 Softwood Log
Enter log type by number: 1
Enter log length in feet: 9.8
Enter log DIB in inches: 11.1
Enter log grade: 1
Log volume: 30.9 board feet
Log price $11.58
Thank you for using this program!
Sample execution 2:
1 Crosstie Log
2 White Oak Stave Log
3 Softwood Log
Enter log type by number: 3
Enter log length in feet: 15.6
Enter log DIB in inches: 7.9
1 SY Pine
2 White Pine
3 Hemlock
Enter wood type by number: 3
Log volume: 14.8 board feet
Log price: $2.67
Thank you for using this program!