MindTapV2.0 for Farrell's Java Programming with 2021 Updates, 9th Edition [Instant Access], 1 term
MindTapV2.0 for Farrell's Java Programming with 2021 Updates, 9th Edition [Instant Access], 1 term
9th Edition
ISBN: 9780357505540
Author: Farrell; Joyce
Publisher: Cengage Learning US
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
Create an array of objects of the Person class, of size 4. Create three objects of the Person class, with values, and assign the objects to the array. Loop through the array and print the name, job, and email of all Personobjects. (using the Netbeans application)
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()…
Create an application containing an array that stores eight integers. The application should call five methods that in turn (1) display all the integers, (2) display all the integers in reverse order , (3) display the sum of the integers, (4) display all values less than a limiting argument, and (5) display all values that are higher than the calculated average value.
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