Very easy problem- i can't seem to get

Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2007
Posts: 5
Reputation: Need_help! is an unknown quantity at this point 
Solved Threads: 0
Need_help! Need_help! is offline Offline
Newbie Poster

Very easy problem- i can't seem to get

 
0
  #1
Mar 2nd, 2007
okay so the problem is:

I need to develop a program that determines whether a department store customer has eceeded credit limit on charge account. for each customer, the following facts are available:

- accunt number
Balance at the beg. of the month
total of all items charged by this customer this month
-titak of all credits applied to this customer's account this month
-allowed credit limit

the program should input account number as an Integer, but use Double for the other variables. the program should calculate the new balance (= beggining balance + charges - credit), display the new balance and determine whether is exceeds the customer's credit limit. for customers whose credit limit is exceeded, the program should display the message, " credit limit exceeded. use a sentinal value of -1 for the acount number to terminate repetition.












Okay, here is what i have.. now it runs but i dont have a sentinal value and i dont think i did the problem correctly



Sub Main()
Dim accountNumber As Integer
Dim begBal As Double = 1000
Dim totCharges As Double
Dim newbal As Double
Dim credits As Double = 700


Console.Write("Hello. please enter account number:" & vbCrLf)
accountNumber = Console.ReadLine()
Console.Write(" Beginig balance is: 1000" & vbCrLf)
Console.WriteLine(" Please enter credit amount:" & vbCrLf)
credits = Console.ReadLine()


If credits <= 700 Then ' is charges are smaller than the allowed credit amount then subtract
credits -= 700
Console.WriteLine(" Amount after charge is " & credits)
ElseIf credits > 700 Then ' else if charges exceed the allowed credit amount than do not operate, write "exceed'"
Console.WriteLine(" Credit limit exceeded")
End If

newbal = begBal + totCharges - credits
Console.Write(" new balance is " & newbal & vbCrLf)



CAN ANYONE HELP PLEASE!!??
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,273
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 378
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: Very easy problem- i can't seem to get

 
0
  #2
Mar 2nd, 2007
where does the -1 come in? Don't you need a for loop ?
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 5
Reputation: Need_help! is an unknown quantity at this point 
Solved Threads: 0
Need_help! Need_help! is offline Offline
Newbie Poster

Re: Very easy problem- i can't seem to get

 
0
  #3
Mar 2nd, 2007
Originally Posted by iamthwee View Post
where does the -1 come in? Don't you need a for loop ?
yeah i do need a loop, so it should really be a dountil? but how can i have a dountil if i need an if then type statement right?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,273
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 378
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: Very easy problem- i can't seem to get

 
0
  #4
Mar 2nd, 2007
You use the -1 as a condition to bail out of the loop i.e


While (input <> -1 ) Then
'promt user for input
total = total + input
End While

Display total

The best thing for you would be to draw a flow chart. It will help you visualise what is going on and help you code a solution.
Last edited by iamthwee; Mar 2nd, 2007 at 2:43 pm.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 5
Reputation: Need_help! is an unknown quantity at this point 
Solved Threads: 0
Need_help! Need_help! is offline Offline
Newbie Poster

Re: Very easy problem- i can't seem to get

 
0
  #5
Mar 3rd, 2007
Thats the problem i am not sure really what the program is suppose to be doing, does the user input their account and the credit amount?? im really lost in this easy problem
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 1375 | Replies: 4
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC