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

I want the solution in NetBeans. Pay attention to your formatting of values that

ID: 3910645 • Letter: I

Question

I want the solution in NetBeans.

Pay attention to your formatting of values that contain decimals. Dollar amounts should never have more than 2 decimal places displayed.

To encourage good grades, Hermosa High School has decided to award each student
a bookstore credit that is 10 times the student’s grade point average. In other words, a
student with a 3.2-grade point average receives a $32 credit. Create a class that
prompts a student for a name and grade point average, and then passes the values to a
method that displays a descriptive message. The message uses the student’s name,
echoes the grade point average, and computes and displays the credit. Save the
application as BookstoreCredit.java.

Explanation / Answer

Please find the below code for the given task. In main method we read student name and GPA. We pass those values to another method called calculateBookStoreCredit to find the store credit based on GPA and finall display the details of student.

import java.util.Scanner;

public class BookstoreCredit {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.print("Enter Student Nmae: ");

String name = sc.nextLine();

System.out.print("Enter Grade Point Average: ");

float gpa = Float.parseFloat(sc.nextLine());

calculateBookStoreCredit(name,gpa);

}

private static void calculateBookStoreCredit(String name, float gpa) {

// TODO Auto-generated method stub

float bookStoreCredit = gpa*10.00f;

System.out.println("Name is: "+name);

System.out.println("GPA is: "+gpa);

System.out.println("Book Store Credit is: $"+bookStoreCredit);

}

}

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