Post a New Question


posted by .

Write a program that requests the numeric grades on a midterm and a final exam and then uses a Function procedure to assign a semester grade (A, B, C, D, OR F). The final exam should count twice as much as the midterm exam, the semester average should be rounded up to the nearest whole number, and the semester grade should be assigned by the folowing criteria: 90-100 (A), 80-89 (B), ... Use a function called Ceil that rounds noninteger numbers up to the nearest integer. The function Ceil can be defined by Ceil(x) = -int(-x).

  • programming -

    Here's a little perl program that handles the job:

    sub Ceil {
    my $x = shift;

    print "Numeric grades for midterm and final: ";
    my ($m,$f) = split /[,\s]/,<STDIN>;
    $avg = Ceil(($m+2*$f)/3);
    $grade = qw(F F F F F F D C B A A)[int($avg/10)];
    print "Midterm: $m
    Final: $f
    Average: $avg
    Grade: $grade\n";

  • programming -


Answer This Question

First Name
School Subject
Your Answer

Related Questions

More Related Questions

Post a New Question