Question
Part 1: Create a UML class diagram for the Account inheritance hierarchy. Your subclasses should be Supplies and Services. All sales accounts will have an
Part 1:
Create a UML class diagram for the Account inheritance hierarchy. Your subclasses should be Supplies and Services. All sales accounts will have an account ID (accountId). You will need attributes to keep track of the number of hours (numberOfHours) and rate per hour of services provided (ratePerHour). You should also keep track of the number of items sold (numberOfItems) and the price per item for the sold supplies (pricePerItem). All classes should have a constructor. Add getters and setters to all of your classes. Override the method toString in all 3 classes. Add a method to calculate the sales in each class [calculateSales()].
Part 2:
In NetBeans, implement your account class diagram created earlier. Complete the following:
Your Java project should include 3 classes: Account.java, Services.java, and Supplies.java. There should be implemented constructors for each class. The toString() method should be overridden to provide a readable string representation of each object. Getters and setters need to be implemented to enforce data hiding. The calculateSales() method should be implemented for all classes Consider having the calculateSales() as an abstract method for the Abstract Account class. In addition, you need to create a test class companySales.java that tests each subclass's constructor, toString(), and computeSales(). You need to create an instance of each subclass. Input can be hard-coded or entered by the user. You need to call the method calculateSales() for each instance. You need to print each class info using its method toString(). Code should be fully commented. Program flow should be logical.
A UML diagram must be created first and the Java Code is to be made from the diagram created.
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