ISSUE NEEDED TO BE SOLVED: I attached the error codes that keep presenting themselves with the code I created and do not know what they mean or how to fix them to get the program to run.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

ASSIGNMENT: You are working for a lumber company, and your employer would like a program that calculates the cost of lumber for an order. The company sells pine, fir, cedar, maple, and oak lumber. Lumber is priced by board feet. One board foot equals one square foot that is one inch thick. The price per board foot is given in the following table:

Pine 0.89

Fir 1.09

Cedar 2.26

Maple 4.50

Oak 3.10

The lumber is sold in different dimensions (specified in inches of width and height, and feet of
length) that need to be converted to board feet. For example, a 2 x 4 x 8 piece is 2 inches wide, 4inches high, and 8 feet long, and is equivalent to 5.333 board feet (2 * 4 * 8 = 64, which when divided by 12 = 5.333 board feet). An entry from the user will be in the form of a letter and four
integer numbers. The integers are the number of pieces, width, height, and length. The letter will be one of P, F, C, M, O (corresponding to the five kinds of wood) or T, meaning total. When the letter is T, there are no integers following it on the line. The program should print out the price
for each entry, and print the total after T is entered. Here is an example run:

Enter item: P 10 2 4 8

10 2x4x8 Pine, Cost:$47.47

Enter item: M 1 1 12 8

1 1x12x8 Maple, cost:$36.00

Develop the program using functional decomposition, and use proper style and documentation in your code. Your program must make appropriate use of value-returning functions in solving this problem. Make sure that the user prompts are clear and that the output is labeled appropriately.

 

Code Created:

//<File name> -- brief statement as to the file’s purpose

//CSIS 111-<Section Number> ADD YOUR SECTION NUMBER

//<Sources if necessary>

//Include statements

#include <iostream>

#include <string>

#include <iomanip>

using namespace std;

//function prototypes

float calculateFeet(int w, int h, int l);

//Global declarations: Constants and type definitions only -- no variables

int main()

{

       //In cout statement below SUBSTITUTE your name and lab number

       cout << "Your name -- Lab Number" << endl << endl;

       //Variable declarations

       char ch;

       float total = 0, cost = 0;

       cout << setprecision(2) << fixed;

       while (true)

       {

              cout << "Enter item: ";

              cin >> ch;

              if (ch != 'T')

              {

                    int piece, width, height, length;

                    cin >> piece;

                    cin >> width;

                    cin >> height;

                    cin >> length;

                    switch (ch)

                    {

                    case'P':

                           cost = (0.89 * piece * calculateFeet(width, height, length));

                           cout << piece << "" << width << "x" << height << "x" << length << "" << "Pine," << " cost: " << "$" << cost << "\n";

                           break;

                    case 'F':

                           cost = (1.09 * piece * calculateFeet(width, height, length));

                           cout << piece << "" << width << "x" << height << "x" << length << "" << "Fir," << " cost: " << "$" << cost << "\n";

                           break;

                    case 'C':

                           cost = (2.26 * piece * calculateFeet(width, height, length));

                           cout << piece << "" << width << "x" << height << "x" << length << "" << "Cedar," << " cost: " << "$" << cost << "\n";

                           break;

                    case 'M':

                           cost = (4.50 * piece * calculateFeet(width, height, length));

                           cout << piece << "" << width << "x" << height << "x" << length << "" << "Maple," << " cost: " << "$" << cost << "\n";

                           break;

                    case 'O':

                           cost = (3.10 * piece * calculateFeet(width, height, length));

                           cout << piece << "" << width << "x" << height << "x" << length << "" << "Oak," << " cost: " << "$" << cost << "\n";

                           break;

                    }

                    total += cost;

              }

              else

              {

                    cout << "Total cost: $" << total << "\n";

                    break;

              }

 

       }

       //Program logic

       //Closing program statements

       system("pause");

       return 0;

}

//Function definitions

float calculateFeet(int w, int h, int l)

{

       float feet = ((w*h*l)/12.0);

       return feet;

}



ISSUE NEEDED TO BE SOLVED: I attached the error codes that keep presenting themselves with the code I created and do not know what they mean or how to fix them to get the program to run. My assignment is due tonight and am desparate for help. The program is through Visual Studio and is C++ related

Arithmetic overflow: Using operator
on a 4 byte value and then
casting the result to a 8 byte value.
Cast the value to the wider type
A C26451
ConsoleApplication6
Source.cpp
71
before calling operator *' to avoid
overflow (io.2).
'=': conversion from 'double' to
'float', possible loss of data
A C4244
ConsoleApplication6
Source.cpp
34
'=': conversion from 'double' to
'float', possible loss of data
A C4244
ConsoleApplication6
Source.cpp
38
'=': conversion from 'double' to
'float', possible loss of data
A C4244
ConsoleApplication6
Source.cpp
42
'=': conversion from 'double' to
A C4244
ConsoleApplication6
Source.cpp
46
'float', possible loss of data
'=': conversion from 'double' to
A C4244
ConsoleApplication6
Source.cpp
50
'float', possible loss of data
'initializing': conversion from
'double' to 'float', possible loss of
A C4244
ConsoleApplication6
Source.cpp
71
data
_main already defined in
ConsoleApplication6.obj
X LNK2005
ConsoleApplication6
Source.obj
1
one or more multiply defined
symbols found
LNK1169
ConsoleApplication6
ConsoleApplication6.exe
1
Transcribed Image Text:Arithmetic overflow: Using operator on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type A C26451 ConsoleApplication6 Source.cpp 71 before calling operator *' to avoid overflow (io.2). '=': conversion from 'double' to 'float', possible loss of data A C4244 ConsoleApplication6 Source.cpp 34 '=': conversion from 'double' to 'float', possible loss of data A C4244 ConsoleApplication6 Source.cpp 38 '=': conversion from 'double' to 'float', possible loss of data A C4244 ConsoleApplication6 Source.cpp 42 '=': conversion from 'double' to A C4244 ConsoleApplication6 Source.cpp 46 'float', possible loss of data '=': conversion from 'double' to A C4244 ConsoleApplication6 Source.cpp 50 'float', possible loss of data 'initializing': conversion from 'double' to 'float', possible loss of A C4244 ConsoleApplication6 Source.cpp 71 data _main already defined in ConsoleApplication6.obj X LNK2005 ConsoleApplication6 Source.obj 1 one or more multiply defined symbols found LNK1169 ConsoleApplication6 ConsoleApplication6.exe 1
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY