Computer Science

posted by .

We are using Netbeans IDE for my class and i have no clue on how to write this program...

Write a program to enter a score and a points possible for a test, computer the percent, display the percent to 1 decimal place and then display the letter grade (A – F) using a standard scale (90, 80, 70, 60) – use the if ... else if ... else if ...

Example
Enter points on test: 38
Enter points possible: 49
You got 77.6 percent
That is a C

  • Computer Science -

    I forgot to mention we are using Java

  • Computer Science -

    The Netbeans IDE runs only Java, so there is no ambiguity.

    You need a nested if statement, which should be indented properly.

    I will give an example of how the if statement should work, you will have to rework the numbers to suit your teacher's question.


    // Declare score, maxScore as integer
    // declare grade as character
    // declare percent as double
    // enter values of scores by user
    // if maxScore==0, reenter maxScore
    // now calculate percentage
    percent=score/maxScore*100;
    if (percent>=90){
    grade='A';
    } else if (percent>=80){
    grade='B';
    } else {
    grade='F';
    }
    // output letter grade to 1 place of decimal
    // output letter grade

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. computer science

    c++ program question write a program that uses a loop to display the characters for each ascii code 32 through 127. display 16 characters on each line with one space between characters in c++
  2. computer science

    How would you write this program? We are using Java in Netbeans IDE.. Write a program to enter the year (ex 2004) and month number (1-12) then compute the number of days in that month. Example Enter the Year: 2004 Enter the Month:
  3. Computer Programing & Logic Design

    Submit pseudocode and a flowchart for the following programming exercise: Test Average and Grade Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average …
  4. computer science

    I need to write a program that ask the student to enter an answer to a math problem. The user should enter two values, one at a time, and then ask for an answer. The program should display if the entered answer is correct or not and …
  5. computer science

    Class scores: Write a program that calculates the total grade for N classroom exercises as a percentage. The user should input the value for N followed by each of the N scores and totals. Calculate the overall percentage (sum of the …
  6. computer science

    write a program to select the classes that you are taking(Ex. Computer Science) .When the button is clicked, the program should print the names of the computer language studied. If no, check boxes have been selected, the sentence "No …
  7. Computer Science

    Design a program that will ask the user to enter the amount of a purchase. The program should the compute the state and county sales tax. Assume the state sales tax is 4 percent and the county sales tax is 2 percent. The program should …
  8. computer science

    Mr Ali has given a test to his class. He would like to have the average score for the class as well as the highest and lowest scores. Write a pseudocode to calculate and display these values. Then convert your pseudocode into a program …
  9. science computer

    The program will accept the final marks of a group of students in a class. The lecturer can choose '1' to finds the highest and lowest marks in the class. The lecturer choose '2' to find the average marks of that class. If user enter …
  10. java programming

    Test Average and Grade Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Write the following methods in the program: • calcAverage—This …

More Similar Questions