IchigoMD
asked on
VB.Net Console Application
I am trying to create a console application that will take an inputted dollar amount and tell you how much of each item you can by for that amount. like this example:
Enter dollar amount: $10
You can buy any one of the following items with $10.
22.7273 pounds of Bananas
10.101 pounds of Apples
8.4034 pounds of Cucumbers
11.236 pounds of Carrots
12.6582 pounds of Oranges
Do you want to try for another amount? ...
Here is what I have so far.
Private promptMessage As String = "Enter a dollar amount"
Private welcomeMessage As String = " Welcome to How Much Can I Buy"
Sub Main()
Dim strInput As String
Dim DollarAmt As Double = 0
Dim ProductPrice As Double
Dim ProductAmt As Double
Dim ProductName As String
Console.WriteLine(welcomeM essage)
Console.WriteLine(promptMe ssage)
ProductPrice = _{{0.44, 0.99, 1.19, 0.89, 0.79}}
'ProductName =_ {{Bananas, Apples, Cucumbers, Carrots, Oranges}}
While
ProductAmt = DollarAmt / ProductPrice
then print strInput
If
Console.WriteLine("You can buy any one of the following items with" & DollarAmt)
strInput = Console.ReadLine()
case bananas
Console.WriteLine(ProductA mt & "pounds of Bananas")
case apples
Console.WriteLine(ProductA mt & "pounds of Apples")
case cucumbers
Console.WriteLine(ProductA mt & "pounds of Cucumbers")
case carrots
Console.WriteLine(ProductA mt & "pounds of Carrots")
case oranges
Console.WriteLine(ProductA mt & "pounds of Oranges")
End Module
Enter dollar amount: $10
You can buy any one of the following items with $10.
22.7273 pounds of Bananas
10.101 pounds of Apples
8.4034 pounds of Cucumbers
11.236 pounds of Carrots
12.6582 pounds of Oranges
Do you want to try for another amount? ...
Here is what I have so far.
'Project: How Much Can I Buy Console AppPrivate promptMessage As String = "Enter a dollar amount"
Private welcomeMessage As String = " Welcome to How Much Can I Buy"
Sub Main()
Dim strInput As String
Dim DollarAmt As Double = 0
Dim ProductPrice As Double
Dim ProductAmt As Double
Dim ProductName As String
Console.WriteLine(welcomeM
Console.WriteLine(promptMe
ProductPrice = _{{0.44, 0.99, 1.19, 0.89, 0.79}}
'ProductName =_ {{Bananas, Apples, Cucumbers, Carrots, Oranges}}
While
ProductAmt = DollarAmt / ProductPrice
then print strInput
If
Console.WriteLine("You can buy any one of the following items with" & DollarAmt)
strInput = Console.ReadLine()
case bananas
Console.WriteLine(ProductA
case apples
Console.WriteLine(ProductA
case cucumbers
Console.WriteLine(ProductA
case carrots
Console.WriteLine(ProductA
case oranges
Console.WriteLine(ProductA
End Module
Your code seems overly complicated. Why the rectangular arrays? Why the "case"? Is this a student assignment?
ASKER
Yes I have trouble starting but once i know how to get it started i think I know the correct direction to go.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.