1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Natalija [7]
3 years ago
7

Create a class named Invoicing that includes three overloaded computeInvoice() methods for a book store: see pages 196 for examp

les… The 8% tax should be defined as a constant.
1. When computeInvoice() receives a single parameter, it represents the price of one book ordered. Add 8% tax and display the total due.
2. When computeInvoice() receives two parameters, they represent the price of a book and the quantity ordered. Multiply the two values, add 8% tax, and display the total due.
3. When computeInvoice() receives three parameters, they represent the price of a book, the quantity ordered, and a coupon value. Multiply the quantity and price, reduce the result by the coupon value, and then add 8% tax and display the total due.
Create a driver class named TestInvoice with a main() method that tests all three overloaded methods using the following data: Price $24.95 Price, $17.50, quantity 4, Price $10.00, quantity 6, coupon $20.00 Output printed to Eclipse Console:
Price $26.95
Price $76.95
Price $43.20

Computers and Technology
1 answer:
Lynna [10]3 years ago
5 0

Answer:

Follows are the method to this question:

class Invoicing  //defining a class Invoicing  

{

  public static final double Tax = 8.0; //defining static variable Tax that holds a value

  public static double Total;//defining a double variable Total

  public void computeInvoice(double p1)//defining method computeInvoice that take double parameter

  {

      Total = p1 + p1 * (Tax / 100);//defining double variable Total that holds Price value

      System.out.printf("Price $%.2f\n" , Total);//print calculated value

  }

  public void computeInvoice(double p2, int q)//defining method computeInvoice that takes integer and double parameter

  {

      Total = p2 * q;//use Total variable that calculate Price with Tax

      Total = Total + (Total * (Tax/ 100));//calculate taxes on Total

      System.out.printf("Price $%.2f\n" , Total);//print calculated value

  }  

  public void computeInvoice(double p3, int q, double c)//defining method computeInvoice that takes one integer and two-double parameter  

  {

      Total = p3 * q;//use Total to calculate Total price

      Total = Total - c;//remove coupon amount from Total amount

      Total = Total + (Total * (Tax/ 100));//calculate taxes on Total

      System.out.printf("Price $%.2f\n" , Total);//print calculated value

  }

}

public class TestInvoice  //defining Main class TestInvoice  

{

  public static void main(String[] ar)//defining main method  

  {

      Invoicing  obm = new Invoicing ();//creating Invoicing class object obm

      obm.computeInvoice(24.95);//calling method computeInvoice

      obm.computeInvoice(17.5, 4);//calling method computeInvoice

      obm.computeInvoice(10, 6, 20);//calling method computeInvoice

  }

}

Output:

please find attached file.

Explanation:

In the above-given code, a class "Invoicing" is defined, inside the class two static double variable "Total and Tax" is defined, in which the Tax variable holds a value that is "8.0".

In class three same method, "computeInvoice" is used that accepts a different parameter for providing method overloading, which can be defined as follows:

  • In the first method, it accepts a single double parameter "p1", and inside the method, it uses the "Total" variable to calculate price value.
  • In the second method, it accepts one integer and one double parameter "q and p2", and inside the method, it uses the "Total" variable is used to calculate the price with tax and print its value.
  • In the third method, it accepts one integer and two double parameters "q, p3, and c", and inside the method, it uses the "Total" variable is used to calculate the price with tax and include tax and print its value.
  • In the next step, the main class "TestInvoice" is defined inside the main method, Invoicing object is created and call its method.

You might be interested in
Here is the list of problems to choose from:
olya-2409 [2.1K]

Answer:

There's a parking lot that is 600m² big. The lot must be able to hold at least 3 buses and 10 cars.

Each car takes up 6m² and each bus takes up 30m².

However, there can only be 60 vehicles in the lot at any given time.

The cost to park in the lot is $2.50 per day for cars and $7.50 per day for buses. The lot must make at least $75 each day to break even.

What is a possible car to bus ratio that would allow the lot to make profit?

3 0
2 years ago
A hidden backlog contains the projects that the IT department is not aware of because of low feasibility.
Finger [1]

Answer: True

Explanation:

Yes, the given statement is true that the due to the very low feasibility the IT (Information technology) department are not aware of the hidden backlog that basically contain projects.

The feasibility is the main factor in the IT department as it helps to study whole objective of the project and then also uncover all the strength and weakness of the project so that we can easily go through the details to make the project more efficient and reliable.

8 0
3 years ago
Características que debe tener un módulo o kit tecnológico para aprender​
12345 [234]

Answer:

Multi herramientas

Explanation:

Un kit tecnologico debe contener todas las herramientas necesarias para el trabajo que lo necesites, por ejemplo destornillador magnetico con varias puntas, herramientas para desmontar y por supuesto tener buena claridad para trabajar y alcohol isoprofilico de al menos 90+ para limpiar electronicos.

5 0
2 years ago
Michael is discussing various project needs with his team. Match Michael’s statement with the way project management can help th
Reika [66]

Answer:

get out there outside and get out and see what you do when you're ready for a workout or a day off and you're going through the

7 0
3 years ago
Some personal computer manufacturers provide a hard disk configuration that connects multiple smaller disks into a single unit t
pav-90 [236]
In software: Logical Volume. In hardware it's usually called RAID (Redundant Array of Inexpensive Devices).
6 0
3 years ago
Other questions:
  • Any file that contains data but not instructions for your computer is not considered software
    7·1 answer
  • Which of the following is a reason why the comments tool within PDF documents could be helpful? (Select all that apply.)
    5·1 answer
  • A(n) ______ is a type of collaborative website that allows users to create, add, modify, or delete website content.
    12·1 answer
  • Differentiate between Software as a service, platform as a service and infrastructure as a service.
    14·1 answer
  • Which two climates have moderate rainfall and experience warm summers and cold winters due to their position relative to mountai
    6·1 answer
  • Celeste is writing a paper. However, two pages in, her computer shuts down unexpectedly. She never saved her paper, and all her
    12·2 answers
  • A posting error is:
    8·1 answer
  • What in the world is this for and how do you use it
    8·2 answers
  • Which is the best choice to explain why a human resource manager is so
    5·1 answer
  • to allow excel to change the cell references in a formula or function from row to row or column to column as you fill with it, y
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!