program testavg; uses crt; {-------------------------------------------------------------------------- This program will find the total grade for a group of 3 weighted tests. by --------------------------------------------------------------------------} VAR a,x,r,b,c,t:real; j:char; begin repeat clrscr; textcolor(green); write ('What is the grade for the first test? ---> '); readln (x); write ('and the weight, as a decimal? ---> '); readln (r); t := r; a := x * r; writeln; write ('second? ---> '); readln (x); write ('and the weight, as a decimal? ---> '); readln (r); t := t + r; b := x * r; writeln; write ('third? ---> '); readln (x); write ('and the weight, as a decimal? ---> '); readln (r); t := t + r; c := x * r; writeln; writeln; writeln; if t <> 1 then begin textcolor (red + blink); writeln ('WARNING:YOUR WEIGHTS DO NOT ADD UP TO 100%'); writeln ('Did you mess up, and want to start over? '); j := readkey; writeln; writeln; textcolor(green); end else j := 'n'; until j = 'n'; writeln ('The weighted score for the first test is ',a:0:2); writeln ('The weighted score for the second test is ',b:0:2); writeln ('The weighted score for the third test is ',c:0:2); writeln; a := a + b + c ; writeln ('The overall weighted grade is ',a:0:2); if a >= 60 then writeln ('Good job! You''ve got a passing grade!') else writeln ('Better improve your grade... you''re not passing'); readln; end.