static void Main(string[] args) { // Create a new general auction Console.WriteLine("Starting a general auction"); Console.WriteLine("-----------------"); Auction generalAuction = new Auction("UP"); generalAuction.PlaceBid(new Bid("Matt", 1)); generalAuction.PlaceBid(new Bid("John", 23)); generalAuction.PlaceBid(new Bid("Rick Astley", 13)); //Bid sneakyBid = new Bid("Matt", -5000); //generalAuction.AllBids.Add(sneakyBid); //.... // This might go on until the auction runs out of time or hits a max # of bids // Add a reserve auction where bids don't count if they're below a threshhold ReserveAuction reserveAuction = new ReserveAuction(150, "Johns Car"); reserveAuction.PlaceBid(new Bid("Matt", 50)); reserveAuction.PlaceBid(new Bid("Katie", 5000)); //Add a buyout auction where a high bid can win the auction outright BuyoutAuction buyAuction = new BuyoutAuction("Kryptonite"); buyAuction.PlaceBid(new Bid("Bruce Wayne", 42)); buyAuction.PlaceBid(new Bid("Clark Kent", 250)); buyAuction.PlaceBid(new Bid("Bruce Wayne", 1000000)); buyAuction.PlaceBid(new Bid("Clark Kent", 1000001)); //buyAuction.EndAuction(); Console.ReadLine(); }
static void Main(string[] args) { // Create a new general auction Console.WriteLine("Starting a general auction"); Console.WriteLine("-----------------"); Auction generalAuction = new Auction(); generalAuction.PlaceBid(new Bid("Josh", 1)); generalAuction.PlaceBid(new Bid("Fonz", 23)); generalAuction.PlaceBid(new Bid("Rick Astley", 13)); //.... //.... // This might go on until the auction runs out of time or hits a max # of bids // The rules of a buyout auction automatically end when the buyout price is met BuyoutAuction buyoutAuction = new BuyoutAuction(100); buyoutAuction.PlaceBid(new Bid("Tom", 25)); buyoutAuction.PlaceBid(new Bid("Jacob", 86)); buyoutAuction.PlaceBid(new Bid("Bobby", 50)); buyoutAuction.PlaceBid(new Bid("Adam", 100)); buyoutAuction.PlaceBid(new Bid("John", 300)); // Reserve auction - reserve must be met before a bid can be considered a winning bid Console.ReadLine(); }
static void Main(string[] args) { //ScientificCalculator calculator = new ScientificCalculator(); //double result = calculator.Result; //calculator.EnterNumber(2.0); //calculator.Multiply(2.0); //calculator.Divide(2.0); //result = calculator.Result; //string binary = calculator.ToBinary(); //Create a new general auction Console.WriteLine("Starting a general auction"); Console.WriteLine("-----------------"); Auction generalAuction = new Auction(); generalAuction.PlaceBid(new Bid("Josh", 1)); generalAuction.PlaceBid(new Bid("Fonz", 23)); generalAuction.PlaceBid(new Bid("Rick Astley", 13)); //.... //.... // This might go on until the auction runs out of time or hits a max # of bids //// The rules of a buyout auction automatically end //// when the buyout price is met Console.WriteLine(); Console.WriteLine("--------------"); Console.WriteLine("Buyout Auction"); Console.WriteLine(); Console.WriteLine(); BuyoutAuction buyoutAuction = new BuyoutAuction(55); buyoutAuction.PlaceBid(new Bid("Rick Astley", 20)); buyoutAuction.PlaceBid(new Bid("Michael Scott", 30)); buyoutAuction.PlaceBid(new Bid("Dwight Schrute", 20)); buyoutAuction.PlaceBid(new Bid("Ryan Howard", 56)); Console.WriteLine(); Console.WriteLine("--------------"); Console.WriteLine("Reserve Auction"); Console.WriteLine(); Console.WriteLine(); ReserveAuction reserveAuction = new ReserveAuction(80); reserveAuction.PlaceBid(new Bid("Ted Mosby", 35)); reserveAuction.PlaceBid(new Bid("Marshall Erickson", 55)); reserveAuction.PlaceBid(new Bid("Barney Stinson", 80)); reserveAuction.PlaceBid(new Bid("Lily Erickson", 60)); reserveAuction.PlaceBid(new Bid("Robin Sherbatsky", 85)); //.... //.... // This might go on until the auction runs out of time or hits a max # of bids }
public void bids_made_after_buyout_price_met_are_ignored() { BuyoutAuction theAuction = new BuyoutAuction(100); theAuction.PlaceBid(new Bid("Buyout Bob", 100)); theAuction.PlaceBid(new Bid("Too Late Tom", 101)); Assert.AreEqual(1, theAuction.AllBids.Length); Assert.AreEqual("Buyout Bob", theAuction.CurrentHighBid.Bidder); Assert.AreEqual(100, theAuction.CurrentHighBid.BidAmount); }
static void Main(string[] args) { // Create a new general auction Console.WriteLine("Starting a general auction"); Console.WriteLine("-----------------"); Auction generalAuction = new Auction(); Console.WriteLine("Has the auction ended? " + generalAuction.HasEnded); //generalAuction.HasEnded = true; not allowed because private set generalAuction.PlaceBid(new Bid("Josh", 1)); generalAuction.PlaceBid(new Bid("Fonz", 23)); generalAuction.PlaceBid(new Bid("Rick Astley", 13)); Bid katieBid = new Bid("Katie", 25); generalAuction.PlaceBid(katieBid); //.... //.... // This might go on until the auction runs out of time or hits a max # of bids Console.WriteLine("****RESERVE AUCTION****"); ReserveAuction reserve = new ReserveAuction(50); reserve.PlaceBid(new Bid("katie", 25)); Console.WriteLine("Has the auction ended? " + reserve.HasEnded); reserve.PlaceBid(new Bid("eric", 75)); Console.WriteLine("****Buyout AUCTION****"); BuyoutAuction buyout = new BuyoutAuction(50); buyout.PlaceBid(new Bid("katie", 25)); Console.WriteLine("Has the auction ended? " + buyout.HasEnded); buyout.PlaceBid(new Bid("eric", 75)); buyout.PlaceBid(new Bid("amy", 100)); Auction myAuction = new ReserveAuction(100); List <Auction> allTheAuctions = new List <Auction>(); allTheAuctions.Add(new ReserveAuction(50)); allTheAuctions.Add(new ReserveAuction(550)); allTheAuctions.Add(new Auction()); allTheAuctions.Add(new BuyoutAuction(1000)); foreach (Auction a in allTheAuctions) { Bid makeMyBid = new Bid("katie", 45); a.PlaceBid(makeMyBid); } Console.ReadLine(); }
static void Main(string[] args) { Console.Write("Type in the name of the product you are bidding on: "); string itemName = Console.ReadLine(); BuyoutAuction auction = new BuyoutAuction(itemName, 100); while (true) { Console.Write("Type 'q' to quit: "); string input = Console.ReadLine(); if (input.ToLower() == "q") { Console.WriteLine("Bid History"); Console.WriteLine(auction); break; } Console.Write("What is your name?: "); string name = Console.ReadLine(); Console.Write("What is your bid?: "); int amount = int.Parse(Console.ReadLine()); Bid offer = new Bid(name, amount); auction.PlaceBid(offer); Console.WriteLine(); } }
public void bids_greater_than_buyout_price_are_reduced_to_buyout_price() { BuyoutAuction theAuction = new BuyoutAuction(100); theAuction.PlaceBid(new Bid("Big Spender", 200)); Assert.AreEqual("Big Spender", theAuction.CurrentHighBid.Bidder); Assert.AreEqual(100, theAuction.CurrentHighBid.BidAmount); }
static void Main(string[] args) { Console.WriteLine("Welcome to our general Auction"); Console.WriteLine("------------------------------"); Auction generalAuction = new Auction(); Bid bid1 = new Bid("Henry Edwards", 10M); Bid bid2 = new Bid("Mimi Malone", 15M); generalAuction.PlaceBid(bid1); generalAuction.PlaceBid(bid2); generalAuction.PlaceBid(new Bid("Mimi Malone", 25M)); generalAuction.PlaceBid(new Bid("Henry Edwards", 5M)); generalAuction.EndAuction(); // list all bids for (int i = 0; i < generalAuction.AllBids.Length; i++) { Console.WriteLine($"Bid number {i + 1} is from {generalAuction.AllBids[i].NameOfBidder} for {generalAuction.AllBids[i].BidAmount}"); } Console.WriteLine("Welcome to our Reserve Auction"); Console.WriteLine("------------------------------"); ReserveAuction reserveAuction = new ReserveAuction(100M); reserveAuction.PlaceBid(bid1); reserveAuction.PlaceBid(new Bid("Henry Edwards", 110M)); Console.WriteLine("Welcome to our Buy Out Auction"); Console.WriteLine("------------------------------"); BuyoutAuction buyoutAuction = new BuyoutAuction(200M); buyoutAuction.PlaceBid(new Bid("Henry Edwards", 110M)); buyoutAuction.PlaceBid(new Bid("Mimi Malone", 150M)); buyoutAuction.PlaceBid(new Bid("Henry Edwards", 175M)); buyoutAuction.PlaceBid(new Bid("Mimi Malone", 250M)); buyoutAuction.PlaceBid(new Bid("Henry Edwards", 350M)); }
public void PlaceBid_LargerThanBuyout_EndAuction() { //Arrange BuyoutAuction auction = new BuyoutAuction("TEST", 100); Bid testBid = new Bid("FAKE BIDDER NAME", 101); //Act bool result = auction.PlaceBid(testBid); //Assert Assert.IsTrue(auction.HasEnded); Assert.IsTrue(result); }
public void PlaceHighBid_BelowBuyout_ContinueAuction() { //Arrange BuyoutAuction auction = new BuyoutAuction("TEST", 100); Bid testBid = new Bid("FAKE BID NAME", 5); //Act bool result = auction.PlaceBid(testBid); //Assert Assert.IsFalse(auction.HasEnded); Assert.IsTrue(result); }
static void Main(string[] args) { // Create a new general auction Console.WriteLine("Starting a general auction"); Console.WriteLine("-----------------"); Auction generalAuction = new Auction("Play Station 5"); generalAuction.PlaceBid(new Bid("Josh", 1)); generalAuction.PlaceBid(new Bid("Fonz", 23)); generalAuction.PlaceBid(new Bid("Rick Astley", 13)); //.... //.... // This might go on until the auction runs out of time or hits a max # of bids ReserveAuction reserveAuction = new ReserveAuction(50, "Nintendo Switch"); reserveAuction.PlaceBid(new Bid("Joe", 40)); reserveAuction.PlaceBid(new Bid("Elijah", 50)); reserveAuction.PlaceBid(new Bid("Chris", 60)); // reserveAuction. BuyoutAuction buyoutAuction = new BuyoutAuction(50, "Playstation 5"); buyoutAuction.PlaceBid(new Bid("Joe", 40)); buyoutAuction.PlaceBid(new Bid("Elijah", 50)); buyoutAuction.PlaceBid(new Bid("Chris", 60)); // Console.ReadLine(); }
static void Main(string[] args) { // Create a new general auction Console.WriteLine("Starting a general auction"); Console.WriteLine("-----------------"); /* * Auction generalAuction = new Auction(); * Console.WriteLine("general auction: " + generalAuction); * * generalAuction.PlaceBid(new Bid("Josh", 1)); * generalAuction.PlaceBid(new Bid("Fonz", 23)); * generalAuction.PlaceBid(new Bid("Rick Astley", 13)); * * Console.WriteLine("Current high bid: "+generalAuction.CurrentHighBid); * //.... * //.... * // This might go on until the auction runs out of time or hits a max # of bids */ /* * ReserveAuction a = new ReserveAuction(50); * a.PlaceBid(new Bid("Zach", 2)); * a.PlaceBid(new Bid("Chaz", 3)); * a.PlaceBid(new Bid("NOel", 4)); * a.PlaceBid(new Bid("Caleb", 51)); * a.PlaceBid(new Bid("Xanth", 1000000)); * a.PlaceBid(new Bid("Allen", 1)); */ BuyoutAuction buyout = new BuyoutAuction(50); buyout.PlaceBid(new Bid("Zach", 2)); buyout.PlaceBid(new Bid("Chaz", 3)); buyout.PlaceBid(new Bid("NOel", 4)); buyout.PlaceBid(new Bid("Caleb", 51)); buyout.PlaceBid(new Bid("Xanth", 1000000)); buyout.PlaceBid(new Bid("Allen", 1)); BuyoutAuction katieBuyout = new BuyoutAuction(100, "Katies fantastic auction"); Console.WriteLine("buyout name " + buyout.Name + "katieBuyout name is " + katieBuyout.Name); }