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

Concept explainers

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

Explanation of Solution

Program:

File name: “CertOfDeposit.java

//Import necessary header files

import java.time.LocalDate;

//Define a class named CertOfDeposit

public class CertOfDeposit

{

    //Declare the private variables

    private int certificateNumber;

    private String lastName;

    private double balance;

    private LocalDate issueDate;

    private LocalDate maturityDate;

    /*Define a constructor that sets the instance variables

    to class CertOfDeposit */

public CertOfDeposit(int certificateNumber,String lastName,double balance, LocalDate issueDate)

    {

        //Refers to the instance variables

        this.certificateNumber=certificateNumber;

        this.lastName=lastName;

        this.balance=balance;

        this.issueDate=issueDate;

        this.maturityDate=issueDate.plusYears(1);

    }

    //Define a method that sets the certificate number

    public void setCertificateNumber(int certificateNumber)

    {

        this.certificateNumber=certificateNumber;

    }

    //Define a method that sets the last name

    public void setLastName(String lastName)

    {

        this.lastName=lastName;

    }

    //Define a method that sets the balance amount

    public void setBalance(double balance)

    {

        this.balance=balance;

    }

    //Define a method that sets the issue date

    public void setIssueDate(LocalDate issueDate)

    {

        this.issueDate=issueDate;

    }

    //Define a method that sets the maturity date

    public void setMaturityDate(LocalDate maturityDate)

    {

        this.maturityDate=maturityDate;

    }

    //Define a method that returns the certificate number

    public int getCertificateNumber()

    {

        //Return the value

        return certificateNumber;

    }

    //Define a method that returns the last name

    public String getLastName()

    {

        //Return the value

        return lastName;

    }

    //Define a method that returns the balance amount

    public double getBalance()

    {

        //Return the value

        return balance;

    }

//Define a method that returns the issue date as LocalDate object

    public LocalDate getIssueDate()

    {

        //Return the value

        return issueDate;

    }

//Define a method that returns the maturity date as LocalDate object

    public LocalDate getMaturityDate()

    {

        //Return the value

        return maturityDate;

    }

}

File name: “CertOfDepositArray.java

//Import necessary header files

import java.time.LocalDate;

import java.util.Scanner;

//Define a class named CertOfDepositArray

public class CertOfDepositArray

{

    //Define a main method

    public static void main(String[] args)

    {

        //Declare the variables

        int certificateNumber;

        String name;

        double balance;

        int day;

        int month;

        int year;

        final int size=5;

        //Create an object for Scanner class

        Scanner scanner=new Scanner(System...

Blurred answer
Students have asked these similar questions
Creating Enumerations In this section, you create two enumerations that hold colors and car model types. You will use them as field types in a Car class and write a demonstration program that shows how the enumerations are used.   1. Open a new file in your text editor, and type the following Color enumeration: enum Color {BLACK, BLUE, GREEN, RED, WHITE, YELLOW};   2. Save the file as Color.java.   3. Open a new file in your text editor, and create the following Model enumeration: enum Model {SEDAN, CONVERTIBLE, MINIVAN};   4. Save the file as Model.java. Next, open a new file in your text editor, and start to define a Car class that holds three fields: a year, a model, and a color.  public class Car {  private int year;  private Model model;  private Color color;   5. Add a constructor for the Car class that accepts parameters that hold the values for year, model, and color as follows:  public Car(int yr, Model m, Color c) {  year = yr;  model = m;  color = c;  }   6. Add a display()…
Design an application that declares an array of 10 StockTransactionobjects. Prompt the user for data for each object, and then display all the values. Design an application that declares an array of 10 StockTransactionobjects. Prompt the user for data for each object, and then pass the array to a method that determines and displays the two stocks with the highest and lowest price per share.
Design an application (submit pseudocode) that declares an array of 12 BaseBallGame objects. Prompt the user for data for each object, and display all the values. Then pass each object to a method that displays the name of the winning team or "Tie" if the score is a tie.
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