answer.
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
egoroff_w [7]
1 year ago
9

Write a class named ParkingMeter containing: Two instance variables named timeLeft and maxTime of type int. The value of timeLef

t should be initialized to 0. A constructor accepting a single integer parameter whose value is used to initialize the maxTime instance variable. A method named add that accepts an integer parameter. If the value of the parameter is equal to 25, the value of timeLeft is increased by 30; otherwise no increase is performed. Furthermore, the increase occurs only if the value of timeLeft will not exceed the value of maxTime. add returns a boolean value: true if timeLeft was increase, false otherwise. A method named tick that accepts no parameters and returns no value. tick decreases the value of timeLeft by 1, but only if the value of timeLeft is greater than 0. A method named isExpired that accepts no parameters. isExpired returns a boolean value: true if the value of timeLeft is equal to 0; false otherwise.
Social Studies
1 answer:
Zigmanuir [339]1 year ago
3 0

The answer for the given question is explained below.

<u>Explanation</u>:

public class Parking Meter  

{  

int time Left = 0;

int max Time;  

public Parking Meter( int max ){  

max Time = max;  

}  

public boolean add ( int coin )  

{  

  if ( coin == 25 )  

  {

   if ( time Left + 30 < max Time )

   {

    time Left += 30;

    return true;

   }

  }  

  return false;  

}  

public void tick()  

{

if ( time Left > 0 )

{

 time Left -= 1;

}  

}  

public boolean  is Expired()  

{

return time Left == 0;  

}

}

You might be interested in
Ronaldo’s Foods considered building a store in a new location. The owners and their accountants decided that this was not the pr
kompoz [17]

Answer: B

Explanation:

well from the information given making the store is not "profitable" so the only logical answer wold be B because they would make more money as the intrest of the building increases turning a profit even if they decided to sell the store in a year. also if the cost of making the building is lowered they are spending less to make more.

8 0
2 years ago
Many people hang up on telemarketers, but others will listen politely to their pitches even if they are not interested in the pr
lorasvet [3.4K]
<span>This is thanks to the foot-in-the-door phenomenon. This phenomenon works by first getting someone to agree or comply with something that is a small and not too tedious task (here, this would be the agreement to stay on the phone and listen to the pitch). Next, once the small task is completed, the person is more likely to agree to a much larger task (here, whatever the telemarketer is selling).</span>
5 0
2 years ago
In what type of situation would your state be most likely to need federal protection
ddd [48]
The Constitution gives no such authority to the federal government under the Constitution. <span>Domestic violence is never acceptable, regardless of the victim or perpetrator's gender. That said, protection against domestic violence is a states' issue. Refer to the Tenth Amendment.</span>
3 0
2 years ago
The table shows the population of Center City in various years. Use the data from 1990 and 2005 to create a linear model thi
balandron [24]

Taking years as input variable and population of that city as output variable, let y represent the population after 1985 and y represent the population in and index of 1000. Linear regression is a modeling relationship that exists between the variable.

The equation, therefore, can be derived in Y=a+bX. In this case, Y is the independent variable that is drawn on the axis of the graph while X represents the variable plotted on the x-axis of the graph; finally, b is line slope.

8 0
2 years ago
Read 2 more answers
The single most important factor in intentional and unintentional injuries is
s344n2d4d5 [400]
<span>The single most important factor in intentional and unintentional injuries would be the actual injury. Weather the injury was due to an intentional action, or weather someone just made a faulty move, the result is the injury, which leaves the player hurt and unable to play or possibly worse and seeking medical attention.</span>
4 0
2 years ago
Other questions:
  • An individual is unique and does not speak for or represent anything other than themselves. This statement is an argument agains
    6·2 answers
  • A(n) ________ is conducted in order to determine whether there are meaningful differences between two groups in a study.
    14·1 answer
  • Stacey is trying to remember the big five personality traits discussed in her introductory psychology class (conscientiousness,
    13·2 answers
  • What is the key difference between instrumental theorists and structural theorists?
    12·1 answer
  • Complete this simile: The Fed is to the nation’s banks as a _______ is to a _______. Give two reasons why your simile makes sens
    12·1 answer
  • Juanita suffers from a painful back condition. Smoking marijuana would reduce her pain, but she thinks it would be wrong because
    8·1 answer
  • Thomas was in a serious bike accident in which the front of his head slammed into a tree. Since the accident he is irritable and
    12·1 answer
  • An important limitation of all correlational studies is that they:________.
    13·1 answer
  • Which statement best explains how the constitution adressed a weakness
    7·2 answers
  • A compilation of information about you using a digital format that can be shared with potential employers is called a _____.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!