PDA

View Full Version : Programming Homework



butter
10-18-2009, 01:43 PM
I am taking an IT class and we are now at programming. This is all very new to me, and challenging. I work with EXCEL, WORD and OUTLOOK everyday so I am familiar with those but never learnt programming before. I left school many years ago. I will give the problem and the solution. If anyone could explain the answer ( solution ) line by line in simple language or even tell me why it's done this way I would appreciate. I am particularly interested in the meaning of the word PRINT in the solution ( both at the beginning and end) and also why the quotation marks. My daughter is trying to help as she has done all of this before and more but teens can be a bit impatient and maybe I need someone to come down to my level.

A student is given a 10% discount if the cost of a subject exceeds $100.00. 5% of the cost is refunded if the student receives grade "A" in the examination. Read the cost and a grade. Output the discount amount and the amount refunded.

SOLUTION

PRINT "Enter the cost and the grade"
READ COST, GRADE
IF COST > 100 THEN
DISCOUNT = COST * 10/100
ELSE
DISCOUNT = 0
ENDIF
IF GRADE = "A" THEN
REFUND = COST * 5/100
ELSE
REFUND = 0
ENDIF
PRINT "Discount" , DISCOUNT
PRINT "Refund", REFUND

Thank you very much. I have been at this all weekend. Trying to read and teach myself as much as possible before I return to class tomorrow nite. Any help and further explanations would be appreciated.