Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a class Item with following fields and methods Fields Field Name Access Modifier Data Type l no private int name private I_price private Iqty
Create a class Item with following fields and methods Fields Field Name Access Modifier Data Type l no private int name private I_price private Iqty string float private string l cost private double Methods - Access Modifier - public 1. void Input) It takes the input of all field from the user except l_cost. For calculating I_Cost, Calculate) method is called 2. void Display) It displays all the fields 3. void Item) - Constructor with no parameters. Assigns all fields as blanks or zero 4. void Item(int, String,float,String): Assigns all fields with corresponding formal parameters except l_cost which is assigned by calling Calling) method 5. double Calculate) which calculates I_cost as I_price qty The main should create three instances 11,12,13 of the class ltem For instance l1 void Item) constructor is used for assigning values to fields For instance E2 void Item(int, String,float,String) constructor is used for assigning values to fields For instance 13, Input) should be called for taking input of fields Call Display) for all three instances for displaying the fields
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