here is my coding. i am trying to make it print 10 times "Wow a mark of"; average; "Holy Cow!"
when the average is 90 and above but somehow it prints in a loop. For average equal to 0, i want it to print "no marks were entered" but it somehow prints "Your last year average was "
When the user enters a negative number, it automatically quits.
The program is almost done, i just need professional help to perfect it.
Code: Select all
'Filename: KTDOFOR.BAS ' 'Variable Dictionary ' numcourses - the total number of courses the student took ' total - a running total of all the student's marks ' mark - a mark in one course ' counter - a counter to keep track of the number of times a message ' is printed ' average - the average of all the students marks ' CLS PRINT "This program will determine your average on last year's courses" PRINT "When you have finished entering marks, type a negative number." PRINT numcourses = 0 total = 0 DO 'This section makes sure a valid mark is entered ' INPUT "Please enter a mark ", mark WHILE (mark > 100) PRINT "100 is the highest possible mark" INPUT "Please enter a mark", mark WEND IF mark < 0 THEN EXIT DO 'Increment total and counter ' numcourses = numcourses + 1 total = total + mark 'Special message for a high mark ' IF mark >= 90 THEN counter = 5 WHILE (counter < 10) PRINT "A mark of"; mark; "! Wow!" counter = counter + 1 WEND END IF LOOP WHILE (total > 0) 'Make sure at least one mark was entered ' WHILE numcourses > 0 average = total / numcourses 'Special message for a high average ' WHILE 90 < average <= 100 counter = 15 WHILE counter > 4 counter = counter - 1 PRINT "Wow a mark of"; average; "Holy Cow!" WEND WHILE average <= 90 CLS PRINT "Your average last year was"; average counter = 1 WHILE counter = 1 WEND WHILE average <= 0 CLS PRINT "No marks were entered" counter = 1 WHILE counter = 1 WEND WEND WEND WEND WEND END