Hi
A second-hand bookstore charges 50 cents for the first 10 paperbacks that you buy and
35 cents for each additional paperback. Write just the if-else block for this program.
Assume that the user has entered the number of books she wishes to purchase as input.
Display the total cost.
TY cheers mate
Loading

VulpesPosted Oct 16, 2013, 7:21 PM
Console.Write("Enter number of books : ")
Dim numberOfBooks As Integer = CInt(Console.ReadLine())
Dim totalCost as Double
If numberOfBooks <= 10 Then
totalCost = numberOfBooks * 0.5
Else
totalCost = 10 * 0.5 + (numberOfBooks - 10) * 0.35
End If
Console.WriteLine("Total cost is {0:C}", totalCost)
I've been using .NET since the version 1.0 beta so these questions are easy for me :)
Anyway, time now for bed here (yawn).
SUNIL GUTTAPosted Oct 16, 2013, 7:27 PM
SUNIL GUTTAPosted Oct 16, 2013, 7:14 PM
SUNIL GUTTAPosted Oct 16, 2013, 7:07 PM
Does that come from experience or how just catching right easy path ? else i am fool unable to think anything ??
So how much is ur experience friend ?
VulpesPosted Oct 16, 2013, 7:03 PM