Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Specifications for Functions: Function main ( ) ( this section deals with all the requirements for function main ( ) ) 1 . The only

Specifications for Functions:
Function main()(this section deals with all the requirements for function main())
1. The only variables allowed in this function are: TempC, T_Length, M_Opt, Sel.
Choose your variable data types carefully.
2. The menu() function should be called to allow the user to select the appropriate
calculation.
3. Once the selection has been returned, a test must be conducted to determine if
the user terminated the program. If not, the user must enter the values of the
total length of the construction and the maximum temperature (\deg C) to be
considered in the design. See screenshot (Figure 1).
4. The user will now be presented with a list of available construction materials
that could be used, from which the user will be requested to select. See
screenshot (Figure 2).
5. A test should then be performed to ensure that if the material is not available
from the list and the user did not select X in the menu() function, then the
variable Sel should be set to the character value of E.
6. A switch() statement will then be used to determine what further action should
be taken based on the users initial input from the menu() function. Should the
user have terminated the program in the menu() function (X), then the message:
User terminated program, should be displayed. The default message should
display: User termination Material not listed. The switch statement does not
test for the E character, so this becomes the default option.
7. No calculations or answers should be printed in this function.
Function menu()(this section deals only with what is contained in function menu())
1. This function displays the options available to the user as per the screenshot
(Figure 1). The layout in the screenshot forms part of the specification.
2. An unformatted input accepts the users selection into the only variable allowed
in this function, which is Sel.
SFD261S -2024- GA-Assessment (GA9)
4|
3. A test should be performed to ensure that should the user enter an invalid input,
they will be warned with a message: Invalid option selected! For one second.
See screenshot (Figure 6).
4. No other inputs, calculations or function calls are allowed in this function.
5. Once you have tested this menu() function using a do/while loop, the total
menu should be refreshed so that the user can re-enter the correct value.
6. Once the correct value has been entered, this function will return the user
selection to the main() function.
Function Therm_Expansion()(this section deals with what is contained in function
Therm_expansion())
1. The task of this function is to do all the calculations relating to the thermal
expansion and temperature conversion from Celsius to Fahrenheit.
2. All the variable names used in the main() function must be used in this function.
Additional variables that must be used are: Co_Factor, TempF, Expand.
3. Since this function is going to be used for either Steel/Concrete or Aluminium as
a construction material, a decision must be taken as to which constant
coefficient should be used for the calculation.
4. The calculations can then be performed, and the display function can be called
to display the answers.
5. No input or output statement can be used in this function.
Function Display_Ans()(This section deals only with what is contained in function
Display_Ans())
1. The only task of this function is to display the results of the calculations. See
screenshots.
2. Only the appropriate variable names used in the other functions must be used in
this function.
3. No heading or sub-heading can be printed in this function. The heading and subheadings must be displayed in the appropriate locations in the main() function.
4. No input, statements, function calls or other calculations are allowed in this
function.
It is recommended that you first develop the functions above to produce a single set of
calculations before you attempt to implement the second option of the table
SFD261S -2024- GA-Assessment (GA9)
5|
generation. Plan these functions using a flowchart so that you get the calculations and
display operation in the right order. Once the single calculation works properly, then
develop the function below. Test changes made to your program regularly and fix any
syntax errors that may creep into the program.
Function Thermal_TableGen()(This section deals only with what is contained in
function Therm_TableGen())
1. The only task of this function is to generate an Expansion Table: Option 2 in the
menu() function.
2. Only the appropriate variable should be received by this function. An additional
variable must be introduced called Temp.
3. The minimum temperature of -10\deg C should be set.
4. A while loop should be used to generate the Expansion Table. The appropriate
function must be called to perform the calculations.
5. The temperature should be increased by increments of 10\deg C until th

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

Students also viewed these Databases questions

Question

How does this scenario illustrate the process of mainstreaming?

Answered: 1 week ago

Question

What are personal and social media?

Answered: 1 week ago