EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
Expert Solution & Answer
Book Icon
Chapter 3, Problem 6PE

Explanation of Solution

Program code:

BookStoreCredit.java

//import the required packages

import java.util.Scanner;

//define a class BookStoreCredit

public class BookStoreCredit

{

//define the main method

public static void main(String[] args)

{

//create object of Scanner

Scanner scanner = null;

//create a try...catch block

try

{

//scannner object

scanner = new Scanner(System.in);

// prompt to read name of student

System.out.print("Enter the Student name:");

//get the name to studentName

String studentName = scanner.next();

// prompt to read grade point average of student

System.out.print("Enter the Student grade point average:");

//get the input to gradePointAvg

double gradePointAvg = scanner.nextDouble();

// method call

display(studentName, gradePointAvg);

        //catch the exception e

} catch (Exception e)

{

}

}

//define a method display()

public static void display(String studentName, double gradePointAvg)

{

//print the values

System.out.println("Student Name:" + studentName);

System.out.println("Grade point Average:" + gradePointAvg);

// compute the credit and display

System...

Blurred answer
Students have asked these similar questions
To encourage good grades, Hermosa High School has decided to award eachstudent 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 R 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.
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.0 credit. Create an application that prompts a student for a name and grade point average, and then passes the values to a method (computeDiscount) that displays a descriptive message. The message uses the student’s name, echoes the grade point average, and computes and displays the credit.
Create a calculator program. Get 2 numbers from the user. Create a method that adds the 2 numbers. Create a method that subtracts 1 number from the other. Create a method that multiplies the 2 numbers. Create a method that divides one number by another. It is important to check that you are not dividing by 0 here. You should be calling these methods from the main method and printing out the answers from the main method. Create a method that uses the modulus to return the remainder and the language is Java
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
    Text book image
    Microsoft Visual C#
    Computer Science
    ISBN:9781337102100
    Author:Joyce, Farrell.
    Publisher:Cengage Learning,
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,