Write a Program, Using Functions, That Calculates the Area and Perimeter of a Rectangle Whose Dimensions (Length and Width) Are Provided by a User.

1084 Words5 Pages
Question: In this assignment, you will design a program to perform the following task: Write a program using functions that asks the user for the dimensions (Length and Width) of a rectangle and calculates: a) The area and perimeter of the rectangle b) The length of the diagonal (use the Pythagorean Theorem: c2 = a2 + b2, where c = length of the diagonal; a = length; b = width) This is a rectangle b a Before attempting this exercise, be sure you have completed all of chapter 7 and course module readings, participated in the weekly conferences, and thoroughly understand the examples throughout the chapter. There are 3 main components of your submission including the problem analysis, program design and documentation, and sample test data. 1. Provide your analysis for the following problem statement: Write a program that calculates the area, perimeter, and diagonal length of a rectangle whose dimensions (Length and width) are provided by the user. Your analysis should be clearly written and demonstrate your thought process and steps used to analyze the problem. Be sure to include what is the required output? What is the necessary input and how you will obtain the required output from the given input? Also, include your variable names and definitions. Be sure to describe any necessary formulas and sample calculations. 2. Provide your program design for the problem you analyzed for calculating and displaying the area, perimeter, and diagonal (hypotenuse) length of a rectangle. Always work for modular design where possible. Be sure to use separate function for calculating the area; separate function for calculating the perimeter, and separate function for calculating the diagonal length of the rectangle. Use subprograms for Input and Output. Be sure to describe the fundamental tasks (i.e., things your program must do) needed to solve the problem so you can use

More about Write a Program, Using Functions, That Calculates the Area and Perimeter of a Rectangle Whose Dimensions (Length and Width) Are Provided by a User.

Open Document