Expand your knowledge base with the help of IDNLearn.com's extensive answer archive. Explore thousands of verified answers from experts and find the solutions you need, no matter the topic.
THE IF STATEMENT
The IF statement allows one of two sets of statements to be executed, depending upon a condition. A structure diagram of the first program we shall consider which contains a control statement is shown in Figure 5 .1. The program computes an employee's weekly pay given the number of hours worked by the employee and his hourly rate of pay. Hours worked over 37.5 are paid at time-and-a-half. So, a different calculation must be made, depending on whether the number of hours worked is greater than
37.5 or not.
Using the information above, Write a program in COBOL. that follows and the diagram below. The first four lines of your code should include the date, author, purpose and your class information.
Include a comment that declares named constants and variables. Include variables for hours worked, pay rate, and pay.
Include a comment that describes the input items to display and accept information from the user.
Include a comment to calculate the pay raise.
Before you consider the program, you need to first look at the components of a structure diagram. Straightforward actions, such as input, arithmetic, and output functions, are contained in rectangular (or square) boxes. Hence, the input, output and two calculations are each in rectangular boxes. A two-way conditional function is represented by three triangles in a rectangle. The center triangle contains the condition (e.g. HOURS-WORKED> 37.5) and the two outer triangles contain the result of the condition (e.g., YES and NO). The actions for each result of the condition are contained in rectangles below each of the outer triangles (e.g. the two rectangles each containing a calculation).
The last comment will display a message “ This program computes pay plus time and a half. Use the diagram below to help construct the if else program.
Sagot :
We appreciate your presence here. Keep sharing knowledge and helping others find the answers they need. This community is the perfect place to learn together. Find precise solutions at IDNLearn.com. Thank you for trusting us with your queries, and we hope to see you again.