Create a class called Account. Having private fields custname and protected field balance Define a constructor that takes custname and balance as inputs and sets appropriate fields. Create getname() and getbalance() methods. Create setname() for setting custname Create a method called add. This method takes one numerical input and adds it to balance. Create a method called subtract. This method takes one numerical input and subtracts it from balance Save this class to Account.java Write a Test class that creates objects of type Account. The Test class should create objects of Account type and call the object's methods.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question

Create a class called Account.

Having private fields custname and protected field balance

Define a constructor that takes custname and balance as inputs and sets appropriate fields.

Create getname() and getbalance() methods.

Create setname() for setting custname

Create a method called add. This method takes one numerical input and adds it to balance.

Create a method called subtract. This method takes one numerical input and subtracts it from balance

Save this class to Account.java

Write a Test class that creates objects of type Account. The Test class should create objects of Account type and call the object's methods.

 

Subject: Java Programming

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 7 images

Blurred answer
Knowledge Booster
Unreferenced Objects
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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,