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.
Write a program that simulates the Magic 8 Ball game. The class should have a method that returns an answer at random. Test your class by outputting the answer several times.
Write a class RangeInput that allows users to enter a value within a range of values that is provided in the constructor. An example would be a temperature control switch in a car that allows inputs between 60 and 80 degrees Fahrenheit. The input control has “up” and “down” buttons. Provide up and down methods to change the current value. The initial value is the midpoint between the limits. As with the preceding exercises, use Math.min and Math.max to limit the value. Write a sample program that simulates clicks on controls for the passenger and driver seats.   PLEASE USE THE TEMPLATES PROVIDED AND ENSURE THAT IT WORKS WITH THE TEST CLASS
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,