Develop a simple program for an individual savings account. Create two (2) classes named AmountDue (no class modifier) and RunAmountDue (public). 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. For the RunAmountDue class, import the Scanner class to be able to use the nextDouble() method. 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.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%
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: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 3 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY