Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 5a: Item Design a class that stores information about products that are sold in a store. Write a class named It em that has

image text in transcribed
Assignment 5a: Item Design a class that stores information about products that are sold in a store. Write a class named It em that has (at least) the following member variables: mame aString that holds the name of the inventory itea vendor a string that stores the name of the vendor for the product. salePrice a double that stores the current selling price of the item (how much the customer pays to buy it) . costPrice: a double that stores the curret cost price of the item (how much the store pays to acquire it) weight a double that stores the weight of a single item of thas type taxable aboolean field that indicates whether or not tax is charged on the item Make sue to choose appropriate access specifiers for the data members and methods in your It em class in addaticn, the class should have the following member methods Costractor The cece iem'r same, ost price. and seling price as araments and assim these values to the objects name, costPrico, and saleprice shoold initialize the weight to 1 and taxable to true member variables. The constructor Mutator. Appropriate mwutator methods should be created to allorw values to be changed in an objects weight and taxable fields. proft. This method should accept no parameters and return the profit on the item, which is calculated as the cost price subtracted from the selling price. Accessors Appropriate accesser methods should be created to allonw values to be retrieved from an objects name, vendoz, salePrice, weight, and taxable member aiables increaseCest. This method should increase the cost price by I dollar. Thas is a roid method since it modifies the current state of the object. Demonustrane the class in a program that creates an Item object. Then uncrease the cost 3 times by a dollar, calculate the profit and display it on the screen. Call the mutator method that sets

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions

Question

Question Can any type of stock or securities be used in an ESOP?

Answered: 1 week ago

Question

Question Can a self-employed person adopt a money purchase plan?

Answered: 1 week ago