Answer:
// here's the Java code.
import java.util.*;
// definition of the class
class BookstoreCredit
{
/* method that prints a message including the name and grade point */
public static void fun(String name,double grade)
{
// multiplying grade by 10
grade=grade*10;
// display the message
System.out.println(name+"\'s average grade is $"+grade);
}
// main method for the class
public static void main (String[] args) throws java.lang.Exception
{
try{
// scanner instance to read input
Scanner s=new Scanner(System.in);
// declaring variables
String s_name;
double grade;
System.out.print("Please enter the name:");
s_name=s.nextLine();
System.out.print("Please enter the grade point:");
grade=s.nextDouble();
}catch(Exception ex){
return;}
}
}
Explanation:
Define a string variable named s_name and a double variable named grade. Obtain the name and grade from the user, then invoke the fun() method with these parameters, which will multiply the grade by 10 and output a message that includes the student's name along with their average grade.
Output:
Please enter the name:john
Please enter the grade point:3.2
john's average grade is $32.0