ubcx-software-construction-2 / design-patterns-solutions Goto Github PK
View Code? Open in Web Editor NEWThis repository contains solutions for Design Patterns in UBCx SoftConst2x: Object Oriented Design
This repository contains solutions for Design Patterns in UBCx SoftConst2x: Object Oriented Design
It appears as though in the solution for AuctionHouse the user, if the user is not the highest bidder in the first round, then in subsequent rounds, the user's input is not taken into account when calculating the highest bid.
It appears that the following small change to the initiation of max
in getHighestBid() would resolve this:
private static double gethighestBid() {
double max = auctioneer.getCurrentBid();
for (Bidder b : bidders) {
if (max < b.getPersonalBid()) {
max = b.getPersonalBid();
}
}
if (max == 0) {
return auctioneer.getCurrentBid();
} else {
return max;
}
}
Here is an output from the console when running the solution for reference:
Would you like to bid again? (y/n):
y
Enter your new bid: 200
The highest bid is currently: $200.0
Notifying bidders of the new highest bid...
Update received for: Anthony Estey, current bid is at: $200.0
Anthony Estey can't bid any higher!
Update received for: Ian Cavers, current bid is at: $200.0
Ian Cavers can't bid any higher!
Update received for: Elisa Baniassad, current bid is at: $200.0
Elisa Baniassad can't bid any higher!
Update received for: James Yoo, current bid is at: $200.0
James Yoo can't bid any higher!
Update received for: Amy Zhu, current bid is at: $200.0
Amy Zhu can't bid any higher!
Update received for: James Xiao, current bid is at: $200.0
James Xiao can't bid any higher!
The current highest bid is at: 66.0
Would you like to bid again? (y/n):
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.