Java) Create a new project folder in Eclipse for this activity. In this folder, create two new classes - Account.java and Savings.java and put your name in a Javadoc comment at the top. Make the Account class an abstract class by adding the abstract keyword before the class keyword Inside the Account class, add the following variables and methods: A private variable called name (String) A private variable called balance (double) A two-argument constructor which takes in String and double parameters A no argument constructor, which calls the two-argument constructor, passing in "name unknown" and 0.0 as arguments. Getter and setter methods for the two variables An abstract method called updateBalance A toString() method Make the Savings class final by adding the final keyword before the class keyword - now this class cannot be extended (no inheritance from this class). Also make Savings a subclass of Account Inside the Savings class, add the following variables and methods: A private variable called interestRate (double) A three-argument constructor which takes in a String and two double parameters, and calls the two argument constructor of the Account class A no argument constructor, which calls the three-argument constructor of Savings, passing in "name unknown", 0.0, and 0.0 as arguments. Getter and setter methods for the interestRate variable A method called updateBalance that overrides the abstract method of the super class Note that it is required to override this method or your class will have an error This method is void and has no parameters It multiplies balance by 1 + interestRate and assigns the result to balance A toString() method that overrides toString from the superclass. Add a final class to your project folder called SavingsTest.java. Copy and paste the below code into this class. /**  * SavingsTest.java  * @author  * CIS 36B, Activity 13.1  */ import java.util.Scanner; public class SavingsTest {     public static void main(String args[]) {         Scanner input = new Scanner(System.in);         System.out.println("Welcome!\n");         System.out.print("Enter your name: ");         String name = input.nextLine();         System.out.print("Enter the balance to invest: $");         double balance = input.nextDouble();         System.out.print("Enter the interest rate on your target account: ");         double interest = input.nextDouble();                 Savings savings = new Savings(name, balance, interest);         System.out.println("\nHere is your account summary: \n" + savings);                 savings.updateBalance();                 System.out.printf("In one year, your balance"                 + " will be: $%.2f", savings.getBalance());                 input.close();             } } When your program works as shown in the sample output, upload Account.java and Savings.java to Canvas. Sample Output: Welcome! Enter your name: Grace Kang Enter the balance to invest: $50000 Enter the interest rate on your target account: .025 Here is your account summary: Name: Grace Kang Balance: $50000.0 Interest Rate: 0.025 In one year, your balance will be: $51250.00

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

(Java)

  • Create a new project folder in Eclipse for this activity.
  • In this folder, create two new classes - Account.java and Savings.java and put your name in a Javadoc comment at the top.
  • Make the Account class an abstract class by adding the abstract keyword before the class keyword
  • Inside the Account class, add the following variables and methods:
    • A private variable called name (String)
    • A private variable called balance (double)
    • A two-argument constructor which takes in String and double parameters
    • A no argument constructor, which calls the two-argument constructor, passing in "name unknown" and 0.0 as arguments.
    • Getter and setter methods for the two variables
    • An abstract method called updateBalance
    • A toString() method
  • Make the Savings class final by adding the final keyword before the class keyword - now this class cannot be extended (no inheritance from this class).
    • Also make Savings a subclass of Account
  • Inside the Savings class, add the following variables and methods:
    • A private variable called interestRate (double)
    • A three-argument constructor which takes in a String and two double parameters, and calls the two argument constructor of the Account class
    • A no argument constructor, which calls the three-argument constructor of Savings, passing in "name unknown", 0.0, and 0.0 as arguments.
    • Getter and setter methods for the interestRate variable
    • A method called updateBalance that overrides the abstract method of the super class
      • Note that it is required to override this method or your class will have an error
      • This method is void and has no parameters
      • It multiplies balance by 1 + interestRate and assigns the result to balance
    • A toString() method that overrides toString from the superclass.
  • Add a final class to your project folder called SavingsTest.java. Copy and paste the below code into this class.
/**
 * SavingsTest.java
 * @author
 * CIS 36B, Activity 13.1
 */

import java.util.Scanner;

public class SavingsTest {
    public static void main(String args[]) {
        Scanner input = new Scanner(System.in);
        System.out.println("Welcome!\n");
        System.out.print("Enter your name: ");
        String name = input.nextLine();
        System.out.print("Enter the balance to invest: $");
        double balance = input.nextDouble();
        System.out.print("Enter the interest rate on your target account: ");
        double interest = input.nextDouble();
       
        Savings savings = new Savings(name, balance, interest);
        System.out.println("\nHere is your account summary: \n" + savings);
       
        savings.updateBalance();
       
        System.out.printf("In one year, your balance"
                + " will be: $%.2f", savings.getBalance());
       
        input.close();
       
    }
}
  • When your program works as shown in the sample output, upload Account.java and Savings.java to Canvas.

Sample Output:


Welcome!

Enter your name: Grace Kang
Enter the balance to invest: $50000
Enter the interest rate on your target account: .025

Here is your account summary:
Name: Grace Kang
Balance: $50000.0
Interest Rate: 0.025
In one year, your balance will be: $51250.00

Expert Solution
Introduction
  • Create a new project folder in Eclipse for this activity.
  • In this folder, create two new classes - Account.java and Savings.java and put your name in a Javadoc comment at the top.
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 5 images

Blurred answer
Knowledge Booster
Class
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education