Part 2
BeerBatch Class
/**
* A class to model an item (or set of items) in an
* auction: a batch.
*/
public class BeerBatch
{
// A unique identifying number.
private final int number;
// A description of the batch.
private String description;
// The current highest offer for this
batch.
private Offer highestOffer;
/**
* Construct a BeerBatch, setting its
number and description.
* @param number The batch number.
* @param description A description of this
batch.
*/
public BeerBatch(int number, String
description)
{
this.number =
number;
this.description =
description;
this.highestOffer =
null;
}
/**
* Attempt an offer for this batch. A
successful offer
* must have a value higher than any
existing offer.
* @param offer A new offer.
* @return true if successful, false
otherwise
*/
public boolean bidFor(Offer offer)
{
if(highestOffer == null)
{
// There is no previous bid.
highestOffer = offer;
return true;
}
else
if(offer.getAmount() > highestOffer.getAmount()) {
// The bid is better than the previous one.
highestOffer = offer;
return true;
}
else {
// The bid is not better.
return false;
}
}
/**
* @return A string representation of this
batch's details.
*/
public String batchDetail()
{
return "TO DO";
}
/**
* @return The batch's number.
*/
public int getNumber()
{
return number;
}
/**
* @return The batch's description.
*/
public String getDescription()
{
return
description;
}
/**
* @return The highest offer for this
lot.
* This could be
null if there is
* no current
bid.
*/
public Offer getHighestOffer()
{
return
highestOffer;
}
}
Offer Class
/**
* A class that models an offer.
* It contains a reference to the Person bidding and the amount of
the offer.
*/
public class Offer
{
// The person making the bid.
private final Bidder bidder;
// The amount of the offer.
private final int amount;
/**
* Create an offer.
* @param bidder Who is bidding for the
batch.
* @param x The amount of the offer.
*/
public Offer(int x, Bidder b)
{
this.bidder = b;
this.amount = x;
}
/**
* @return The bidder.
*/
public Bidder getBidder()
{
return bidder;
}
/**
* @return The amount of the offer.
*/
public int getAmount()
{
return amount;
}
}
In: Computer Science
Create the following class to represent the sprite objects in the game.
|
Sprite |
|
|
+ Sprite (String); + Sprite (String, int, int); + setName (String): void + setX(int): void + setY(int): void + getName (): String + getX (): int + getY (): int + collide (Sprite): boolean + toString (): String |
Create ten (10) game objects as Sprite type and stored in an array. All the games objects location (x & y) must be set in range 1 to 800 randomly.
The collide method is a method to test the collision between the current sprite with another sprite (from parameter). This method will check the distance in between two sprites based on the current x and y location using Pythagoras theorem. If the distance of 2 objects is less than 10, then the method will return true. Otherwise false will be returned.
Create a driver class called TestSprite which will:
In: Computer Science
Bubba's Custom Shrimp Catering uses activity-based costing to determine the cost of its catering events. The firm has two activity cost pools: cooking (activity rate is $500 per catering event) and serving (activity rate is $12 per plate). The firm currently has 25 catering events a year, with an average of 50 plates per event. It also incurs about $400 in direct costs for each event. The firm has four opportunities to improve its processes (listed below in the answer choices). None of these process improvements is expected to affect revenue. Each process improvement costs $2,500. Which of the following is the MOST profitable process improvement (read the answer choices carefully)? Selected Answer: c. Reduce direct costs per event by 25% Answers: a. Reduce the number of plates per event by 20%. b. Reduce serving activity rate by 25% c. Reduce direct costs per event by 25% d. Reduce cooking activity rate by 25%
In: Accounting
A circus act involves launching a human being from a cannon resting on the floor. The human has a 50 kg mass and is launched at a speed of 12 m/s, in a direction 30° up from the horizontal. The cannon has a mass of 110 kg. (a) Considering the system as cannon + human, state why the x-component of the momentum is conserved. (b) Find the recoil speed of the cannon. (c) It would be dangerous to use explosives, so the performer is actually launched from a loaded spring inside the barrel, compressed 1.7 m from its equilibrium position. Find the spring constant needed to achieve the launch + recoil. (d) You will note that the y-component of the net momentum is NOT conserved, since the performer flies up in the air. Why is the x-component conserved but the y-component not?
In: Physics
In: Operations Management
In: Chemistry
Strategic Management Edition 4. - Frank T. Rothaermel
IKEA - Chapter 10
Is there any special consideration a firm should have for its “home country”? Is it ethical to keep profits outside the home country in offshore accounts to avoid paying domestic corporate taxes?
In: Operations Management
Java
Write a valid Java method called printReverse that takes a String as a parameter and prints out the reverse of the String. Your method should not return anything. Make sure you use the appropriate return type.
In: Computer Science
How do you plan to design your own workshop? Ellaborate with examples. (500 words)
In: Psychology
Economic 315: Money, Banking and Financial Market
1. Is there any relationship between increase in corporate debt and corporate investing? Explain.
2. What is the alternative to investing that money in their corporations?
3. What is the purpose of stock buybacks?
4. Do you think stock buybacks are the good for the economy? Why or why not?
In: Economics
In: Computer Science
When discussing CFCs (chlorofluorocarbons), what are the properties of that chemical (such as water solubility, vapor pressure, etc.) that determines its migration in our environment?
In: Chemistry
The Path to Good Ethics Starts in Human Resources. Do you agree or disagree with this statement? Please explain in detail and provide examples.
In: Operations Management
|
Northern |
Central |
Southern |
|
|
Northern |
$5,000.00 |
$7,000.00 |
$10,000.00 |
|
Central |
$7,000.00 |
$5,000.00 |
$6,000.00 |
|
Southern |
$10,000.00 |
$6,000.00 |
$5,000.00 |
|
Shortage |
$6,000.00 |
$5,500.00 |
$9,000.00 |
How should California’s water be distributed to minimize the sum of shipping and shortage costs and what is the total cost?
In: Computer Science