Write a shoe class with the following attributes: color (e.g., "blue", "green", "orange") displayName (e.g., "nikes, adidas", "puma") price (e.g., 100, 200,60) Include only one constructor. It should have parameters for each of the attributes and set their values. Additionally, include getters and setters for each of the attributes. Add a driver, name it Purchases, and create 2 objects. Finally, print out some information about both objects (i.e., print the information from some or all of the getters). For example, if you created a shoe object whose color was blue, whose display name was shoes , for a price of 230, you could use the getters to print something like this: These work trousers are blue and cost $230
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Write a shoe class with the following attributes:
- color (e.g., "blue", "green", "orange")
- displayName (e.g., "nikes, adidas", "puma")
- price (e.g., 100, 200,60)
Include only one constructor. It should have parameters for each of the attributes and set their values.
Additionally, include getters and setters for each of the attributes.
Add a driver, name it Purchases, and create 2 objects.
Finally, print out some information about both objects (i.e., print the information from some or all of the getters). For example, if you created a shoe object whose color was blue, whose display name was shoes , for a price of 230, you could use the getters to print something like this:
These work trousers are blue and cost $230
Step 1:-
Given:-
1.Create a class Clothing and its attributes are color,displayName, and price
2.Include the one parameterized constructor
3.Include the getter and setter function
4.Create a class Purchase
5.Create the 2 objects of class Clothing
6.Display the output in the same way given in the question
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images