Question
Create a class product with attributes: no, name, cost, quantity and functions: price to calculate and return the price of the product as following price
Create a class product with attributes: no, name, cost, quantity and functions: price to calculate and return the price of the product as following price = cost * 1.7 if the cost less than 20$ and price = cost * 1.5 otherwise reduceQuantity( soldQty) to reduce the available quantity by the soldQty in the main: create an array of products. let the user enter some products. then let the user enter a name of product to buy search if the product exists then show its price and ask the user about the required quantity and check if the required quantity available calculate the total price and add 13% for tax show the total price and reduce the quantity by the sold quantity. and ask the user if want to buy another product if not exit. using swift programming language
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