I n this homework, you will design a program to perform the following task: Design and write a program, using functions, that calculates the area and perimeter of a rectangle whose dimensions (length and width) are provided by a user. There are 4 components of your submission including: Program Description- A detailed, clear description of the program you are building. Analysis- Demonstrates your thought process and steps used to analyze the problem. Be sure to include the required input and output and how you will obtain the required output from the given input? Also, include your variable names and definitions. Be sure to describe the necessary formulas and sample calculations that might be needed. Talk about how your design will allow any number of students and final grades to be possible inputs. Test plan – Prepare at least 3 sets of input data (Test data) along with their expected output for testing your program. Your test data can be presented in the form of a table as follows (note: feel free to adapt to your design) Pseudocode- Provide pseudocode of your overall design that fulfills the requirements of the project All of these components should be placed in word document for submission. Example application test data:

Program Description:

The program is designed to calculate the area and perimeter of a rectangle. It takes input from the user for the length and width of the rectangle, and then uses these values to calculate and display the area and perimeter. The program is written using functions to improve modularity and ease of understanding.

Analysis:

To solve the problem, we need the following inputs from the user:
– Length of the rectangle
– Width of the rectangle

We will use these inputs to calculate the area and perimeter of the rectangle.

In the program, we will define two functions: calculateArea and calculatePerimeter. Both of these functions take the length and width as parameters and return the calculated values.

The formulas used for calculating the area and perimeter are as follows:
– Area = length * width
– Perimeter = 2 * (length + width)

We will prompt the user to enter the values for length and width. The program will then call the calculateArea and calculatePerimeter functions, passing the user input as arguments. The returned values will be displayed to the user.

Variable Names and Definitions:
– length: Represents the length of the rectangle
– width: Represents the width of the rectangle
– area: Represents the calculated area of the rectangle
– perimeter: Represents the calculated perimeter of the rectangle

Design:

1. Prompt the user to enter the length of the rectangle and store it in the variable “length”
2. Prompt the user to enter the width of the rectangle and store it in the variable “width”
3. Call the calculateArea function, passing the arguments “length” and “width”. Store the returned value in the variable “area”
4. Call the calculatePerimeter function, passing the arguments “length” and “width”. Store the returned value in the variable “perimeter”
5. Display the calculated area and perimeter to the user

This design allows for any number of rectangles to be calculated by reusing the same functions, making it flexible and efficient. The program takes user input, performs the necessary calculations, and displays the results.

Test Plan:

Test Data 1:
Length: 5
Width: 10
Expected Output:
Area: 50
Perimeter: 30

Test Data 2:
Length: 3.5
Width: 7.8
Expected Output:
Area: 27.3
Perimeter: 22.6

Test Data 3:
Length: 0
Width: 15
Expected Output:
Area: 0
Perimeter: 30

Pseudocode:

Function calculateArea(length, width)
area = length * width
return area

Function calculatePerimeter(length, width)
perimeter = 2 * (length + width)
return perimeter

Prompt user to enter length
Read length from user

Prompt user to enter width
Read width from user

area = calculateArea(length, width)
perimeter = calculatePerimeter(length, width)

Display area
Display perimeter

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.


Click Here to Make an Order Click Here to Hire a Writer