Ask Question

Write a program that converts an input grade from 60 to 100 and outputs a converted grade from 0.0 to 4.0. a. Minimum input value is 60, maximum is 100. b. All whole numbers must display as decimals. (0 displays as 0.0 and 3 as 3.0) The solution requires that you create a simple mathematical expression that converts the input value into the output value

+5
Answers (1)
  1. 1 November, 18:14
    0
    import java. util. Scanner;

    public class num7 {

    public static void main (String[] args) {

    Scanner in = new Scanner (System. in);

    System. out. println ("Enter the grade 60-100");

    double grade = in. nextDouble ();

    while (grade100) {

    System. out. println ("Enter a valid grade 60-100");

    grade = in. nextDouble ();

    }

    double outVal;

    if (grade>=60 && grade<70) {

    outVal = 0.0;

    }

    else if (grade>=70 && grade<80) {

    outVal = 1.0;

    }

    else if (grade>=80 && grade<90) {

    outVal = 2.0;

    }

    else if (grade>=90 && grade<100) {

    outVal = 3.0;

    }

    else{

    outVal = 4.0;

    }

    System. out. println ("The converted grade is: "+outVal);

    }

    }

    Explanation:

    The program is written in Java User is prompted to enter a grade between 60-100 A while loop is used to validate user input If/else if/else statements are used to convert the values as required the output value is stored as a double
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write a program that converts an input grade from 60 to 100 and outputs a converted grade from 0.0 to 4.0. a. Minimum input value is 60, ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers