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


VulpesRank #55 · 29.2K reputationPosted Oct 16, 2013, 3:21 PM EDT
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).
VulpesRank #55 · 29.2K reputationPosted Oct 16, 2013, 3:03 PM EDT
SUNIL GUTTARank #1,832 · 810 reputationPosted Oct 16, 2013, 3:07 PM EDT
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 ?
SUNIL GUTTARank #1,832 · 810 reputationPosted Oct 16, 2013, 3:14 PM EDT
SUNIL GUTTARank #1,832 · 810 reputationPosted Oct 16, 2013, 3:27 PM EDT