Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need Answer in C# Introduction: In this weeks assignment youll write software for an auction company. Your program will allow the auction company to enter

Need Answer in C#

Introduction:

In this weeks assignment youll write software for an auction company. Your program will allow the auction company to enter Lots of items for sale. A Lot is either one item, or a bunch of items which are being sold together. Each item has a starting price, and a bid increment. For example an item may start off as $100, with a bid increment of $25, which means the next lowest amount someone can bid is $125, then $150 etc. People can of course bid more than the bid increment.

An auction can have as many items as they want, but only one item will be available to bid at any given time.

Tasks:

Begin by creating a class called Lot

It must have private attributes for lotNumber (int), description (string), currentBid (int),

bidIncrement (int), sold (boolean).

Each

Write

Description should be set to Unknown Item

currentBid and bidIncrement should both be set to 0.

sold should be set to false.

Create

Create

Create

Create

Again, the lotNumber should be automatically calculated, just like in the default constructor. The description, currentBid and bidIncrement should be set to the parameters passed in

sold should be set to false. a method markSold, which sets Sold to true a getter method for sold, bidIncrement, and description a setter method for currentBid a method nextBid which returns the next possible lowest bid. This is the

lot will be sequentially numbered starting at 1001.

a default constructor which sets: lotNumber to the next sequential number. Ie, the first object of type Lot should

have a lotNumber of 1001, the next object should be 1002, then 1003 etc. The person creating the object will not need to pass this value in, itll be calculated in the class itself.

Write bidIncrement.

an overloaded constructor that takes in a description, startingBid and

currentBid + the bidIncrement. Create an override of toString (Java) or ToString (C#)

If the lot is sold (check the boolean), return a string like: Lot 1001. Description was sold for $500

If the lot is not sold, return a string like:

Lot 1001. Description current bid $100 minimum bid $120 In both cases Lot 1001 should be the actual lot number, the description should

replace the word Description and the current bid/sold amount should be the current bid, and the minimum bid should be the nextBid.

Next youll write a number of methods in your driver class:

Write a method getNextLot.

This will take in an ArrayList (Java) or List (C#) of Lots. It should return a Lot If the auction ArrayList/List has items in it, return the first item (from cell 0) and

remove it from the ArrayList/List. Otherwise return an empty Lot created using the default constructor.

Write a method addItem This will take in an ArrayList (Java) or List (C#) of lots It will return void It will prompt the user for a new Description, starting bid, and bid increment, then

create a lot and add it to the ArrayList/List that was passed in.

Write a method bid

Create

Create

This will take in a Lot Ask the user how much they want to bid, and tell them the minimum bid they must make. Read in the users bid If its too small (below the minimum bid) tell them. Otherwise change the current bid for this Lot item to the amount they bid. a method markSold This will take in a Lot Mark the lot as sold Print out the current Lot a method mainMenu This will take in an ArrayList (Java) or List (C#) of Lots Define a currentLot of type Lot and set it to null. Using a loop youll print out the menu until the user chooses option 5.

If you currently have a Lot to bid on, print Current Lot: Followed by the description of the lot.

If you dont have a lot yet (currentLot is null or its description is Unknown Item), print We are not currently bidding

Next print the menu:

1. Add Lot to Auction

2. Start bidding on next Lot

3. Bid on current Lot

4. Mark current Lot sold

5. Quit

Read in the users choice

If the user chooses 1 use the appropriate method to add an item

to the auction.

If the user chooses 2, first check that there are Lots in the auction. If there are currently none print There is nothing to bid on, add an item first

If you have a current lot, and its not sold print You must mark the current lot as sold before bringing up the next Lot

Otherwise get the next lot and store it in currentLot

If the user chooses 3 and the current lot is null, or the current lots

description is Unknown Item or the current lot is sold print: You must first bring a Lot up for bidding

Otherwise, allow the user to bid If the user chooses 4 and the current lot is null or the current lots

descriptions is Unknown Item, or the current lot is sold print: You must first bring a Lot up for Bidding

Otherwise, mark the current lot as sold Your main method should simple create an ArrayList (Java) or List (C#) of Lot called

auction. Call mainMenu passing it the auction collection.

Example Runs: [User input in red] We are not currently bidding

1. Add Lot to Auction 2. Start bidding on next Lot 3. Bid on current Lot 4. Mark current Lot Sold 5. Exit 1 What is the description of this item 65" Samsung OLED TV What is the starting bid 350 What is the bid increment 25 We are not currently bidding

1. Add Lot to Auction 2. Start bidding on next Lot 3. Bid on current Lot 4. Mark current Lot Sold 5. Exit 1 What is the description of this item Desk Lamp

What is the starting bid

5

What is the bid increment

5

We are not currently bidding

1. Add Lot to Auction 2. Start bidding on next Lot 3. Bid on current Lot 4. Mark current Lot Sold 5. Exit 1 What is the description of this item Gamer Chair, red with armrests. What is the starting bid 100 What is the bid increment 10 We are not currently bidding

1. Add Lot to Auction 2. Start bidding on next Lot 3. Bid on current Lot 4. Mark current Lot Sold 5. Exit 3 You must first bring a Lot up for bidding We are not currently bidding

1. Add Lot to Auction 2. Start bidding on next Lot 3. Bid on current Lot 4. Mark current Lot Sold 5. Exit 4 You must first bring a Lot up for bidding We are not currently bidding

1. Add Lot to Auction 2. Start bidding on next Lot 3. Bid on current Lot 4. Mark current Lot Sold 5. Exit 2 Current Lot:

Lot 1001. 65" Samsung OLED TV current bid: $350 minimum bid: $375

1. Add Lot to Auction 2. Start bidding on next Lot 3. Bid on current Lot 4. Mark current Lot Sold 5. Exit 3 How much would you like to bid? Minimum bid is 375 375 Current Lot: Lot 1001. 65" Samsung OLED TV current bid: $375 minimum bid: $400

1. Add Lot to Auction 2. Start bidding on next Lot 3. Bid on current Lot 4. Mark current Lot Sold 5. Exit 3 How much would you like to bid? Minimum bid is 400 500 Current Lot: Lot 1001. 65" Samsung OLED TV current bid: $500 minimum bid: $525

1. Add Lot to Auction 2. Start bidding on next Lot 3. Bid on current Lot 4. Mark current Lot Sold 5. Exit 4 Lot 1001. 65" Samsung OLED TV was sold for $500 Current Lot: Lot 1001. 65" Samsung OLED TV was sold for $500

1. Add Lot to Auction 2. Start bidding on next Lot 3. Bid on current Lot 4. Mark current Lot Sold 5. Exit 3 You must first bring a Lot up for bidding Current Lot: Lot 1001. 65" Samsung OLED TV was sold for $500

1. Add Lot to Auction 2. Start bidding on next Lot 3. Bid on current Lot 4. Mark current Lot Sold 5. Exit 2 Current Lot: Lot 1002. Desk Lamp current bid: $5 minimum bid: $10

1. Add Lot to Auction 2. Start bidding on next Lot 3. Bid on current Lot 4. Mark current Lot Sold 5. Exit 3 How much would you like to bid? Minimum bid is 10 10 Current Lot: Lot 1002. Desk Lamp current bid: $10 minimum bid: $15

1. Add Lot to Auction 2. Start bidding on next Lot 3. Bid on current Lot 4. Mark current Lot Sold 5. Exit 2 You must mark the current Lot as sold before bringing up the next Lot Current Lot: Lot 1002. Desk Lamp current bid: $10 minimum bid: $15

1. Add Lot to Auction 2. Start bidding on next Lot 3. Bid on current Lot 4. Mark current Lot Sold 5. Exit 4 Lot 1002. Desk Lamp was sold for $10 Current Lot: Lot 1002. Desk Lamp was sold for $10

1. Add Lot to Auction 2. Start bidding on next Lot 3. Bid on current Lot

4. Mark current Lot Sold 5. Exit 2 Current Lot:

Lot 1003. Gamer Chair, red with armrests. current bid: $100 minimum bid: $110

1. Add Lot to Auction 2. Start bidding on next Lot 3. Bid on current Lot 4. Mark current Lot Sold 5. Exit 3 How much would you like to bid? Minimum bid is 110 150 Current Lot: Lot 1003. Gamer Chair, red with armrests. current bid: $150 minimum bid: $160

1. Add Lot to Auction 2. Start bidding on next Lot 3. Bid on current Lot 4. Mark current Lot Sold 5. Exit 3 How much would you like to bid? Minimum bid is 160 200 Current Lot: Lot 1003. Gamer Chair, red with armrests. current bid: $200 minimum bid: $210

1. Add Lot to Auction 2. Start bidding on next Lot 3. Bid on current Lot 4. Mark current Lot Sold 5. Exit 3 How much would you like to bid? Minimum bid is 210 350 Current Lot: Lot 1003. Gamer Chair, red with armrests current bid: $350 minimum bid: $360

1. Add Lot to Auction 2. Start bidding on next Lot 3. Bid on current Lot

4. Mark current Lot Sold 5. Exit 3 How much would you like to bid? Minimum bid is 360

300 You must bid at least 360 Current Lot: Lot 1003. Gamer Chair, red with armrests. current bid: $350 minimum bid: $360

1. Add Lot to Auction 2. Start bidding on next Lot 3. Bid on current Lot 4. Mark current Lot Sold 5. Exit 4 Lot 1003. Gamer Chair, red with armrests. was sold for $350 Current Lot: Lot 1003. Gamer Chair, red with armrests. was sold for $350

1. Add Lot to Auction 2. Start bidding on next Lot 3. Bid on current Lot 4. Mark current Lot Sold 5. Exit 5

Submitting your answer:

Youll submit Lot.java or Lot.cs as well as your driver class

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 10g Insider Solutions

Authors: Arun R. Kumar, John Kanagaraj, Richard Stroupe

1st Edition

0672327910, 978-0672327919

More Books

Students also viewed these Databases questions

Question

b. What groups were most represented? Why do you think this is so?

Answered: 1 week ago