Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem: At the end of the semester, you receive an email from your teacher. She

ID: 3568402 • Letter: P

Question

Problem:
At the end of the semester, you receive an email from your teacher. She wants to meet you to discuss grades. For a moment you think she wants to admonish you for getting bad grades.
When you meet her, she explains that she has graded all the exams, and the grades are out of 100. However, the dean wants a number that is scaled down to 10. She wants you to write a small program to scale down the grades and represent them out of 10 instead of 100.
In the exercise below, the grades will be given to you in an array of type double, called 'grades'. These are grades out of 100. You have to scale them down so that they are now represented out of 10 and change the values in the array accordingly
Please note, in this exercise you do not have to explicitly print anything.You simply have to change values in the array. We have already provided code that will print the array.

What we expect:
When you run the program, it will ask you to enter grades of the students. You can enter all the grades in one line as a set of floating point numbers, separated with spaces, as shown in the line below.
"60.5 70 87 90 45"
This line will be parsed by the code we have already provided, and the grades will be made available to you in an array of type double, called 'grades'.
We expect you to change values in the array to [6.05, 7.0, 8.7, 9.0, 4.5]

-------------------------------------------------------------------

//package ex43;

import java.util.Scanner;

public class GradesAgain {

   public static void main(String[] args) {      
      
       Scanner scanner = new Scanner(System.in);
      
       System.out.println("Please enter the grades separated with a space: ");
       String scoreLine = scanner.nextLine();
      
       //split the string to get an array of Strings which will
       //hold the values entered by the user
       String strScores[] = scoreLine.split(" ");
          
       double grades[] = new double[strScores.length];
      
       for(int i=0; i<strScores.length; i++) {
           grades[i] = Double.parseDouble(strScores[i]);
       }              
      
       ///{
//write down your code here
       //start  
      

//end
  
   ///}
      
       System.out.println("The grades out of 10 are: ");
       String gradesToPrint = "";
       for(int i=0; i<grades.length; i++) {
           gradesToPrint += grades[i] + " ";
       }
      
       System.out.println(gradesToPrint.trim());
   }

}

Explanation / Answer

import java.util.Scanner;

public class GradesAgain {

   public static void main(String[] args) {      
      
       Scanner scanner = new Scanner(System.in);
      
       System.out.println("Please enter the grades separated with a space: ");
       String scoreLine = scanner.nextLine();
      
       //split the string to get an array of Strings which will
       //hold the values entered by the user
       String strScores[] = scoreLine.split(" ");
          
       double grades[] = new double[strScores.length];
      
       for(int i=0; i<strScores.length; i++) {
           grades[i] = Double.parseDouble(strScores[i]);
       }              
//Grade Conversion from 100 to 10..
{

for(int i=0; i<strScores.length; i++) {
grades[i] = grades[i]/10;
}

}

       System.out.println("The grades out of 10 are: ");
       String gradesToPrint = "";
       for(int i=0; i<grades.length; i++) {
           gradesToPrint += grades[i] + " ";
       }
      
       System.out.println(gradesToPrint.trim());
   }

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote