Create another object called b2 without passing parameters

Assignment Help Computer Engineering
Reference no: EM132200762

Question :

Write a Java class called BankAccount (Parts of the code is given below), which has two fields name (String) and balance (double), two constructors and five methods getName(), getBalance(), deposit (double amount), withdraw(double amount) and toString().

The first constructor should initialize name to null and balance to 0.

The second constructor initializes name and balance to the parameters passed. deposit method deposits the amount to the account causing the current balance to increase, withdraw method withdraws the amount causing the current balance to decrease and toString() method returns account name and the current balance separated by a comma.

For example if name is Jake and balance is 40.0 it should return

Jake, $40.00

public class BankAccount {

private String name;

public void deposit(double amount) {

balance = balance + amount;

}

public void withdraw(double amount) {

}

}

Write a client program called BankAccountClient that creates a BankAccount object called B1 and assigns "John" to its name field and 1000 to balance field.

Call the deposit method to deposit 500 to this account and call the display method to display the current balance. Then, withdraw 300 from this account and print the object using println.

Create another object called B2 without passing parameters and display the name and current balance for this object.

Reference no: EM132200762

Questions Cloud

Compute the summation of even numbers and odd numbers : Compute the summation of even numbers and odd numbers from myNums and name them evenSum and oddSum.
Write a java boolean method which takes a 2-d array : Write a Java boolean method, equalRowCol, which takes a 2-dimensional array of int as a parameter and returns true if there is an entry.
What is the path between 0 and 5 : What is the path between 0 and 5? What is the weight of the path between 0 and 5?
What promotional mix has been used in the imc campaign : Describe the big idea, or brand message, underpinning the integrated marketing communications (IMC) campaign that has been developed for this brand.
Create another object called b2 without passing parameters : Write a Java class called BankAccount (Parts of the code is given below), which has two fields name (String) and balance (double), two constructors.
What is an intelligence analysis strategy : What is an Intelligence Analysis Strategy and how is it used? How can an Intelligence Analysis Strategy be used on a terrorist organization such as Al Qaeda?
Graph the individual marginal benefit : Graph the individual marginal benefit and marginal social benefit curves of a Teibout community (you can determine the slope and shape of the curves).
Express the critical discount factor as a function : Now change this game so that there are N 2 firms in the metrology tools market. If they all charge the same price, each will sell a proportion 1/N of the market
Write a java expression that results in the significant byte : Write a Java expression that results in the least significant byte of an integer x being preserved, but all other bits set to 1.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Would exported operations in provide any useful abstraction

Would the exported operations in provide any useful abstraction when they are called by the module's clients? Why? Why not?

  How do you change the home page 9how do you delete the web

1.what is a peer tp peer network? what is a client server network?2.what is the difference between an internet and an

  What will be the average number of loop iterations required

What will be the average number of loop iterations required to find a value? What is the maximum number of iterations required to find a value?

  Write a program that prompts the user for an integer

Write a program that prompts the user for an integer and then prints out all prime numbers up to that integer.

  What other error-detection techniques are available

What other error-detection techniques are available? How do they compare to parity and cyclic redundancy checksum?

  Write all array values into the given file

The function should write all array values into the given file, separated by commas and with 3 digits of precision for each.

  Your boss has just heard about some nefarious computer

your boss has just heard about some nefarious computer activities known ping sweeps and port scans. he wishes to know

  What are the two principle type of clustering

What are the two principle type of clustering? Take the top-ranked candidate words as words that have potential syntagmatic relations with w1?

  Write down a perl program that given a dna string prints

write a perl program that given a dna string prints out the 20 characters upstream of the start codon atg. that is

  An app that helps farmers make and inventory of things

An app that helps farmers make and inventory of things in their sheds/barns(with photos, notes, dictation. etc)

  How is the kdc authenticated to alice

How is the KDC authenticated to Alice? How is the KDC authenticated to Bob? How is Alice authenticated to Bob? How is Bob authenticated to Alice?

  Write program that implement merge sort for sequential data

Write a program that implements merge sort for sequential data files. Test your program on a file with several thousand data values.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd