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
If you embed a Word table into PowerPoint, what happens when you make edits to the embedded data? A. Edits made to embedded data
Nataly [62]

The answer is C. Edits made to embedded data don't change the data in the source file, nor will edits made to the source file be reflected in the embedded data.

We have to understand that this table has been embedded and not linked. When a table like this is linked to PowerPoint, information can be updated when the source file is modified. On the other hand, when you embed the table without linking it, information in the Word file does not change if you modify both the source file.

4 0
4 years ago
tiny electrical paths to connect everything together is called ? A. graphic card B. audio card C. CPU D. Motherboard
k0ka [10]

Answer:

Option C, or the CPU.

Explanation:

The audio card simply translate code into sound, the graphic card turns code into graphics, CPU runs electric through tons of little electric pathways, and the motherboard is the object of which all of the above are rested on and connects them together.

8 0
3 years ago
Andrina writes letters that are regularly sent to hundreds of her company’s customers. Because of this, she would like for the M
galben [10]

The correct answer is A.

7 0
3 years ago
Which IDE component provides keyword highlighting and text auto-completion?
Zanzabum
Answer choice: OD.code editor
Explanation:PLato
3 0
3 years ago
Read 2 more answers
How to make a slideshow out of pictures in a folder windows not fitting to screen?
weqwewe [10]

Answer:

Windows slideshow.

Explanation:

Creating or displaying a collection of images in a windows file can be very ecstatic and it is quite possible using third party applications.

One way of creating a slideshow is using the screensaver desktop option. There are other easy ways like the wallpaper option and using powerpoint presentation.

To using the screensaver option, go to windows settings and click on personalize, here, use can select a theme or a group of image files, click on a color theme and click apply.

8 0
4 years ago
Other questions:
  • Give the Linux bash pipelined command that would take the output of the "cat /etc/passwd" command (that lists the contents of th
    5·1 answer
  • Create a class Str that subclasses str. Add a method to the subclass that checks if the string does not start with a given strin
    15·1 answer
  • How do computers use input and output to get and give the information that they need to solve problems?
    10·1 answer
  • PowerPoint:
    7·2 answers
  • What is the job of a router during the process of routing on the Internet?
    10·1 answer
  • The part of the screen where you see the results of your code is called the Editor.
    15·2 answers
  • The pH scale is_____ ?
    5·1 answer
  • What does a black box represent in the system input/output model?.
    7·1 answer
  • Differentiate between soft copy output and hard copy output?​
    12·2 answers
  • Alice is watching a speech over the internet. what type of message is alice attending to?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!