EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
bartleby

Videos

Expert Solution & Answer
Book Icon
Chapter 3, Problem 12PE

Explanation of Solution

a.

Program code:

Student.java

//define a class Student

class Student

{

//declare the class members

private String ID;

private int numberOfCredits;

private int points;

private double gradePoint;

//define the constructor

public Student()

{}

//define the constructor

public Student(String aID, int aNumberOfCredits, int aPoints)

{

//initialize the class members

super();

ID = aID;

numberOfCredits = aNumberOfCredits;

points = aPoints;

//call the method calculateGradePoint()

calculateGradePoint();

}

//define the method getID()

public String getID()

{

//return the value of ID

return ID;

}

//define the method setID()

public void setID(String aID)

{

//set the value of ID

ID = aID;

}

//define the method getNumberOfCredits()

public int getNumberOfCredits()

{

//return the value of numberOfCredits

return numberOfCredits;

}

//define the method setNumberOfCredits()

public void setNumberOfCredits(int aNumberOfCredits)

{

//set the value of numberOfCredits

numberOfCredits = aNumberOfCredits;

}

//define the method getPoints()

public int getPoints()

{

//return the value of points

return points;

}

//define the method setPoints()

public void setPoints(int aPoints)

{

//set the value of points

points = aPoints;

}

//define the method toString()

public String toString()

{

//return the value

return "ID : " + ID + " NumberOfCredits : " + numberOfCredits + " Points : " + points+" Grade Point : "+gradePoint;

}

//define the method calculateGradePoint()

public void calculateGradePoint()

{

//calculate the value of gradePoint

gradePoint=points/(double)numberOfCredits;

}

}

Explanation:

The above snippet of code is used create a class “Student”. The class contain different static methods for store the details of a student. In the code,

  • Define a class “Student”
    • Define the constructor “Student ()” method.
    • Define the constructor “Student ()” method.
      • Initialize the class members.
      • Call the method “calculateGradePoint()”.
    • Define the “getID()” method.
      • Return the value of the variable “ID”.
    • Define the “setID()” method.
      • Set the value of the variable “ID”.
    • Define the “getNumberOfCredits()” method.
      • Return the value of the variable “NumberOfCredits”...

Blurred answer
Students have asked these similar questions
Create a class named Student that has fields for an ID number, numberof credit hours earned, and number of points earned. (For example,many schools compute grade point averages based on a scale of 4, so athree-credit-hour class in which a student earns an A is worth 12 points.)Include methods to assign values to all fields. A Student also has a field forgrade point average. Include a method to compute the grade point averagefield by dividing points by credit hours earned. Write methods to display thevalues in each Student field. Save this class as Student.java.b. Write a class named ShowStudent that instantiates a Student object from theclass you created and assign values to its fields. Compute the Student gradepoint average, and then display all the values associated with the Student.Save the application as ShowStudent.java.c. Create a constructor for the Student class you created. The constructor shouldinitialize each Student’s ID number to 9999, his or her points earned to 12,…
Please help me with this Java Lab
The L&L Bank can handle up to 30 customers who have savings accounts. Design and implement a program that manages the accounts. Keep track of key information, and allow each customer to make deposits and withdrawals. Produce appropriate error messages for invalid transactions. Hint: You may want to baseyour accounts on the Account class from Chapter 5. Also provide a method to add 3 percent interest to all accounts whenever the method is invoked.
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
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,
Memory Management Tutorial in Java | Java Stack vs Heap | Java Training | Edureka; Author: edureka!;https://www.youtube.com/watch?v=fM8yj93X80s;License: Standard YouTube License, CC-BY