Develop the class “Account” to be used by a bank. The Account class should have a single instance variable “balance”. Remember that balance must be a floating point number. The required methods for the Account class are shown below.
The Account class “debit” method should return a Boolean and should not allow an overdraft. If a withdraw greater than the current balance is attempted, the function should immediately return “false” and do nothing else.
Develop a test class to thoroughly test all aspects of the Account class. DO NOT change the class name or instance variable name given or the required method names as detailed below.
Account 1 constructor with no parameters (default balance to 0) 1 constructor with a balance parameter setBalance method getBalance method credit method debit method
I have the test class done, I won't need to put that in till later. My main problem is I'm not sure how I'm going to be able to get debit and setBalance to work together with each other.
public class Account { protected double balance; // Constructor to initialize balance public Account( double amount ) { balance = amount;
[Code] ....
You can see I'm stressed out by not reading over my code. I already have the "Debit" in use, just have to change it. Which I did.
How to write a driver program, this my code I have :
import java.util.Date; public class myAccount { public static void main(String[] args) { //create an instance object of class Stock Account myAccount = new Account(012233445566, 20000.00, 0.045);
This code models a simple ATM machine that can deposit, withdraw, and show the 10 latest transactions in an array of 10 index values.
My problem is that I can't get the balance right after 10 deposits, the balance only seems to sum the values in my array, not including the transactions made before those ten.
import java.util.Scanner; public class cashier2 { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); int amount = 0;
There seems to be a lot of things wrong with the output I get, but I'm not sure why. How do I get the output to print in columns? Also, how do I get the numbers to round?
I've four classes object. I don't know how to display the amount paid by the user, and show the balance. The calculate button just show the total amount. Do I have to create another object class? And I've to show the bills too.
This is my 1st Frame
import javax.swing.*; import java.awt.*; //titlepanel class displays a title in a panel public class TitlePanel extends JPanel { public TitlePanel() { JLabel title = new JLabel();
1. Create a bank file with at least 10 records that include an id#, balance, and last name 2. Create another file that will read these records and then create an array of Bank Account objects 3. Create checkboxes that allow the user to select how they want the data sorted 4. List the total number of accounts at the bottom of the GUI
I've created the file no problem that actually writes the ten records. I was able to have the files be read sequentially with System.out.println(), but I can't figure out how to convert these into an array of Bank Account objects and have them show up in a scroll pane. I tried using string builder and array builder, but I couldn't figure out how to turn them into components. I then tried making an Account class to have them be sorted with comparators, but I had the same problem of actually getting them into the scroll pane. Also, as soon as I added in those methods for the GUI, the while loop wouldn't display the array information in system.out.println. Here is my code for the GUI that doesn't display anything with println ...
This is my assignment "Add two radio buttons so that the user can select the gender (male or female). Also extend your Account class so that it contains the gender information as well. When the user presses "Submit", your program should read the entered data and create an Account object that captures all the data in your interface." How would I add RadioButton to this?
This is my code so far
/** * Orchestration class for Account */ public class AccountDemo { public static int numOfAccount = 3; public static void main(String [] args) { Account Accountholder1,Accountholder2,Accountholder3;
I'm working on this weeks assignment and I've gotten stuck on passing information from one class to another. We are working with abstract classes this week, and the BankAccount class is the Abstract class that is extended by the CheckingAccount and the SavingsAccount classes. The Bank class is where the user inputs his/her information to process the commands. How can I work this to where the instructions are passed from the main in the Bank class to the different Account classes to actually perform the instructions?
BankAccount:
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */
package bankaccount; abstract class BankAccount { private final BankAccount acctID; private int acctBalance = 0; public BankAccount checking; public BankAccount savings;
[Code] ....
I can attach a PDF of the instructions if that will provide additional insight to this. I'm sure I'll ask additional questions as we go, but I'm trying to get this to work right and figure out what I'm doing wrong.
Add two radio buttons so that the user can select the gender (male or female). Also extend your Account class so that it contains the gender information as well. When the user presses “Submit”, your program should read the entered data and create an Account object that captures all the data in your interface. This is my code, what would I need to add in order to make a RadioButton?
/** * Orchestration class for Account */ public class AccountDemo { public static int numOfAccount = 3; public static void main(String [] args) { Account Accountholder1,Accountholder2,Accountholder3;
This program asks the user for their starting balance, number of deposits, and number of withdrawals for a month
Now, if the number of withdrawals goes over 4, it has to include a service charge of 1.00 for every withdrawal that was more than 4 (This works fine so far)
The problem I am having is this:
The subclass part of this program is supposed to determine whether an account is below 25. If it is, it should make the account inactive, until the account is 25 or more. The subclass will have a method that will override the super's setWithdrawal mehtod to make sure that no withdrawals will be made until that balance is 25 or more.
Then the setDeposit method in the subclass will also override the super's setDeposit method and make sure that the account is not inactive before any deposits are made. If the account was determined to be inactive at that time and the deposits that were added make it jump to 25 or more, than the account should be changed to active and then be allowed to call the super's method to set the deposit.
So...the issue I am having is the subclass trying to determine whether the balance is under 25 before it calls the super's version of that method where it will allow the user to take money out and when making deposits where it will determine if the account was inactive first before make it active while the deposits raise to 25 or above.
Here is my super class:
// This is an abstract class that will be used for its child class BankAccount public abstract class BankAccount { private double balance; // To hold the account balance for the month private int numDeposit; // To hold the number of deposits for the month protected int numWithdrawal; // To hold the number of withdrawals for the month private double annualIR; // To hold the annual interest rate for the month protected double monthlyServCharge; // To hold any service charge for the month private double monthlyInterest;
I had to write a charge account validator program that compared the number you entered to a list of numbers using the array method. Now I have to modify the program to do the same thing but from a .txt file instead. I understand it is saying that AccountNumbers.txt does not exist, but I am positive that it does.
Here is my error message:
run: Exception in thread "main" java.io.FileNotFoundException: AccountNumber.txt (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:146) at java.util.Scanner.<init>(Scanner.java:656) at validatormodtest.ValidatorMod.<init>(ValidatorMod.java:24) at validatormodtest.ValidatorModTest.main(ValidatorModTest.java:24) Java Result: 1 BUILD SUCCESSFUL (total time: 0 seconds)
Here is my code:
ValidatorModTest.java package validatormodtest; import java.util.Scanner; import java.io.*; public class ValidatorModTest {
public class BankAccount { String name; int accountID; double balance; } public void setAcct ( String nam, double acctID)
[Code] ....
1. Create a class called BankAccount a. It will be a generic simple type of BankAccount
2. BankAccount will contain variables to store: a. the owner/owners of the account b. an account id c. it may contain other basic information (up to you)
3. BankAccount will contain methods that will allow you to: a. Set the account owners information b. Deposit money c. Withdraw money d. Set balances e. Print out transactions (think more like an atm each time an action is taken it gets printed)
4. BankAccount will contain its own main() a. At least 2 BankAccount objects will be created and ALL of their methods called .
When I try to print out the account Id for each account object, the id is always 1. But it should be 1,2,3,4,5....all the way to the number of the account generated.My question is am I missing something in the constructor or in the main method?? I am new to programming.The main method create an array of account objects and generate random balances into each account object.
import java.util.Scanner; public class Bank { public static void main(String[] args) { Scanner userInput=new Scanner(System.in); System.out.print("Enter the number of accounts to generate: "); int numOfAccount=userInput.nextInt();
I need to check the existence of email accounts before sending them mails to avoid going to a blacklist for sending to non real accounts.
I was thinking on (SSL)Sockets and smtp commands but I cant get it to work properly I am shooting in the dark here...
I have a JAVA application that sends mail to the people that buy certain things but the information quality is bad, so I must check if the mail exists before sending the mail....
So the assignment is as follows. Develop a new class called BankAccount. A bank account has the owner's name and balance. Be sure to include a constructor that allows the client to supply the owner's name and initial balance. A bank account needs - accessors for the name and balance, mutators for making deposits and withdrawals. I have the following code :
import java.util.Scanner; public class BankAccount{ public static void main(String [] args){ Scanner reader = new Scanner(System.in); double name; double balance; double deposit; double withdrawl;
[Code] ....
I am having trouble with my if statements. I don't know how to link the number 1 & 2 keys to deposit and withdrawal actions. Plus I am supposed to have a while loop yet don't know how to implement this so that the while loop will ask the user if they would like to make another transaction after either depositing or withdrawing.
I'm doing this project in JSP.net, with html. and in one of the web pages, what I'm doing is that, a person is transferring an amount to someone else, and if the transfer amount is more than the account balance, then he cannot transfer. else, save details in a table.
Here's the code I've used
<% String t1=request.getParameter("text1"); String t2=request.getParameter("text2"); java.util.Date date1 = new java.util.Date(); SimpleDateFormat ft = new SimpleDateFormat ("dd/MM/yyyy"); int tamt = Integer.parseInt(t2); int bamt = 0;
[Code] .....
But when i enter the fields and click the submit button in the form, to save it in the table, i get the error:
In my account driver I am trying to get the user inputted account number to get the account by account number. In my code
System.out.println("Which Account number: "); int account = scan.nextInt(); ac.get(account-1);
This works if my accounts are numbered incrementally starting with one, I want it to match the inputted account number
System.out.println("Account number: "); int num = scan.nextInt();
I am thinking a for loop is probably needed. Here is my code:
public class AccountDriver { public static void main(String[] args) { Scanner scan = new Scanner(System.in); ArrayList<Account> ac = new ArrayList<>(); boolean more=true; boolean again=false;
I want to write an app that declares a class Person(String name, int age), and an Account class, Account(int code, double balance).But, additionally, every Person has at most 3 accounts, and each account has a Peron associated with it.
my code so far...
public class Person { private String name; private int age; private Account[] accounts; private int numOfAccounts; public Person(String name,int age){ this.name=name;
[code]....
My problem is:When I make data input for a person, and additionally I want to read data for the account(s) that this rerson has, what code should I write to create a new Account object as account[numOfAccounts].And, what is the code to assign an owner to a new created Account object?
There exists a relationship between the two classes, but I cannot find the way to implement this relation....
I'm having some difficulty with my bank account project. I'm supposed to create a menu where the user can create a new account, withdraw, deposit, view their balance, and exit. There's issues with the account creation.
Here's my necessitated class below: BankAccount, TestBankAccount, SavingsAccount, CurrentAccount, and Bank
I certify that this assignment is my own work and that I have not copied in part or whole or otherwise plagiarized the work of other students and/or persons.
I have a strange problems. Perhaps some of you already have had this problem before.
I have method which is suppose to check if the itemstate has changed. It ONLY works ONCE?
Thereafter, it does not matter how many times I changed the selection of the ComboBox.
Basically I have two Comboboxes.
1. If Combobox 1 is selected (e.g. Dogs, Cats) 2. Then get information from what ever the item from ComboBox 1 is selected, and display on ComboBox 2. (Dog Name, Cat Name etc)
E.g.
So If I selected Dogs on Combobox 1 Then display the Dog Names on Combobox 2. If I then change and select Cats on Combobox 1, then display Cat Names on ComboBox 2.