EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
8th Edition
ISBN: 9781305480537
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
bartleby

Videos

Expert Solution & Answer
Book Icon
Chapter 8, Problem 6PE

a.

Explanation of Solution

Program:

File name: “Salesperson.java

//Define a class named Salesperson

public class Salesperson

{

    //Declare the private variables

    private int id;

    private double sales;

    /*Define a method Salesperson that includes

    an integer ID number and a double annual sales amount*/

    Salesperson(int idNum, double amt)

    {

        //Assign the values

        id = idNum;

        sales = amt;

    }

    //Define a method to display the id

    public int getId()

    {

        //Return the value

        return id;

    }

    //Define a method to display the annual sales amount

    public double getSales()

    {

        //Return the value

        return sales;

    }

    //Define a method to set the id

    public void setId(int idNum)

    {

        //Assign the value

        id = idNum;

    }

    //Define a method to set the annual sales amount

    public void setSales(double amt)

    {

        //Assign the value

        sales = amt;

    }

}

File name: “DemoSalesperson...

b.

Explanation of Solution

Program:

File name: “Salesperson.java

//Define a class named Salesperson

public class Salesperson

{

    //Declare the private variables

    private int id;

    private double sales;

    /*Define a method Salesperson that includes

    an integer ID number and a double annual sales amount*/

    Salesperson(int idNum, double amt)

    {

        //Assign the values

        id = idNum;

        sales = amt;

    }

    //Define a method to display the id

    public int getId()

    {

        //Return the value

        return id;

    }

    //Define a method to display the annual sales amount

    public double getSales()

    {

        //Return the value

        return sales;

    }

    //Define a method to set the id

    public void setId(int idNum)

    {

        //Assign the value

        id = idNum;

    }

    //Define a method to set the annual sales amount

    public void setSales(double amt)

    {

        //Assign the value

        sales = amt;

    }

}

File name: “DemoSalesperson2...

Blurred answer
Students have asked these similar questions
This is the question that is confusing me - A. Create a CollegeCourse class. The class contains fields for the course ID (for example, CIS 210), credit hours (for example, 3), and a letter grade (for example, A). Include get and set methods for each field. Create a Student class containing an ID number and an array of five CollegeCourse objects. Create a get and set method for the Student ID number. Also create a get method that returns one of the Student’s CollegeCourses; the method takes an integer argument and returns the CollegeCourse in that position (0 through 4). Next, create a set method that sets the value of one of the Student’s CollegeCourse objects; the method takes two arguments—a CollegeCourse and an integer representing the CollegeCourse’s position (0 through 4). B. Write an application that prompts a professor to enter grades for five different courses each for 10 students. Prompt the professor to enter data for one student at a time, including student ID and course…
This is the question I am stuck on - A. Create a CollegeCourse class. The class contains fields for the course ID (for example, CIS 210), credit hours (for example, 3), and a letter grade (for example, A). Include get and set methods for each field. Create a Student class containing an ID number and an array of five CollegeCourse objects. Create a get and set method for the Student ID number. Also create a get method that returns one of the Student’s CollegeCourses; the method takes an integer argument and returns the CollegeCourse in that position (0 through 4). Next, create a set method that sets the value of one of the Student’s CollegeCourse objects; the method takes two arguments—a CollegeCourse and an integer representing the CollegeCourse’s position (0 through 4). B. Write an application that prompts a professor to enter grades for five different courses each for 10 students. Prompt the professor to enter data for one student at a time, including student ID and course data for…
This is the question I am stuck on - A. Create a CollegeCourse class. The class contains fields for the course ID (for example, CIS 210), credit hours (for example, 3), and a letter grade (for example, A). Include get and set methods for each field. Create a Student class containing an ID number and an array of five CollegeCourse objects. Create a get and set method for the Student ID number. Also create a get method that returns one of the Student’s CollegeCourses; the method takes an integer argument and returns the CollegeCourse in that position (0 through 4). Next, create a set method that sets the value of one of the Student’s CollegeCourse objects; the method takes two arguments—a CollegeCourse and an integer representing the CollegeCourse’s position (0 through 4). B. Write an application that prompts a professor to enter grades for five different courses each for 10 students. Prompt the professor to enter data for one student at a time, including student ID and course data for…
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:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
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