Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Given main0, build a struct called Product that will manage product inventory. Product struct has three data members: a product code (string), the product's price
Given main0, build a struct called Product that will manage product inventory. Product struct has three data members: a product code (string), the product's price (double), and the number count of product in inventory (int). Assume product code has a maximum length of 20. Implement the Product struct and related function declarations in Product.h, and implement the related function definitions in Product.c as listed below: - Product InitProduct(char *code, double price, int count) - set the data members using the three parameters - Product SetCode(char *code, Product product) - set the product code (i.e. SKU234) to parameter code - void GetCode(char *productCode, Product product) - return the product code in productCode - Product SetPrice(double price, Product product) - set the price to parameter product - double GetPrice(Product product) - return the price - Product SetCount(int count, Product product) - set the number of items in inventory to parameter num - int GetCount(Product product) - return the count - Product AddInventory(int amt, Product product) - increase inventory by parameter amt - Product Selllnventory(int amt, Product product) - decrease inventory by parameter amt Ex. If a new Product struct is created with code set to "Apple", price set to 0.40, and the count set to 3 , the output is: Name: Apple Price: 0.40 Count: 3 Ex. If 10 apples are added to the Product struct's inventory, but then 5 are sold, the output is: Name: Apple Price: 0.40 Count: 8 Ex. If the Product struct's code is set to "Golden Delicious", price is set to 0.55, and count is set to 4 , the output is: Name: Golden Delicious Price: 0.55 Count: 4 File is marked as read only Current file: main. c - Current file: Product.c Load default template... 1 \#include 2 \#include 3 4 \#include "Product.h" 5 /* Type your code here */ Load default template
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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