•Work in groups of two. You will write a program that will calculate the area of a square based on a randomly generated integer to be used as the side.
•Person 1 –write the main function which will:
1.Generate a random integer between 1 and 100 which will be the side of the square
2.Pass that number to called functions called square_area and square_perimeter.
3.Display the side, the returned area, and the returned perimeter.
•Person 2 – in a separate file called square.py:
1.Define a function called square_area which will accept the side from main, calculate the square area, and returns it to main.
2.Define a function called square_perimeter which will accept the side from main, calculate the square perimeter, and return it to main.
#1.program taking side random
import random #importing random module for generate random
numbers
#function for calculate area and perimeter of square
def square_area_perimeter(side): #function accepting side of
square
area=side*side #calculating area of square
perimeter=4*side #calculating perimeter of
square
return area,perimeter
#main program
side= random.randint(1,100) #generating random number between 1 and
100
sArea,sPerimeter = square_area_perimeter(side) #gettin values from
function
print("side of square : ",side) #displaying side of square
print("area of Square : ",sArea) #displaying area of square
print("perimter of Square : ",sPerimeter) #displaying perimeter of
square
#2.program taking side from user
#function for calculating area of square
def square_area(side):
area=side*side
return area
#function for calculating perimeter of square
def square_perimeter(side):
perimeter=4*side
return perimeter
#main program
side=int(input("Enter side : ")) #taking side from user
print("side of square : ",side) #displaying side of square
print("square area :",square_area(side)) #displaying area of
square
print("square perimeter : ",square_perimeter(side)) #displaying
perimeter of square
•Work in groups of two. You will write a program that will calculate the area of...
1. Write a program that determines the area and perimeter of a square. Your program should accept the appropriate measurement of the square as input from the user and display the result to the screen. Area of Square = L (squared) Perimeter of Square = 4 * L 2. Write a program that determines the area and circumference of a circle. Your program should accept the appropriate measurement of the circle as input from the user and display the result to...
2. Write a program with three functions that will be called from the main function The functions will calculate the volume, area and perimeter of a cuboid. You should able to pass three parameters such as length, width and height, and a function will return area, another will return volume and final one will return perimeter. Define all your variables in floating point numbers 3. Modify the problem#2 to calculate the volume, area and perimeter in a sing le function...
write a c programming
Write a program that will calculate the perimeter, area and volume of a is is entered by the user. Your program will display the radius, perimeter, area and volume to the monitor and will also save them to a file called "circlePAV.txt". Your program should prompt the user for the radius until the user enters -1. Use the following structure. typedef struct ( float radius; float area, float perimeter; float volume; ylinder Figure>
In this program, you will be using C++ programming constructs, such as functions. main.cpp Write a program that asks the user to enter an integer value. Your program will then display that integer back to the user. Your program should include a function called getInteger that requests an integer value from the user and returns that value back to the caller. Your main () function will call the function getInteger and will then display the value returned by that function....
This question is from the textbook "Python for ArcGIS" by Laura Tateosian: Write a script "triangles.py" that takes three arguments, the lengths of three sides of a triangle. Then define the following three functions: 1. perimeter takes three side lengths as arguments and returns the perimeter length. 2. triangleType takes three side lengths as arguments, determines if it is an equilateral triangle, an isosceles triangle, or neither. The result is returned. 3. area takes three side lengths as arguments and...
Using Python Write the following well-documented (commented) program. Create a class called Shape that has a method for printing the area and the perimeter. Create three classes (Square, Rectangle, and Circle) which inherit from it. Square will have one instance variable for the length. Rectangle will have two instance variables for the width and height. Circle will have one instance variable for the radius. The three classes will have methods for computing the area and perimeter of its corresponding shape....
1- Write a C program to add and subtract any two given integer numbers using pointers. 2- Write a C program to find the factorial using a function and pointers. 3- Write a C program to find the square of an Integer number using a function and pointers. 4- Write a C program to find the area and perimeter of a rectangle using a function and pointers. 5- Write a C program to find the larger of two integers numbers using...
(c++) (codeblocks) Write a program that contains a value-returning function that returns a value to be displayed in main() with the function call. No values are passed to the function. The function body should be written to generate a random number from 1-10 as its return value. Display with the call to function in main(): The function returned the value of <return value> when it was called in main.
Need help building this C++ program For your program you will create a class that represents square shapes. I provide you an incomplete client program that will test your class and an incomplete header file where you have to declare and implement the class. In the client program you have to complete certain statements according to the indications provided in the corresponding comments. In the header file you have to create class square according to the following specifications: Member functions...
Write a C program Design a program that uses an array to store 10 randomly generated integer numbers in the range from 1 to 50. The program should first generate random numbers and save these numbers into the array. It will then provide the following menu options to the user: Display 10 random numbers stored in the array Compute and display the largest number in the array Compute and display the average value of all numbers Exit The options 2...