Step 1: Stock class (10pt)
This class is for the new vehicle inventory that your dealership
directly purchases from BP motor. Create
a class called Stock and save it in Stock.java.
The class has the following (private) instance variables:
• An integer variable for stock ID;
• A double variable for purchase price;
The class has the following (public) instance methods:
• Constructor method (Version 1), with no argument:
o Simply set stock ID to 0, and set purchase price to 0;
• Constructor method (Version 2), with two arguments: one for stock
ID, one for purchase price
o Set the stock ID and the purchase price equal to the parameter
values;
• A method to set the stock ID;
• A method to set the purchase price;
• A method to retrieve the stock ID;
• A method to retrieve the purchase price;
• A method to print stock information:
o Print stock ID and purchase price in one line, in a properly
aligned format (see the
screenshot in Step 2; use printf).
Step 1: Stock class (10pt) This class is for the new vehicle inventory that your dealership directly purchases from BP
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Step 1: Stock class (10pt) This class is for the new vehicle inventory that your dealership directly purchases from BP
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!