I missed a few days of class and missed a lesson on structures and parameters of functions, i am having difficulties completing and assignment based off of them.
Ive read my textbook aswell as other resources provided to me but cant seem to figure out what to do. any help would be greatly appreciated.
Here is the assignment
The LineItem struct is defined as follows:struct LineItem;
int fruitType;
double unitPrice;
int quantity
An instance of struct LineItem represents part of an order for fruit. The fruitType field stores a numeric code: 1 for apples, 2 for oranges, 3 for bananas. The unitPrice field stores the cost for one fruit. The quantity field stores the number of fruit being ordered.
Your task is to implement the orderPrice function. It should return the total cost of the LineItem passed as the parameter, which is usually the unit price times the quantity. However, there is a special going on if a customer orders 20 or more bananas, in which case there is a 15% discount, meaning the total cost of the LineItem should be reduced by 15%.
Here is the code already provided to me
Code:
// Don't change the definition of this data type:
struct LineItem {
int fruitType;
double unitPrice;
int quantity;
};
// Implement this function
double orderPrice(struct LineItem item) {
// TODO: add your code here
}
I can do most of the computation for the actual assignment i just need help implementing the function, or if somebody could explain what the next step i could take would be.
Thanks