I'm trying to write a pseudocode for finding the area of a trapezoid. Is this right?

THIS IS THE GIVEN INFORMATION


Write a Fortran 90 program to compute the area of the trapezoid.

Upon execution of the program, the user (you) will be prepared to provide the lengths of the two bases - and - in cm. The programmer (you) is told in advance that the height (h) is 3 cm. Your Fortran program should request from the user the two REAL values representing the lengths of the bases and using the value of 3 cm for the height of the trapezoid, compute the area of the trapezoid. Your program should output to the screen the following values: a “title (example shown below), the lengths of the two bases, the height, and the area. You (the user at run time) should provide the executing program with lengths 4.2 cm and 5.6 cm, respectively, for the first and second base lengths.


For example, your output may appear as:

Trapezoid Area Computation

The length of the first base: 4.2
The length of the second base: 5.6
The height: 3
The area: ????


THIS IS MY PSEUDOCODE


Pseudocode –

-identify the formula for finding the area of a trapezoid
-assign characters to the variables of equation
-prompt the user to use the integer value of 3 for the height
-run the program
-prompt the user to enter the value of the first real base as 4.2
-prompt the user to enter the value of the second real base as 5.6
-compute area of the trapezoid
-display the result

Dani AI

Generated

Good start, . 's request to check the instructor's pseudocode definition is important — the assignment wants short English phrases that describe tasks, not implementation keywords or specific test inputs. The original list mixes planning steps and run-time test values; keep the algorithm separate from sample input/output.

Display title "Trapezoid Area Computation"
Prompt for first base length (REAL)
Prompt for second base length (REAL)
Set height to the given value (3 cm)
Compute area = 0.5 * (first base + second base) * height
Display first base, second base, height, and area

Notes and common pitfalls: keep each line a brief action (no language syntax). Do not write lines like "prompt the user to enter 4.2" inside the pseudocode — that is a test-case, not part of the algorithm. A sample calculation for the provided test values: (4.2 + 5.6) 3 0.5 = 14.7. When translating this pseudocode into Fortran 90, declare the numeric variables as REAL, set height = 3.0 (use the decimal to force floating-point arithmetic), compute area = 0.5*(b1 + b2)*height, and print the four outputs with a simple write/print statement or a formatted write to show decimals.

This keeps the submitted pseudocode within the instructor's short-phrase style and makes the later Fortran translation straightforward.

Recommended Answers

All 4 Replies

No.

how do i do it then?

Maybe your instructor is using a different definition of pseudocode than is normally used. What is his/her's definition of pseudocode?

short, English phrases used to explain specific tasks within a program's algorithm; should not include keywords in any specific computer languages;should be written as a list of consecutive phrases

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.