Q2) Mr. Tariq Al-Nasri owns a tools design industry in which they are making tools of various shapes. As soon as the order is received, the designer enters the details of the order which comprises tool_code, shape, measurement(s) (one or more as required by the shape). The tools industry requires a menu driven software to support the designer. The following are the tasks to be programmed: (Assume all the records of the binary file are following list format: [tool_code, shape, radius]) (0) Write a function to accept details like tool_code, shape, and radius as soon as the order is received. The accepted one record is used to create a binary file called ToolsData.dat Write a function to add records at the end of the binary file ToolsData.dat, after accepting tool_code, shape and radius from the user. € (ii) Write a function to calculate the Curved Surface Area (CSA) and Total Surface Area (TSA) for each record according to the name of the shape after reading from ToolsData.dat. Add the calculated CSA and TSA at the end of each record. (USE append() attribute of the List). The updated records should be written back into ToolsData.dat. Write a function to read and display all the records from Tools Data.dat. Handle EOFError exception when the end of file is reached. Write a function to read and display all the records from ToolsData.dat that are of given shape. (For Example, if the user enters "sphere", then all the records related to sphere should be displayed. Or else if the user enters "hemisphere", then all the records related to hemisphere should be displayed.) Supportive details for your reference: Records to be used as input during test run your program. "T1", "sphere", 1.251 ["T2", "hemisphere", 1.75) ["3", "hemishpere", 2.01 ["74", "sphere",2.251 ["75"," hemishpere ",3.251 ["T6"," hemishpere ",0.25) ["T7"," hemishpere ",4.251 ["T8", "sphere",0.5) ["79"," hemishpere ",1.01 (iii) (iv) (v) Formulas to calculate: Shape Name: sphere CSA = 4 r² TSA = 4 nr² Shape Name: hemisphere CSA=2 ttr² TSA=3 rr²

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter8: I/o Streams And Data Files
Section8.5: A Case Study: Pollen Count File Update
Problem 3E
icon
Related questions
Question
Q2) Mr. Tariq Al-Nasri owns a tools design industry in which they are making tools of various shapes.
As soon as the order is received, the designer enters the details of the order which comprises tool_code,
shape, measurement(s) (one or more as required by the shape). The tools industry requires a menu
driven software to support the designer.
The following are the tasks to be programmed:
(Assume all the records of the binary file are following list format: [tool_code, shape, radius])
(6)
Write a function to accept details like tool_code, shape, and radius as soon as the order is
received. The accepted one record is used to create a binary file called ToolsData.dat
Write a function to add records at the end of the binary file ToolsData.dat, after accepting
tool_code, shape and radius from the user.
Write a function to calculate the Curved Surface Area (CSA) and Total Surface Area (TSA) for
each record according to the name of the shape after reading from Tools Data.dat. Add the
calculated CSA and TSA at the end of each record. (USE append() attribute of the List). The
updated records should be written back into ToolsData.dat.
Write a function to read and display all the records from Tools Data.dat. Handle EOFError
exception when the end of file is reached.
€
(iv)
(v)
Write a function to read and display all the records from ToolsData.dat that are of given
shape. (For example, if the user enters "sphere", then all the records related to sphere
should be displayed. Or else if the user enters "hemisphere", then all the records related to
hemisphere should be displayed.)
Supportive details for your reference:
Records to be used as input during test run your program.
["T1", "sphere", 1.251
["T2", "hemisphere", 1.751
["3", "hemishpere",2.01
["T4", "sphere",2.25]
["T5"," hemishpere ", 3.25]
["T6"," hemishpere ",0.25)
["T7"," hemishpere ",4.251
["T8", "sphere", 0.5]
["T9"," hemishpere ",1.01
Formulas to calculate:
Shape Name: sphere
CSA = 4 r²
TSA = 4 nr²
Shape Name: hemisphere
CSA=2 ttr²
TSA = 3 nr²
Transcribed Image Text:Q2) Mr. Tariq Al-Nasri owns a tools design industry in which they are making tools of various shapes. As soon as the order is received, the designer enters the details of the order which comprises tool_code, shape, measurement(s) (one or more as required by the shape). The tools industry requires a menu driven software to support the designer. The following are the tasks to be programmed: (Assume all the records of the binary file are following list format: [tool_code, shape, radius]) (6) Write a function to accept details like tool_code, shape, and radius as soon as the order is received. The accepted one record is used to create a binary file called ToolsData.dat Write a function to add records at the end of the binary file ToolsData.dat, after accepting tool_code, shape and radius from the user. Write a function to calculate the Curved Surface Area (CSA) and Total Surface Area (TSA) for each record according to the name of the shape after reading from Tools Data.dat. Add the calculated CSA and TSA at the end of each record. (USE append() attribute of the List). The updated records should be written back into ToolsData.dat. Write a function to read and display all the records from Tools Data.dat. Handle EOFError exception when the end of file is reached. € (iv) (v) Write a function to read and display all the records from ToolsData.dat that are of given shape. (For example, if the user enters "sphere", then all the records related to sphere should be displayed. Or else if the user enters "hemisphere", then all the records related to hemisphere should be displayed.) Supportive details for your reference: Records to be used as input during test run your program. ["T1", "sphere", 1.251 ["T2", "hemisphere", 1.751 ["3", "hemishpere",2.01 ["T4", "sphere",2.25] ["T5"," hemishpere ", 3.25] ["T6"," hemishpere ",0.25) ["T7"," hemishpere ",4.251 ["T8", "sphere", 0.5] ["T9"," hemishpere ",1.01 Formulas to calculate: Shape Name: sphere CSA = 4 r² TSA = 4 nr² Shape Name: hemisphere CSA=2 ttr² TSA = 3 nr²
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Header Files
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr