Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Table 2 . 1 UML Class Diagram ( Discount ) Part 2 ( Implement an Interface ) : For this question, you will create an

Table 2.1 UML Class Diagram (Discount)
Part 2(Implement an Interface):
For this question, you will create an Item class that will give implementation to the capabilities as specified in the Discount interface you created in Part 1.
Follow the given UML class diagram (Table 2.2) and the description table (Table 2.3) and complete the Item concrete class.
Table 2.2 UML Class Diagram (Item)
Table 2.3 Class Description (Item)Question 1(Abstract Class):
//4//
Preparation:
Create a new NetBeans project called Question1.
Add a new Java Class called Switch to the Question1 project and complete the class as described in Part 1 below.
The question:
Create a class called Switch to be abstract as shown in the UML class diagram (Table 1.1). The class will contain only one abstract method called press(). The
method should receive one parameter called the status of type char and should return a boolean data type.
Submitting your answers:
Follow the instructions on EC under section 1 and submit your answers to this question.
Question 2(Interface):
Preparation:
Create a new NetBeans project called Question2.
Add a new Java Interface called Discount to the Question2 project and complete the interface as described in Part 1 below.
Add a new Java Class called Item to the Question 2 project and complete the class as described in Part 2 below.
Part 1(Create an Interface):
Create an interface called Discount as shown in the UML class diagram (Table 2.1). This interface could be used to apply a discount to an object.
The interface will have a data member called DISCOUNT_PERCENTAGE and will have a floating-point value of 0.12 assigned to it. The interface will also have
an abstract method called applyDiscount() that will allow an object to apply a discount. This method should have a return type of type double.
Make sure that you code all the relevant access modifiers for the data member and the method of this interface.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions