Question

In: Computer Science

1 Program Summary We are subcontractors for the Corellian Engineering Corportation (CEC) and we are working...

1 Program Summary

We are subcontractors for the Corellian Engineering Corportation (CEC) and we are working on one of the subsystems for the MC85 star cruiser. Our task is to model stress on a particular surface of the cruiser. Stress is defined as σ = Ld Area , where Ld is the load and Area is the area. Let’s say we are working with the metric measure system. So the load would be in kilo grams. Area would be meters. We need log into the system and enter the weight (Load) and the Area, (length x width) and calculate and display the stress on that particular area.

2 Program Behavior The program will do the following.

1: declare floating point variables, fLoad, fWidth, fLength and initialize them

2: declare a string to hold login password

3: display the message ”Stress Modeling SubSystem 0.1a”

4: display the login message ”Login ID: ”

5: get the login id from the user

6: compare it to the special code ”0a132”

7: don’t do the calculation if special code doesn’t match, also print out an error message (see below)

8: if the login id matches the special code we prompt the user for load, length and width

9: make sure that we give the user an error message if either length or width are 0, also print out an error message (see below)

10: we calculate the stress value

11: we display the stress value with accuracy of 2 decimal places.

12: make sure we always show the decimal value

Please note that I will be compiling your code on my computer and testing your code to see if it runs. use c++ language for this assignment and please do add a screenshot of all your codifications.

Solutions

Expert Solution

Please find the requested program below. Also including the screenshot of sample output and code to understand the indentation

Please provide your feedback

Thanks and Happy learning!

Sample output:

Partial code :

#include<iostream>
#include<string>
#include<iomanip>

int main()
{
    //1: declare floating point variables, fLoad, fWidth, fLength and initialize them
    float fLoad = 0.0f;
    float fWidth = 0.0f;
    float fLength = 0.0f;

    //2: declare a string to hold login password
    std::string strPassword;

    //3: display the message "Stress Modeling SubSystem 0.1a"
    std::cout << "Stress Modeling SubSystem 0.1a" << std::endl;

    //4: display the login message "Login ID: "
    std::cout << "Login ID: ";

    //5: get the login id from the user
    std::getline(std::cin, strPassword);

    //6: compare it to the special code "0a132"
    if (strPassword.compare("0a132"))
    {
        //7: don’t do the calculation if special code doesn’t match, also print out an error message
        std::cout << "ERROR: Invalid login ID" << std::endl;
    }
    else
    {
        //8: if the login id matches the special code we prompt the user for load, length and width
        std::cout << "Enter the load value (in kilo grams): ";
        std::cin >> fLoad;

        std::cout << "Enter the length value (in meters): ";
        std::cin >> fLength;

        std::cout << "Enter the width value (in meters): ";
        std::cin >> fWidth;

        //9: make sure that we give the user an error message if either length or width are 0, 
        //   also print out an error message
        if ((fLength == 0.0f) || (fWidth == 0.0f))
        {
            std::cout << "ERROR: Length or Breadth value cannot be zero." << std::endl;
        }
        else if (fLoad <= 0.0f)
        {
            std::cout << "ERROR: Load value should be greater than zero." << std::endl;
        }
        else
        {
            //10: we calculate the stress value
            //    Stress = Load * Area
            //    Stress = Load * length * width
            //11: we display the stress value with accuracy of 2 decimal places.
            //12 : make sure we always show the decimal value
            std::cout << "Stress = " <<std::setprecision(2)<< fLoad * fLength * fWidth << std::endl;
        }
    }

    return 0;
}

Related Solutions

1 Program Summary We are subcontractors for the Corellian Engineering Corportation (CEC) and we are working...
1 Program Summary We are subcontractors for the Corellian Engineering Corportation (CEC) and we are working on one of the subsystems for the MC85 star cruiser. Our task is to model stress on a particular surface of the cruiser. Stress is defined as σ = Ld Area , where Ld is the load and Area is the area. Let’s say we are working with the metric measure system. So the load would be in kilograms. Area would be meters. We...
We are working on functions of complex variables in calculus (Chpt. 17.4 in Advanced Engineering Mathematics),...
We are working on functions of complex variables in calculus (Chpt. 17.4 in Advanced Engineering Mathematics), and our prof posed us the following question: "Find the function w = u + iv = f(z) that maps the region S := {z : 0 ≤ arg z ≤ π 4 } to the upper half plane {w = u + iv : v ≥ 0}." the answer he gave to this problem was as follows: "such a mapping is given by...
One page summary of cardiac tissue engineering.
One page summary of cardiac tissue engineering.
Executive Summary of Impacts of Engineering Decisions on Financial Statements
Executive Summary of Impacts of Engineering Decisions on Financial Statements
Select any engineering company and assume you are an engineering manager working in that company. Your...
Select any engineering company and assume you are an engineering manager working in that company. Your department has been awarded an external grant of $1M to select 1 project of your choice. You have identified 5 mutually exclusive projects to choose from. However, you can only select one and you have decided to select the 1 project by using NPV-based analysis. For this question, you do not have to calculate NPV or show any calculations. (a) List your 5 hypothetical...
Civil engineering Working at high saffolding seafty pdf
Civil engineering Working at high saffolding seafty pdf
Civil Engineering (Geo-Polymer Concrete) Summary: Do some researches & write one or two page of summary...
Civil Engineering (Geo-Polymer Concrete) Summary: Do some researches & write one or two page of summary report on design and uses of geo-polymer concrete. Focus attention on the mix design, and specific uses. Include the Work cited if it’s possible.
Civil Engineering (Geo-Polymer Concrete) Summary: Do some researches & write one or two page of summary...
Civil Engineering (Geo-Polymer Concrete) Summary: Do some researches & write one or two page of summary report on design and uses of geo-polymer concrete. Focus attention on the mix design, and specific uses. Include the Work cited if it’s possible.
1.F): Understanding of ethical and professional responsibilities William, an engineer working for an established engineering firm,...
1.F): Understanding of ethical and professional responsibilities William, an engineer working for an established engineering firm, is working after normal business hours to finish an important and urgent on-going bid. He realizes that he is missing data that had been sent to his coworker Mike. William had inadvertently observed Mike typing his password several days ago and decides to log into Mike’s computer and resend the data to himself. Upon doing so, William sees an email sent from Mike’s account...
You are working on a feedwater system for a chemical engineering plant. A section of the...
You are working on a feedwater system for a chemical engineering plant. A section of the pipe passes through a stream of width ? = 4 m which flows at constant temperature and velocity (?∞ = 12 °C,?∞ = 1.7 m⁄s). You need to determine the temperature change of the feedwater as it passes through the stream. The feedwater is 20 °C as it enters the section passing through the stream. The pipe diameter is 4 inches and the volume...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT