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
Vedmedyk [2.9K]
3 years ago
5

Create a class named Billing that includes four overloaded computeBill() methods for a photo book store. • When computeBill() re

ceives a single parameter, it represents the price of one photo book ordered. Add 8.5% tax, and return the total due.
• When computeBill() receives two parameters, they represent the price of a photo book and the quantity ordered. Multiply the two values, add 8.5% tax and return the total due.
• When computeBill() receives three parameters, they represent the price of a photo book, the quantity ordered, and a coupon value. Multiply the quantity and price, reduce the result by the coupon value, and then add 8.5% tax and return the total due.
• When computeBill () receives four parameters, they represent the price of a photo book, the quantity ordered, a coupon value, and a weekly discount. Multiply the quantity and price, reduce the result by the coupon value plus the weekly discount, and then add 8.5% tax and return the total due.

Write a main () method that tests all three overloaded methods.
Computers and Technology
1 answer:
Karo-lina-s [1.5K]3 years ago
4 0

Answer:

The Java code is given below with appropriate comments

Explanation:

<u>Billing.java </u>

//This is a BIlling class

public class Billing {

//Default constructor

public Billing()

{

}

//computeBill() method of having one parameter

public double computeBill(double price)

{

  return price+0.85*price;

}

//computeBill() method of having two parameter

public double computeBill(double price,int quantity)

{

  return price*quantity+0.85*price*quantity;

}

//computeBill() method of having three parameter

public double computeBill(double price,int quantity,double couponValue)

{

  return price*quantity+0.85*price*quantity-couponValue;

}

//computeBill() method of having four parameter

public double computeBill(double price,int quantity,double couponValue,double weeklyDiscount)

{

  return price*quantity+0.85*price*quantity-(couponValue+weeklyDiscount);

}

  public static void main(String[] args) {

     

  //Creating Billing Class Object

  Billing b=new Billing();

 

  //Displaying the cost of one book

System.out.println("Price of one Photo Book : $"+b.computeBill(45));

 

//Displaying the cost of 20 books

System.out.println("Price of 20 Photo Books : $"+b.computeBill(45,20));

 

//Displaying the cost of 20 books and having 50$ coupon

System.out.println("Price of 20 Photo Books and if we are having coupon value 50$ : $"+b.computeBill(45,20,50));

 

//Displaying the cost of 20 books, having 50$ coupon and 10$ discount

System.out.println("Price of 20 Photo Books ,if we are having coupon value 50$ and weekly discount of 10$: $"+b.computeBill(45,20,50,10));

 

  }

}

You might be interested in
During the troubleshooting of a pc that will not boot, it is suspected that the problem is with the ram modules. The ram modules
SOVA2 [1]

The RAM modules were not well placed or fitted firmly in the motherboard DIMM slots of the PC during toubleshooting.

What are RAM Modules?

RAM Modules have narrowly printed circuit boards that hold RAM chips (memory chips).

In order to function properly, RAM is expected to be placed or fitted firmly in the motherboard DIMM slots.

DIMM (Dual In-line Memory Module) is a module that contains one or several random access memory (RAM) chips on a small circuit board with pins that connect it to the computer motherboard.

Learn more on RAM Module here:

brainly.com/question/13308897?referrer=searchResults

#SPJ4

8 0
1 year ago
Refer to the exhibit. pc1 issues an arp request because it needs to send a packet to pc3. in this scenario, what will happen nex
Sauron [17]
RT1 will send an ARP answer with its own particular Fa0/0 MAC address.When a system gadget needs to speak with a gadget on another system, it communicates an ARP ask for requesting the default portal MAC address. The default portal (RT1) unicasts an ARP answer with the Fa0/0 MAC address.
5 0
4 years ago
from january 2005 through july 2015, approximately how many electronic data records in the United States were breached, exposing
Brums [2.3K]
From January 2005 through July 2017, approximately 853 million electronic data records in the US were breached.
This allowed the attackers to take control over people's personal data, such as their various credit card numbers, and other important data, as well as their addresses, etc. The cyber police, as well as the regular police have been working hard to stop this from happening, but the hackers are very strong and smart.
4 0
3 years ago
Does anyone know how to code
Bumek [7]

Answer:

yeah u just CODE

Explanation:

MARK BRAINLIEST PLEASE

THANK U!!!!!

3 0
3 years ago
Read 2 more answers
Given a variable temps that refers to a list, all of whose elements refer to values of type float , representing temperature dat
VARVARA [1.3K]

Answer:

The problem of the question code is as follows:

Explanation:

  1. There must be the items in the list: The above question code is in python language. The temps are a list type variable that is used to hold the collection of items or value. But in the above code, there is no item in the K list. So first remove this problem with the help of add the value on the list. There are two ways to add value to the list:- 1. Define the static list element by writing like "temps=[1.2,2.4,4.5]". and 2. Take input from the user and then add by "temps.append(item)".
  2. The syntax of the for loop: The syntax of the for loop is not right because it holds the "range" keyword which is written when we give the numeric value like, "for x in range(2)" or "for x in range(1,2)". So to correct for syntax the user needs to write "for k in temps:".

If the user removes the above-defined error from the code then the above code will run correctly

5 0
3 years ago
Other questions:
  • Most OEMs recommend that the engine oil be replaced and a new filter installed at which of the following mileage intervals ?
    7·1 answer
  • Which of the following is a way to prevent wastes from contaminating the environment? A) Use absorbent pads to collect floor was
    11·2 answers
  • Write a method named circleArea that accepts the radius of a circle as a parameter (as a real number) and returns the area of a
    12·1 answer
  • Why is it a good idea to understand what you are good at and what you enjoy
    11·2 answers
  • Justify the need for branching and jump codes in the instruction set using real world scenarios
    6·1 answer
  • Lindsey also needs to calcite the commissions earned each month. If the company earns $200,000 or more in a month, the commissio
    5·1 answer
  • describe the impact of technology in your life . how does it affects your human relations with other people .​
    12·1 answer
  • How do you enter the decimal 73 into the computer?
    11·1 answer
  • Could some please answer the question in the pictures? Thank you!! I will also give your brainliest if you give me the right ans
    11·1 answer
  • Organizational behavioural aspects
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!