Create Account Object And Allow User To Input Account ID
Nov 10, 2014
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);
[Code] ......
View Replies
ADVERTISEMENT
Oct 28, 2014
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.
View Replies
View Related
Oct 5, 2014
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
/*---------------------------------------------------
Plagiarism Statement
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.
----------------------------------------------------------*/
package BankAccount;
import java.util.Date;
import java.util.Random;
//Project 3
public class BankAccount {
protected static int accountID;
[code]....
View Replies
View Related
Apr 8, 2014
How to fix the error with the line:
Account account1 = new account(1122, 20000.00);
import java.util.Date;
public class AccountClass {
class Account {
private int id;
private double balance;
private double annualInterestRate;
[Code] ....
I forgot to mention, the error says "account cannot be resolved to a type"
View Replies
View Related
Jul 11, 2014
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();
[code]....
View Replies
View Related
Sep 25, 2014
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;
[code]....
View Replies
View Related
Apr 26, 2015
I have an assignment in which I have to:
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 ...
import java.nio.file.*;
import java.io.*;
import java.nio.file.attribute.*;
import static java.nio.file.StandardOpenOption.*;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
[Code] .....
View Replies
View Related
Apr 13, 2014
I need to make a program that uses an object to calculate balance
import java.util.Date;
public class Account {
/** Setup Default Variables */
private int id = 0;
private double balance = 0;
private double annualInterestRate = 0;
[Code] ....
View Replies
View Related
Feb 25, 2015
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;
[Code] ....
View Replies
View Related
May 25, 2014
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.
View Replies
View Related
Feb 26, 2015
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;
[Code] ....
View Replies
View Related
May 11, 2014
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;
[Code] .....
View Replies
View Related
May 12, 2014
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 {
[Code] ...
Attached File(s)
AccountNumbers.txt (159bytes)
View Replies
View Related
Apr 21, 2014
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 .
What to do for the print out transactions
View Replies
View Related
Apr 23, 2014
What I have done wrong
public class BankAccount
{
String name;
int accountID;
double balance;
public void setAccount( String username, int ID, Boolean isJoint)
[Code] ....
View Replies
View Related
Feb 6, 2015
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....
View Replies
View Related
Sep 21, 2014
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.
View Replies
View Related
Mar 12, 2015
I have serious errors. I am trying to design a Bank Account Simulation. My various codes are as below.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import java.io.*;
public class Display2 extends JFrame //implements ActionListener
[Code] ....
ERROR: ResultsModel cannot be resolved to a type
View Replies
View Related
Apr 7, 2014
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:
"org.apache.jasper.JasperException: java.lang.NumberFormatException: null"
(I've attached a screen shot of the error) : NumberFormatException.bmp (750.98K)
What does this mean? how do i find the line in the code that has the error?
View Replies
View Related
Mar 31, 2014
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....
View Replies
View Related
Sep 16, 2014
Okay, so I know how to get user input and create a variable from the input, create a basic addition sum etc...
So I have this code:
package calc;
import java.util.Scanner;
class calc{
private static final double add = 0;
private static final double subtract = 0;
public static void main(String args[]){
[Code] .....
I'm basically trying to make it so that when the user enters tnum, tnum2, tnum3 and tnum4, their answer turns to the variable which has to be either true or false to make the boolean work. I don't know really how to do this. I want to make it so that if they enter yes, then that makes the boolean true and the numbers will multiply and create the answer variable. If they enter no then the boolean is false and it moves onto the next if statement. How can I do this?
View Replies
View Related
Jun 13, 2014
The method below is called within a large loop in another method. The code has been boiled down to easily show the problem I'm having. I found that the method worked fine (prompts user for input, gets input, returns input) until I added a statement at the end of the method that closes the Scanner object. When the kb.close() statement is present, the method works the first time through, but subsequent calls to this method only display the prompt and the Scanner object never waits for the user to input anything thereafter.
public int scanIt()
{
int i;
Scanner kb = new Scanner(System.out);
System.out.print("==> "); // prompt for input
if(kb.hasNextInt())
{
i = kb.nextInt();
System.out.println("User entered " + i);
}
kb.close();
}
View Replies
View Related
Feb 17, 2015
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
public class App {
public static void main(String[] args) throws IOException {
Scanner keyboard = new Scanner(System.in);
System.out.println("Please Select an option > ");
[Code] .....
View Replies
View Related
Sep 17, 2014
I am new to Java an have to Create a program that keeps track of the following information input by the user: First Name, Last Name, Phone Number, and Age. Now - let's store this in a multidimensional array that will hold 10 of these contacts. So our multidimensional array will need to be 10 rows and 4 columns.You should be able to add and remove contacts in the array.
View Replies
View Related
Sep 16, 2014
I am required to read user input to create two matrices which will eventually be added together. I am unsure as to how I can read the input from the user as an int and not a String. The input is from size 0-10 for both column and row size. Also, can you have a new button created in the actionPerformed method of a previous button?
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class Matrices implements ActionListener {
private JFrame win1, win2, win3, win4;
[Code]...
View Replies
View Related
Apr 9, 2014
Task:The main method of the class Things below creates an object called printer deriving from the class PrintingClass and uses that object to print text. Your task is to write the PrintingClass class.
Program to complete:
import java.util.Scanner;
public class Things {
public static void main(String args[]) {
String characterString;
Scanner reader = new Scanner(System.in);
PrintingClass printer = new PrintingClass();
System.out.print("Type in the character string for printing: ");
characterString = reader.nextLine();
printer.Print(characterString);
}
}
// Write the missing class here
Note: In this exercise the solution is part of a conversion unit where many classes have been declared. Because of this the classes are not declared as public using the public attribute.
Example output
Type in the character string for printing: John Doe
John Doe
My Class:
class PrintingClass {
public void print(){
System.out.println(characterString);
}
}
View Replies
View Related