Respuesta :
Answer:
Following are the program in the Java Programming Language.
//define class
public class Billing
{
//define method
public static double computeBill(double Price)
{
//declare variable and initialize the rate method
double taxes = 0.08*Price;
//print the output
return Price+taxes;
}
//override the following function
public static double computeBill(double Price, int quant) {
//declare double type variable
double taxes = 0.08*(Price*quant);
//return the output
return (quant*Price)+taxes;
}
//override the function
public static double computeBill(double Price, int quant,double value) {
//declare double type variable
double taxes = 0.08*(Price*quant);
//return the output
return ((quant*Price)+taxes)-value;
}
//define main method
public static void main(String args[]) {
//call the following function with argument
System.out.println(computeBill(10));
System.out.println(computeBill(10, 2));
System.out.println(computeBill(10, 20, 50));
}
}
Output:
10.8
21.6
166.0
Explanation:
Following are the description of the program.
- Define class 'Billing', inside the class we override the following function.
- Define function 'computeBill()', inside it we calculate tax.
- Then, override the following function 'computeBill()' and pass the double data type argument 'Price' and integer type 'quant' then, calculate tax.
- Again, override that function 'computeBill()' and pass the double type arguments 'Price', 'value' and integer type 'quant' then, calculate tax.
- Finally, define the main method and call the following functions with arguments.