Question: Write a program C + + Judy runs a shop that sells molds used in arts and crafts, specifically for use with resin. The molds
Write a program C
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 shipweight
s
h
i
p
w
e
i
g
h
t
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.
Sample Output:
Welcome to Judy's Resin Molds!
Enter the customer first name: Peter
Enter the customer last name: Parker
Enter the customer street address: Main St
Enter the customer city, state, and zip code: Queens, NY
Please choose a product from list:
Pendant Medium $g
Dragon Large $g
Heart Small $g
Ornament Medium $g
Seahorse Large $g
Domino Large $g
Tree Large $g
Flower Small $g
Coaster Medium $g
Keychain Small $g
Sun Large $g
Geode Medium $g
Angel Medium $g
Butterfly Small $g
Rose Small $g
Spider Medium $g
Bubble Small $g
Tray Large $g
Lizard Medium $g
Turtle Medium $g
Item: Pendant Medium $g added.
Do you want to add another product to the order? y
Please choose a product from list:
Pendant Medium $g
Dragon Large $g
Heart Small $g
Ornament Medium $g
Seahorse Large $g
Domino Large $g
Tree Large $g
Flower Small $g
Coaster Medium $g
Keychain Small $g
Sun Large $g
Geode Medium $g
Angel Medium $g
Butterfly Small $g
Rose Small $
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
