Task Performance Amount Due Objective: At the end of the activity, the students should be able to: • Apply method overloading in a program. Procedure: 1. Develop a simple program for an individual savings account. Create two (2) classes named AmountDue (no class modifier) and RunAmountDue (public). 2. For the AmountDue class, create three (3) overloaded methods named computeAmountDue based on the following conditions: • With a single parameter: It represents the price of one (1) item ordered. Add 12% tax and return the total due. With two (2) parameters: These represent the price of an item and the quantity ordered. Multiply the two (2) values, add 12% tax, and return the total due. With three (3) parameters: These represent the price of an item, the quantity ordered, and the discount amount. Multiply the quantity and price, deduct the discount amount, add 12% tax, and return the total due. 3. For the RunAmountDue class, import the Scanner class to be able to use the nextDouble() method. 4. Instantiate an AmountDue object named due in the main method to use the three (3) overloaded methods you have created earlier. When the program runs, the user can input 1-3 values separated by spaces, then the amount due will be displayed. Sample Output: Press any of the following then enter values separated by spaces: 1 - Price only 2 - Price and quantity Price, quantity, and discount amount 3 - 300 4 50 Amount due is 1186.0

EBK JAVA PROGRAMMING
8th Edition
ISBN:9781305480537
Author:FARRELL
Publisher:FARRELL
Chapter3: Using Methods, Classes, And Objects
Section: Chapter Questions
Problem 10PE
icon
Related questions
Question
Task Performance
Amount Due
Objective:
At the end of the activity, the students should be able to:
• Apply method overloading in a program.
Procedure:
1. Develop a simple program for an individual savings account. Create two (2) classes named
AmountDue (no class modifier) and RunAmountDue (public).
2. For the AmountDue class, create three (3) overloaded methods named computeAmountDue based
on the following conditions:
With a single parameter: It represents the price of one (1) item ordered. Add 12% tax and
return the total due.
• With two (2) parameters: These represent the price of an item and the quantity ordered.
Multiply the two (2) values, add 12% tax, and return the total due.
With three (3) parameters: These represent the price of an item, the quantity ordered, and
the discount amount. Multiply the quantity and price, deduct the discount amount, add 12%
tax, and return the total due.
3. For the RunAmountDue class, import the Scanner class to be able to use the nextDouble()
method.
4. Instantiate an AmountDue object named due in the main method to use the three (3) overloaded
methods you have created earlier. When the program runs, the user can input 1-3 values separated
by spaces, then the amount due will be displayed.
Sample Output:
Press any of the following then enter values separated by spaces:
1 - Price only
2
Price and quantity
3 - Price, quantity, and discount amount
3
300 4 50
Amount due is 1186.0
Transcribed Image Text:Task Performance Amount Due Objective: At the end of the activity, the students should be able to: • Apply method overloading in a program. Procedure: 1. Develop a simple program for an individual savings account. Create two (2) classes named AmountDue (no class modifier) and RunAmountDue (public). 2. For the AmountDue class, create three (3) overloaded methods named computeAmountDue based on the following conditions: With a single parameter: It represents the price of one (1) item ordered. Add 12% tax and return the total due. • With two (2) parameters: These represent the price of an item and the quantity ordered. Multiply the two (2) values, add 12% tax, and return the total due. With three (3) parameters: These represent the price of an item, the quantity ordered, and the discount amount. Multiply the quantity and price, deduct the discount amount, add 12% tax, and return the total due. 3. For the RunAmountDue class, import the Scanner class to be able to use the nextDouble() method. 4. Instantiate an AmountDue object named due in the main method to use the three (3) overloaded methods you have created earlier. When the program runs, the user can input 1-3 values separated by spaces, then the amount due will be displayed. Sample Output: Press any of the following then enter values separated by spaces: 1 - Price only 2 Price and quantity 3 - Price, quantity, and discount amount 3 300 4 50 Amount due is 1186.0
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,