EMPRESTIMO
Este programa foi criado no VB.Net 2008 no modo console , porém ao ser executado o mesmo não consegue encontar o caminho dos módulos oque pode estar acontecendo , o código parece estar enxuto:
[ô]Payment.exe
[ô] Valor do Empréstimo : 10.000
[ô] Juros Anuais (Por Exemplo para 60% , Insira 60) : 60
[ô] Total de Meses : 60
[ô] PerÃodo de Pagamentos em Anos : 5 anos
[ô] A 5% de Juros ao mês
[ô]Valor Pago em 5 Anosl :
Module Payment
Private dblAnnualInterest As Double = 0
Private iYears As Integer = 0
Private dblLoAmount As Double = 0
Private dblMonthLyDeposit As Double = 0
Sub Main()
Dim dblResult As Double
[ô]Armazena os valores informados
GetInputValues()
[ô]Calcula
dblResult = CalculatePayment(dblLoAmount, _
dblAnnualInterest, _
iYears)
[ô]Proceda a exibição do resultado
DisplayResults(dblResult)
End Sub
Private Function CalculatePayment(ByVal LoanAmount As Double, _
ByVal AnnualInterest As Double, _
ByVal Years As Integer) As Double
[ô]Divida por 1200 para torna-lo um percentual mensal
Dim DblMonthlyInterest As Double = CDec(AnnualInterest / 1200)
Dim iMonths As Integer = Years * 12
Dim dblTemp As Double
Dim dblReturns As Double
[ô]Precisaremos desse valor em alguns locais
dblTemp = CDec (((1 + DblMonthlyInterest ^ iMonths))
dblReturns = LoanAmount * _
(DblMonthlyInterest * dblTemp / (dblTemp - 1))
Return dblReturns
End Function
Private Sub GetInputValues()
Console.WriteLine()
dblLoAmount = CDec(GetValue([Ô]Loan Amount: [Ô]))
dblAnnualInterest = _
CDbl(GetValue([Ô]Annual Interest (e.g for 5%, enter 5): [Ô]))
iYears = CInt(GetValue([Ô]Years of loan: [Ô]))
Console.WriteLine()
End Sub
Private Function GetValue(ByVal Prompt As String) As String
Console.Write(Prompt)
Return Console.ReadLine
End Function
Private Sub DisplayResults(ByVal Result As Double)
Console.WriteLine()
Console.WriteLine([Ô]If you borrow {0:c}, [Ô], dblLoAmount)
Console.WriteLine([Ô]at {0}% interest.[Ô], dblAnnualInterest)
Console.Writeline([Ô]for {0}Years[Ô], iYears)
Console.WriteLine()
console.WriteLine([Ô]Your monthly payment would be: {0:c}[Ô], Result)
End Sub
End Module
A Mensagem de erro :
Error 1 [ô])[ô] expected. [ô]C:\Documents and Settings\Admin\Meus documentos\Visual Studio 2008\Projects\ModPayment.vb 41 60 ModPayment
Antes aparece uma mensagem : visual studio cannot start debugging because the debug target c:\documents and settings\admin\meus docuntos\visual studio 2008\projects\modemprest\modemprest\bin\debug\modpayment.exe[ô] is missing.Please build the project and retry,or set the outputpath and AssemblyName for the Target Assembly.
[ô]Payment.exe
[ô] Valor do Empréstimo : 10.000
[ô] Juros Anuais (Por Exemplo para 60% , Insira 60) : 60
[ô] Total de Meses : 60
[ô] PerÃodo de Pagamentos em Anos : 5 anos
[ô] A 5% de Juros ao mês
[ô]Valor Pago em 5 Anosl :
Module Payment
Private dblAnnualInterest As Double = 0
Private iYears As Integer = 0
Private dblLoAmount As Double = 0
Private dblMonthLyDeposit As Double = 0
Sub Main()
Dim dblResult As Double
[ô]Armazena os valores informados
GetInputValues()
[ô]Calcula
dblResult = CalculatePayment(dblLoAmount, _
dblAnnualInterest, _
iYears)
[ô]Proceda a exibição do resultado
DisplayResults(dblResult)
End Sub
Private Function CalculatePayment(ByVal LoanAmount As Double, _
ByVal AnnualInterest As Double, _
ByVal Years As Integer) As Double
[ô]Divida por 1200 para torna-lo um percentual mensal
Dim DblMonthlyInterest As Double = CDec(AnnualInterest / 1200)
Dim iMonths As Integer = Years * 12
Dim dblTemp As Double
Dim dblReturns As Double
[ô]Precisaremos desse valor em alguns locais
dblTemp = CDec (((1 + DblMonthlyInterest ^ iMonths))
dblReturns = LoanAmount * _
(DblMonthlyInterest * dblTemp / (dblTemp - 1))
Return dblReturns
End Function
Private Sub GetInputValues()
Console.WriteLine()
dblLoAmount = CDec(GetValue([Ô]Loan Amount: [Ô]))
dblAnnualInterest = _
CDbl(GetValue([Ô]Annual Interest (e.g for 5%, enter 5): [Ô]))
iYears = CInt(GetValue([Ô]Years of loan: [Ô]))
Console.WriteLine()
End Sub
Private Function GetValue(ByVal Prompt As String) As String
Console.Write(Prompt)
Return Console.ReadLine
End Function
Private Sub DisplayResults(ByVal Result As Double)
Console.WriteLine()
Console.WriteLine([Ô]If you borrow {0:c}, [Ô], dblLoAmount)
Console.WriteLine([Ô]at {0}% interest.[Ô], dblAnnualInterest)
Console.Writeline([Ô]for {0}Years[Ô], iYears)
Console.WriteLine()
console.WriteLine([Ô]Your monthly payment would be: {0:c}[Ô], Result)
End Sub
End Module
A Mensagem de erro :
Error 1 [ô])[ô] expected. [ô]C:\Documents and Settings\Admin\Meus documentos\Visual Studio 2008\Projects\ModPayment.vb 41 60 ModPayment
Antes aparece uma mensagem : visual studio cannot start debugging because the debug target c:\documents and settings\admin\meus docuntos\visual studio 2008\projects\modemprest\modemprest\bin\debug\modpayment.exe[ô] is missing.Please build the project and retry,or set the outputpath and AssemblyName for the Target Assembly.
Resolvido o problema era falta de parêntese nessa linha : dblTemp = CDec (((1 + DblMonthlyInterest ^ iMonths))) <<<<<<faltou um
Tópico encerrado , respostas não são mais permitidas