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
Consider the following statements: struct supplierType { string name; int supplierID; }; struct paintType { supplierType supplie
Romashka [77]

Answer:

The answer is "supplierType"

Explanation:

Description of the code:

  • In the given program two structure is defined, that is "supplierType and paintType", in which "supplierType" structure two-variable name and "supplierID" is defined, that datatype is "String and integer".
  • In the next step, "paintType" is declared, in which "supplierType" object supplier is created, in which two string variable "color and paintID" are defined, in which "supplierType" data type is supplied.
3 0
3 years ago
Which organization has published more than 300 Web standards, and encourages manufacturers to follow these standards, many of wh
jek_recluse [69]

Answer:

c

Explanation:

6 0
3 years ago
Nikki sent flyers in the mail to all houses within the city limits promoting her computer repair service what type of promotion
Jlenok [28]

Direct marketing (APEX)


6 0
3 years ago
Read 2 more answers
output device is any peripheral to provide data and control signal to ab information processing system​
nirvana33 [79]

Answer:

Its false ita not "output" its "input"

7 0
2 years ago
The major difference between a template and another document is in.​
tensa zangetsu [6.8K]
Templates in pandadoc are used for generic content that you intend on using multiple times, while documents are used for specific information. In order to send a document, you must first creat it from an existing template.
4 0
3 years ago
Other questions:
  • A ____ network (or workgroup) consists of multiple windows computers that share information, but no computer on the network serv
    15·1 answer
  • Odbc works on the ____ operating system.
    5·1 answer
  • Complete the paragraph to explain how Angelina can notify readers that her report is just a draft.
    6·1 answer
  • What are two examples of management information systems?
    12·1 answer
  • You are a network engineer tasked with performing a site survey for a multiple-channel architecture (MCA) system in a three-stor
    11·1 answer
  • A pangram is a sentence that contains all the letters of the English alphabet at least once. For example, the quick brown fox ju
    6·1 answer
  • Which statement describes Augmented Reality (AR) technology?
    12·1 answer
  • While you are working on your computer, it shuts down unexpectedly, and you detect a burning smell. When you remove the case cov
    10·1 answer
  • How do most business applications and websites process credit card transactions?
    13·1 answer
  • Brainliest For Tascake Because People Texted Before Tascake Could<br><br> Hurry Tascake
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!