Java Programming
Java Programming
9th Edition
ISBN: 9780357238530
Author: Joyce Farrell
Publisher: Cengage Limited
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 a menu item which restarts the game. Also add a timer, which counts the elapsed time since the start of the game level. When the restart is pressed, the restarted game should ask the player' name  (in the GameGUI constructor) and set the score of player to 0 (player.setScore(0)), and the timer should restart again. And create a logic so that if the player loses his life (checkGame if the condition is false), then save this number together with his name into two variables. And display two buttons where one quits the game altogether (System.exit(0)) and the other restarts the game. public class GameGUI extends JPanel {    private final Labyrinth labyrinth;    private final Player player;    private final Dragon dragon;     private final ImageIcon playerIcon = new ImageIcon("data/images/player.png");    private final ImageIcon dragonIcon = new ImageIcon("data/images/dragon.png");    private final ImageIcon wallIcon = new ImageIcon("data/images/wall.png");    private final ImageIcon…
Please original work Analyze the complexity issues of processing big data What are five complexities and talk about the reasons they make the implementation complex. Please cite in text references and add weblinks
Create a Database in JAVA Netbeans that saves name of the player and how many labyrinths did the player solve. Record the number of how many labyrinths did the player solve, and if he loses his life, then save this number together with his name into the database. Create a menu item, which displays a highscore table of the players for the 10 best scores public class GameGUI extends JPanel {    private final Labyrinth labyrinth;    private final Player player;    private final Dragon dragon;     private void checkGameState() {        if (player.getX() == 0 && player.getY() == labyrinth.getSize() - 1) {            JOptionPane.showMessageDialog(this, "You escaped! Congratulations!");            System.exit(0);        }         if (Math.abs(player.getX() - dragon.getX()) <= 1 &&            Math.abs(player.getY() - dragon.getY()) <= 1) {            JOptionPane.showMessageDialog(this, "The dragon caught you! Game Over.");            System.exit(0);        }    } } public…
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
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
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,