Description Write a C program that deals with cuboids. Each cuboid should have the following information: • Length, width and height of cuboid: positive real numbers only. • Surface area. • Volume. Define a struct that includes the cuboid information is must.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

On Unix system 

Objective
Develop a C program on UNIX system.
Description
Write a C program that deals with cuboids.
Each cuboid should have the following information:
• Length, width and height of cuboid: positive real numbers only.
• Surface area.
• Volume.
Define a struct that includes the cuboid information is must.
Your program should implement the following functions:
1. SetCuboid : fil three values of Length, Width, Height for specific cuboid
2. CalculateVolume: calculates the volume of a cuboid and returns the value of
volume
3. CalculateSurfaceArea: calculates the Surface Area of the cuboid and returns
the value of surface area
4. PrintVolume: Prints the volume of the cuboid.
5. PrintSurfaceArea: Prints the surface area of the cuboid.
6. MaxVolume: returns the volume of cuboid that has the maximum volume.
7. main: does the following:
• Declare an array of struct that has all needed information about any cuboid.
Let the size of array be 4.
• Prompt the user to enter the length, width and height of 4 cuboids and store
them in the struct array variable using SetCuboid function.
• Calculate the vollume and surface area of each cuboid and store it in the
struct array variable using CalculateVolume and CalculateSurfaceArea
functions.
• Prompt the user to select a cuboid number (1, 2, 3 or 4) then Print the
volume and the surface area of selected cuboid using PrintVolume and
PrintSurfaceArea functions.
• Print the maximum volume among all 4 cuboids using MaxVolume function,
Formuals :
CuboidVolume length'width'height
CuboidSurfaceArea 2 ( length'width • height "width • height"length)
eght
Required Files:
Your Program must contain:
1. One header fie(h) that contains the struct definition, functions prototypes, and
any other needed definitions.
2. Two source files(.c)
a. The first file contains the implementation of main function only.
b. The second file contains the implementations of all required functions
except main.
Transcribed Image Text:Objective Develop a C program on UNIX system. Description Write a C program that deals with cuboids. Each cuboid should have the following information: • Length, width and height of cuboid: positive real numbers only. • Surface area. • Volume. Define a struct that includes the cuboid information is must. Your program should implement the following functions: 1. SetCuboid : fil three values of Length, Width, Height for specific cuboid 2. CalculateVolume: calculates the volume of a cuboid and returns the value of volume 3. CalculateSurfaceArea: calculates the Surface Area of the cuboid and returns the value of surface area 4. PrintVolume: Prints the volume of the cuboid. 5. PrintSurfaceArea: Prints the surface area of the cuboid. 6. MaxVolume: returns the volume of cuboid that has the maximum volume. 7. main: does the following: • Declare an array of struct that has all needed information about any cuboid. Let the size of array be 4. • Prompt the user to enter the length, width and height of 4 cuboids and store them in the struct array variable using SetCuboid function. • Calculate the vollume and surface area of each cuboid and store it in the struct array variable using CalculateVolume and CalculateSurfaceArea functions. • Prompt the user to select a cuboid number (1, 2, 3 or 4) then Print the volume and the surface area of selected cuboid using PrintVolume and PrintSurfaceArea functions. • Print the maximum volume among all 4 cuboids using MaxVolume function, Formuals : CuboidVolume length'width'height CuboidSurfaceArea 2 ( length'width • height "width • height"length) eght Required Files: Your Program must contain: 1. One header fie(h) that contains the struct definition, functions prototypes, and any other needed definitions. 2. Two source files(.c) a. The first file contains the implementation of main function only. b. The second file contains the implementations of all required functions except main.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Concept of pointer parameter
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education