Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Product and Store: Class 1 : Product Attributes; productName, price, stockCount Methods: buyProduct ( int count ) , getProductDetails ( ) Class 2 : Store
Product and Store:
Class : Product
Attributes; productName, price, stockCount
Methods: buyProductint count getProductDetails
Class : Store
Attributes: inventory
Methods: addProductProduct product sellProductString productName, int count list Products
Goal: Design a simple store management system where products can be added, sold, and listed.
Instructions
Begin with the "Product' elass.
Define attributes: 'productName" "price", and "stockCount
Implement methods to buy a product and get product details.
Create the 'Store' class,
Define the attributes "inventory" use an Array
Create methods to add products, sell products, and list all products.
In the "main "method, demonstratte adding products to the store, selling products, and listing them.
Screenshots of Code and output:
Vehicle and Garage:
Class :Vehicle
Attributes: vehicleID, type, brand
Methods: getDetailsO, start stop
Class : Garage
Attributes: listofVehicles
Methods: addVehicleVehicle vehicle removeVehicleString vehicleID listallVehicles
Goul: Build'a garage system where vehicles can be added, removed, and listed.
Instructions:
Design the 'Vehicle' class.
Define attributes: "vehiciell'. "type', and 'brand
Implement methods to get vehicle details, start, and stop the vehicle.
Construct the "Garage" class.
Define the attribute: "listorNehicles" use an ArrayList
Create methods to add vehicles, remove vehicles, and list all vehicles.
In the 'main' method, demonstrate adding vehictes to the garage, removing them, and listing all vehicles.
Sereenshots of Code and output:
In java please
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