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
Guys helppppppppppppp!! plxxx <br> give me the right answer !
sweet-ann [11.9K]
Try "an online advertisement for a video game you recently read about in a blog post".

Hope I helped! :)
5 0
3 years ago
after installing the second hard drive what two tasks need to be done through Disk Management in order for the operating system
Serga [27]
Maybe formating and rename?
6 0
3 years ago
To prevent long page load times for pages containing images, it is best to use a compressed file format such as JPG, as well as
valkas [14]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The given options to this question are:

  1. resolution.
  2. magnification.
  3. orientation.
  4. colors.

The correct option to this question is 1. i.e.

Resolution.

The resolution of an image determines how many pixels per inch an image contains. Image having a higher resolution takes long page load times for a page and lower resolution takes less page load time. So, to prevent long page load times for pages containing images, it is best to use compressed file formation as well as appropriate image dimension and resolution.

While other options are not correct because:

Magnification, orientation, and color does not affect the page load time. Page load time for images only affected by the dimension and resolution of the images.

7 0
3 years ago
You need to back up the existing data on a computer before you install a new application. You also need to ensure that you are a
nevsk [136]

Answer:

Backup and restore console should be utilized in that scenario.

Explanation:

4 0
3 years ago
7. You were discussing software piracy with a friend and were surprised to learn how software piracy can impact your life every
Anna007 [38]
Software piracy hurts everyone. It affects the live of the one who develops it and also you pirates it.
Someone develop it spending all his efforts, time and money but you will just rob all their efforts.
3 0
3 years ago
Other questions:
  • Which command on the Insert tab of the PowerPoint Online application is used to add a Venn diagram or process chart to a present
    12·2 answers
  • Someone who is young, lacks funds, and really wants to gain technical skills while serving his or her nation should consider
    15·1 answer
  • All animations on the world wide web are flash animations
    11·2 answers
  • nswer the following questions concerning chapter 1:1.1 Which pair of layers are NOT peer layers?a.Transport layer in the sender
    9·1 answer
  • Write a class called SimpleSquare that has the following properties: - public int field called num - private int field called sq
    13·1 answer
  • Which technique helps you look confident as a speaker?
    15·1 answer
  • Implement function bin2dec that takes a binary number bin_num as a string argument and prints out the corresponding decimal numb
    9·1 answer
  • Write Album's PrintSongsShorterThan() to print all the songs from the album shorter than the value of the parameter songDuration
    14·1 answer
  • It is not necessary to develop strategies to separate good information and bad information on the internet. True or False
    7·1 answer
  • Please Answer Quickly.<br> Match the item on the left with the reason that it is false on the right.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!