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
Effectus [21]
3 years ago
3

In the Toy class below, the raisePrice method is intended to increase the value of the instance variable price by the value of t

he parameter surcharge. The method does not work as intended. AP Testo quiz11 public class Toy private String name; private double price; public Toy (String n, double p) name = n; price = p; } public void raisePrice (double surcharge) // Line 12 return price + surcharge; // Line 14
Which of the following changes should be made so that the class definition compiles without error and the method raise Price works as intended?
A. Replace line 14 with surcharge += price;.
B. Replace line 14 with price += surcharge;.
C. Replace line 14 with return price += surcharge;.
Computers and Technology
1 answer:
Kobotan [32]3 years ago
6 0

Answer:

B

Explanation:

You are increasing the value of price, therefore, you should have an assignment statement in the code of the class to change the value of price.  The method is also of type void, so you shouldn't be returning a value.  Since you will be increasing the value of price with the value of surcharge, your answer is then:

    price+= surcharge;  

which is also the same as saying:  price = price + surcharge;

You might be interested in
HELP TIMED!!!!!!!!!!!!!!!!!!!!
Norma-Jean [14]
Competition I’d say, always needing to grow and adapt to new needs
8 0
3 years ago
Read 2 more answers
SOMEONE PLZZ HELP ME ASAP!!
Sever21 [200]

C

because you have to re read it

8 0
3 years ago
Read 2 more answers
What color pixels are used in a camera?
Murljashka [212]
Red, blue, and green color pixels are used in a camera
3 0
3 years ago
Read 2 more answers
1000base-t is a standard for achieving throughputs ____ times faster than fast ethernet over copper cable.
meriva
An Average of 10 times faster.

Hope this helps!
3 0
3 years ago
The inability of BAE Automated Systems to create an automated baggage handling system led to a significant delay in the opening
Sergeu [11.5K]

Answer:

True

Explanation:

Airport was truly opened outside the city of Denver, because of the faults in BAE automated system.

6 0
4 years ago
Other questions:
  • in what way do rules and laws created to address public problems affect individuals groups and business
    13·1 answer
  • What identifies available computers through the internet?
    14·1 answer
  • A ________ is a member function that is automatically called when a class object is
    6·1 answer
  • Implement a class Product. A product has a name and a price, for example new Product("Toaster", 29.95). Supply methods getName,
    14·2 answers
  • Universal Containers is building an integration between Salesforce and their Accounting system. The integration will utilize out
    8·1 answer
  • A customer has a computer for a home business, but wants to have another computer as a web server. What would be the best soluti
    11·2 answers
  • After conducting interviews with several bad candidates, Althea, a manager at Langrover Inc. interviewed a candidate who was bet
    15·1 answer
  • Write a Python3 program to check if 3 user entered points on the coordinate plane creates a triangle or not. Your program needs
    12·1 answer
  • A connection between files that allows data to be transferred from one file to another is a _______________________.
    6·1 answer
  • The direction of a ratchet is reversed by _______________________.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!