Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
Resin Molds Judy runs a shop that sells molds used in arts and crafts, specifically for use with resin. The molds are made of silicone
Resin Molds Judy runs a shop that sells molds used in arts and crafts, specifically for use with resin. The molds are made of silicone and come in various shapes and sizes. Each mold weighs a different amount which affects the shipping cost. Judy needs a program to help her process orders for her molds. You will create a program that allows Judy to enter an order for a mold and create an invoice in the form of an output file. Start by creating an enum that represents the different possible sizes of molds. Then you will create a struct that represents the molds. To keep track of the order, you will also need to create a customer struct and an order struct. The specifications for the enum and structs are listed below. Size Enumeration Name sizeType Enumerators Printed Name S Small M Medium L Large Mold Struct Name moldType Members shape : string size : sizeType price : double weight : double Customer Struct Name customerType Members fname : string lname : string address : string Order Struct Name orderType Members customer : customerType products : moldType numProdOrdered : int subTotal : double totalWeight : double shippingCost : double The catalog of products currently available will be kept in catalog.txt Judy keeps products in stock at a time. These are the products that will be ordered by customers. You will need to create the following functions to set up Judy's program. Function Name readCatalog Parameters productCatalog : moldType numProducts : int Return Type void Description This function reads catalog.txt Each line of the file contains information about a mold that is currently for sale. Because she is frequently rotating stock around, this file will change and have different information in it you cannot hardcode the data into the program Function Name enterOrder Parameters order : orderType& by reference catalog: moldType numItemsInCatalog : int Return Type void Description This function prompts the user for the information pertaining to an order. It will provide options that allow for up to products to be selected. It will store the order information in the reference parameter. The shipping cost is calculated based on weight using the formula Function Name printProduct Parameters ostream& output stream by reference, either a file or the console mold : moldType Return Type void Description This function takes the information about a mold and prints it using the output stream provided. This allows us to print to either a file or the console with the same function. Function Name printOrder Parameters ostream& output stream by reference, either the console or a file orderType& the order we are going to print Return Type void Description This function takes the information about an order and prints it to the stream that is given as a parameter. This allows the function to output to multiple sources, like an output file or the console. For the main, you will first need to read the current product catalog into an array of moldType. Next, you will get the order information from Judy. You will output the order to the console and to a file named using the customer's last name. Lastly, you will ask if Judy wants to enter any more orders. If she answers n exit the program; if she answers y repeat the process of getting order information and creating a new output file. here is catalog.txt "Pendant M Dragon L Heart S Ornament M Seahorse L Domino L Tree L Flower S Coaster M Keychain S Sun L Geode M Angel M Butterfly S Rose S Spider M Bubble S Tray L Lizard M Turtle M and here is parker.txt "Customer: Peter Parker Main St Queens, NY Products Ordered: Pendant Medium $g Ornament Medium $g Spider Medium $g Lizard Medium $g Turtle Medium $g Tree Large $g Tray Large $g Coaster Medium $g Seahorse Large $g Rose Small $g Subtotal: $ Total Weight: g Shipping Cost: $ Total Cost: $ here is stark.txt "Customer: Tony Stark Park Ave New York, NY Products Ordered: Turtle Medium $g Sun Large $g Keychain Small $g Subtotal: $ Total Weight: g Shipping Cost: $ Total Cost: $ be sure to use all three files when writing the code.
Resin Molds
Judy runs a shop that sells molds used in arts and crafts, specifically for use with resin. The molds are made of silicone and come in various shapes and sizes. Each mold weighs a different amount which affects the shipping cost. Judy needs a program to help her process orders for her molds. You will create a program that allows Judy to enter an order for a mold and create an invoice in the form of an output file.
Start by creating an enum that represents the different possible sizes of molds. Then you will create a struct that represents the molds. To keep track of the order, you will also need to create a customer struct and an order struct. The specifications for the enum and structs are listed below.
Size Enumeration
Name
sizeType
Enumerators Printed Name
S Small
M Medium
L Large
Mold Struct
Name
moldType
Members
shape : string
size : sizeType
price : double
weight : double
Customer Struct
Name
customerType
Members
fname : string
lname : string
address : string
Order Struct
Name
orderType
Members
customer : customerType
products : moldType
numProdOrdered : int
subTotal : double
totalWeight : double
shippingCost : double
The catalog of products currently available will be kept in catalog.txt Judy keeps products in stock at a time. These are the products that will be ordered by customers. You will need to create the following functions to set up Judy's program.
Function
Name
readCatalog
Parameters
productCatalog : moldType
numProducts : int
Return Type
void
Description
This function reads catalog.txt Each line of the file contains information about a mold that is currently for sale. Because she is frequently rotating stock around, this file will change and have different information in it you cannot hardcode the data into the program
Function
Name
enterOrder
Parameters
order : orderType& by reference
catalog: moldType
numItemsInCatalog : int
Return Type
void
Description
This function prompts the user for the information pertaining to an order. It will provide options that allow for up to products to be selected. It will store the order information in the reference parameter. The shipping cost is calculated based on weight using the formula
Function
Name
printProduct
Parameters
ostream& output stream by reference, either a file or the console
mold : moldType
Return Type
void
Description
This function takes the information about a mold and prints it using the output stream provided. This allows us to print to either a file or the console with the same function.
Function
Name
printOrder
Parameters
ostream& output stream by reference, either the console or a file
orderType& the order we are going to print
Return Type
void
Description
This function takes the information about an order and prints it to the stream that is given as a parameter. This allows the function to output to multiple sources, like an output file or the console.
For the main, you will first need to read the current product catalog into an array of moldType. Next, you will get the order information from Judy. You will output the order to the console and to a file named using the customer's last name. Lastly, you will ask if Judy wants to enter any more orders. If she answers n exit the program; if she answers y repeat the process of getting order information and creating a new output file. here is catalog.txt "Pendant M
Dragon L
Heart S
Ornament M
Seahorse L
Domino L
Tree L
Flower S
Coaster M
Keychain S
Sun L
Geode M
Angel M
Butterfly S
Rose S
Spider M
Bubble S
Tray L
Lizard M
Turtle M and here is parker.txt "Customer: Peter Parker
Main St
Queens, NY
Products Ordered:
Pendant Medium $g
Ornament Medium $g
Spider Medium $g
Lizard Medium $g
Turtle Medium $g
Tree Large $g
Tray Large $g
Coaster Medium $g
Seahorse Large $g
Rose Small $g
Subtotal: $
Total Weight: g
Shipping Cost: $
Total Cost: $ here is stark.txt "Customer: Tony Stark
Park Ave
New York, NY
Products Ordered:
Turtle Medium $g
Sun Large $g
Keychain Small $g
Subtotal: $
Total Weight: g
Shipping Cost: $
Total Cost: $ be sure to use all three files when writing the code.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started