Anda di halaman 1dari 2

Imports System

Public Module Module1


Public Sub Main()
Dim account As Integer 'set account as a integer variable
Console.WriteLine("how many items you want? (at least 10)") ' output questions is used to
ask users that how many items they want here
account = console.readline
do until account >= 1 AND account <100
console.writeline("please type a number over 10")
account=console.readline
Loop 'end loop

Dim items(account) As Integer 'declare variable 'items' to use as a loop items when entering
the items
Dim start As Integer 'declare start variable to initialise the loop
Dim description(account) As String 'declare variable 'description' to use as a loop description
Dim reserve(account) As Integer 'declare variable 'reserve' to use a loop reserve
Dim bid(account) As Integer 'declare variable 'bid' to use a loop bid
start = 0 'initialisation before loop
For i = 1 To account 'loop
items(i) = start + 1 'running totally inside loop
Console.WriteLine("the description of this item NO." & i) 'output what the description is
from item 1 to the final item
description(i) = Console.ReadLine() 'input the description
Console.WriteLine(" the reserve price?") 'output what the reserve price is from item 1 to the
final item
reserve(i) = Console.ReadLine() 'input the description
bid(i) = 0 'initialise bid
Next 'end loop

Dim command As String 'declare variable order to make the loop continue or stop
Dim highest(account) As Integer 'declare variable highest to store the highest price and use the loop
Highest
Dim price As Integer 'declare variable to store the price users store
Dim buyernumber(account) As integer 'declare variable to store the buyer number and use the loop
Buyernumber
Dim bidnumber(account) As Integer 'declare variable to store the bid number and use the loop
bidnumber
For i = 1 To account 'loop
highest(i) = 0 'initialisation
Next 'end loop
command = "" 'initialise
Do While command <> "Stop" 'do while loop in order to do loop while user didn't want to stop bidding
Console.WriteLine("please tell me the which item will be bidded or input stop if you want stop") 'ask
which item the user want to bid
command = Console.ReadLine() 'input the item that the user wants or stop looping
If command = "stop" Then 'use if loop
Exit Do 'exit do loop
End If 'end if loop
Console.WriteLine("The item NO." & command & " the description is " &
description(command) & " and the reserver price is " & reserve(command) & " now the highest bid is " &
highest(command))'output items number, description, reserve price and highest bid
Console.WriteLine("what is the buyer number") 'output the question that ask user the buyer
number
buyernumber(account) = Console.ReadLine() 'input the buyer number
Console.WriteLine("And what the price he want to bid") 'output the price that user want to
bid
price = Console.ReadLine()'input the price given
If price > highest(command) Then 'use if loop
highest(command) = price 'use the price now to act as the new highest price now
buyernumber(command) = buyernumber(account) 'buyer number is the same
bidnumber(command) = bidnumber(command) + 1 'bid number increase by 1
End If 'end if loop
Loop 'end do loop

dim a as integer
Dim fault As Integer'declare falt as a variable
Dim sold As Integer'declare sold as a variable
Dim nobid As Integer'declare nobid as a variable
Dim fee(a) As Integer
For i = 1 To account'use for loop
Console.WriteLine("The items No." & i)'output the items number
Console.WriteLine("the highest price is " & highest(i)) 'output the highest price
fee(i) = highest(i) * 0.1 'multiply by 0.1
Console.WriteLine("the fee is " & fee(i))'output the fee
Console.WriteLine("the final bid number is " & bidnumber(i)) 'output the final bid number

console.writeline("the total fee is" & highest(i)+fee(i))

If highest(i) < reserve(i) Then 'use if loop


fault = fault + 1 'unsold items increase by 1 due to price below the reserve price
Else 'or
sold = sold + 1 'sold items increase by 1
End If 'end if loop
If bidnumber(i) = 0 Then 'use if loop
nobid = nobid + 1 'items with no bid increase by 1
End If 'end if loop
Next 'end for loop
Console.WriteLine("number of below the reserve price = " & fault)'output unsold items due to bid price
below the reserve price increase by 1
Console.WriteLine("number of pass the sold = " & sold)'output sold items number
Console.WriteLine("number having no bid = " & nobid)'output unsold items number with no bid
console.ReadLine()
End Sub
End Module

Anda mungkin juga menyukai