Kid
YoungAgedOld
It will print out this way because the code uses if statements, rather than else if statements. As written, every single if statement will be triggered because each expression will evaluate to true. If there were else statements involved, then only the first one that is triggered will print out, and the rest will be ignored.
The reason for the weird formatting/spacing is because only the first print statement is println which adds a new line after printing. The other statements are just print, which does not add a new line or a space.
Answer:
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim foodCharge, tax, tip, totalCharge As Double
foodCharge = Val(TextBox1.Text)
tax = 0.07 * foodCharge
tip = 0.15 * 100
totalCharge = foodCharge + tax + tip
Label5.Text = tax
Label6.Text = tip
Label7.Text = totalCharge
End Sub
End Class
Explanation:
- This is implemented using Visual Basic programming language
- Firstly we declared all the variables using DIM key word
- Then the calculation for each variable is done according to the specification of the question
- On the form (See attached Image) the controls for receiving the user input is created as well as the controls for the output.
- See the attached sample run below:
Answer:
You should turn it off and plug it in so its fully charged the next day
Explanation: