Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A) Describe what this class represents and what it does: B) What methods make up the classs public interface? public class MyClass { private String

A) Describe what this class represents and what it does:

B) What methods make up the classs public interface?

public class MyClass

{

private String firstName;

private String lastName;

private int idNumber;

private double balance;

public MyClass()

{

this.firstName = "";

this.lastName = "";

this.idNumber = -1;

this.balance = 0.0;

}

public MyClass(String firstName, String lastName, int id)

{

this.firstName = firstName;

this.lastName = lastName;

this.idNumber = id;

this.balance = 0.0;

}

public void makeDeposit(int id, double amount)

{

if(this.confirm(id))

{

this.balance += amount;

}

}

public void withdraw(int id, double amount)

{

if(this.confirm(id))

{

if(amount > this.balance)

System.out.println("Not enough in account");

else

this.balance -= amount;

}

}

private boolean confirm(int id)

{

if(this.idNumber == id)

return true;

else

{

System.out.println("INVALID");

return false;

}

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions