kwesy kuffour
customer
1 Answer(s)      2 years and 5 months ago
Posted in : Java Beginners

At MKO Bank, a customer should be able to deposit money, withdraw money and check his or her balance. You have been approached to develop a software for MKO Bank. Required: a. Create a class called Customer The balance of the customer should be 1500 b. Create methods/functions for the deposit, withdrawal and checking of balance transactions. Use appropriate data members to help you accomplish this. c. Create another class called Bank with the main function. d. Declare an instance of the Customer class called Cust. e. Use the Cust object to check the current balance f. Use JOptionPane to allow a user enter a deposit. The program should display the new balance. g. Use JOptionPane to allow a user withdraw an amount. The program should display the new balance.

View Answers

December 3, 2010 at 4:57 PM


Hi Friend,

Try the following code:

import javax.swing.*;
class  Customer{
        int bal;

        Customer(int bal) {
        this.bal = bal;
        }
        int deposit(int amt) {
                if (amt < 0) {
                        System.out.println("Invalid Amount");
                        return 1;
                }
                bal = bal + amt;
                return 0;
        }

        int withdraw(int amt) {
                if (bal < amt) {
                        System.out.println("Not sufficient balance.");
                        return 1;
                }
                if (amt < 0) {
                        System.out.println("Invalid Amount");
                        return 1;
                }
                bal = bal - amt;
                return 0;
        }
         void check() {
                JOptionPane.showMessageDialog(null,"Balance:" + Integer.toString(bal));
        }

    }
    public class Bank{
        public static void main(String[]args){
        Customer Cust=new Customer(1500);
        String st1=JOptionPane.showInputDialog(null,"Enter the amount to deposit:");
        int dep=Integer.parseInt(st1);
        int bal1=Cust.deposit(dep);
        Cust.check();
        String st2=JOptionPane.showInputDialog(null,"Enter the amount to withdraw:");
        int with=Integer.parseInt(st2);
        int bal2=Cust.withdraw(with);
        Cust.check();
        }
    }

Thanks









Related Pages:
customer
customer  At MKO Bank, a customer should be able to deposit money... a software for MKO Bank. Required: a. Create a class called Customer The balance of the customer should be 1500 b. Create methods/functions for the deposit
customer details
customer details  write a java code to enter n number of persons details(name,address,phone number) in a array list. Also consider exceptional cases like entering integer in name,character in phone number. use try,catch ,throw
display he new customer no in textbox
display he new customer no in textbox   i want to add the new customer for that when i click on add butto the new customernumber should be display in textfield . plz ell me the suggestions & code
Customer Relationship Management
to the customer rather making new customer is the key factor for survival of any business in these time. Also creating new customer and keeping old one with loyal... the success of any organization in its efforts. Thus relationship with the customer
Customer orientation in marketing management
competitive scenario, it is necessary for the companies to focus on customers. Customer... of customer for the business activities, companies plan its strategy focusing on customers demand and their taste. It is known as the customer orientation
i need to print customer[1] is abcd,cbnb using array
i need to print customer[1] is abcd,cbnb using array  print("code... return false; } } class Customer { public String firstname; public String lastname; private Account account; Customer(String
i need to print customer[1] is abcd,cbnb using array
i need to print customer[1] is abcd,cbnb using array  print("code... return false; } } class Customer { public String firstname; public String lastname; private Account account; Customer(String
i need to print customer[1] is abcd,cbnb using array
i need to print customer[1] is abcd,cbnb using array  print("code... return false; } } class Customer { public String firstname; public String lastname; private Account account; Customer(String
i need to print customer[1] is abcd,cbnb using array
i need to print customer[1] is abcd,cbnb using array  print("code... return false; } } class Customer { public String firstname; public String lastname; private Account account; Customer(String
CRM Opportunities,CRM Market,CRM Solutions,Customer Relationship Management,CRM Soultion
applications? changed focus to Customers resulting in emergence of Customer... in the competitive market by focusing on Customer needs. To help achieve
Dedicated Servers
is rented to one customer and the customer has full control over the server. The server is dedicated to the customer and customer can host their website(s....   Best Customer Support: Dedicated servers normally come with good
CitrusDB
customer care and billing software solution (CC&B) that keep track of customer information, operational CRM, services, products, billing invoices and credit... feature: Customer details Unlimited services Create invoices Credit cards
eva3 Application Builder
eva3 Application Builder       Tailor-made: eva/3 CRM eva/3 Customer Relationship Management - professional organization of your customer relationship management. Our web
Web Design Packages, Website Design Packages
Why Custom Website Designing? The Custom Web Designing means the designing of website according to customer's need. In the fierce competitive era... if the internet works there. Every customer has different requirements. Even two
Marketing orientation: way for marketing
of customer is significant for a marketing company. In other words marketing orientation emphasizes to the want and need of customer so that company can win the trust of customer for the future prospect. Marketing orientation practices
Java Application for Book Store
a Java Bookstore Application through which a customer can buy books and online pay... of the books which have been bought by the customer. Then the shopkeeper Calculate the total amount that a customer has to pay for all books he bought and receive
Shopping cart
like the original grocery shop shopping cart that is used by the customer in selecting certain products. Finally after selection the customer confirms orders... if applicable. The software collects the credit card information of the customer
Benefits of Social Media Optimization
to the getting more and more customer to a business. Social media optimization may appear
BI: Key for building profits in B2B
why one product is bought more by customer and others not? What is the best... on the point of view of a customers and making them customer oriented. As far... and customized message to customers and hence making customer easy to decide by comparing
Why web designing is important
Why web designing is important In the era of digital revolution websites plays vital role in enhancing business by connecting new customer from the world. The websites has become important resource and attached in many aspects
Total Quality Management
In tough competitive era where customer is the supreme tool, which decides.... It is the process, which focus on customer satisfaction first priority and enhance all.... Now they have known the fact that customer is everything for their practices
Need of Marketing Segmentation
taken by the company is focused to how to satisfied its customer as it is only way... the target of selecting its customers, companies identify its customer... customer. Marketing segmentation is the process by which company targets difference
airTODO
airTODO airTODO is a minimalist project management tool, intended for customer, project, module, operation, task and time management, which can work with local and/or remote repositories. Tool composed as single file
Open Source CRM
is a commercial Open Source CRM Solution that helps enterprise businesses to manage customer... aspects of customer life cycle from identifying business opportunities... your customer relationships. Download the base application for FREE, and have
Web Design Packages, Website Design Packages
Custom Website Design Custom website designs means the designing of the website according to customer's choice, and Roseindia Technologies Pvt Ltd... according to customer's desire within the deadline. We assure our clients
E-Commerce and E-Business IT Solutions from Rose India
. Online shopping affords the customer the benefit of shopping at leisure from... multiple options to your customer's so they can view the products in their entirety..., customisable shopping carts, auto responders, customer verification solutions
Open Source Point of sale
Open Source Point of sale point of sale Point of sale, or POS as it is more commonly abbreviated, refers to the capturing of data and customer payment information at a physical location when goods or services are bought and sold
What is CICS?
What is CICS?       CICS stands for Customer Information Control System that is a very powerful transaction processing system. It is most widely used by financial institutions
Most Innovative Retail Management Practices
., for grasping the consumer trend and easily routing the customer service issues to company's customer service channels for subsequent follow up..., customer data, buying attitude and behavior paid some of the top retail brands enough
What is IVR?
What is IVR?       IVR (interactive voice response) is an automated  telephony technology that is used to interact to  the clients or customer in the form  of 
Component Assembly Model
a prototype is created according to the requirements of the customer and sent... resembles the specifications provided by the customer and the business. Moreover... program. The developers only need to know the requirements of the customer, look
Seven Ps of marketing mix
To satisfy customer by unique products and services is the basic motto for any business company today and customer satisfaction is the ultimate goal... of marketing, which defines how to generates customer oriented marketing strategy
CRM Solutions and Services, All CRM Solutions, CRM Solutions India
CRM Solutions Customer Relationship Management (CRM) solutions help you...: Our CRM solutions help in keeping your customer satisfaction at highest levels... customer loyalty You can do more through our CRM solutions by gaining fresh
Best Practices for Health Care Management
Presently health care Management stands as the sector of most intensive research, development and customer service. With global health care needs increasing... and generation of customer satisfaction for any health care facility. EMR
Most Innovative Practices of Marketing
practices of marketing are well known to create penetration and depth in customer
Best Social Media Tools
Social Media Tools Social media comprises of several sharing based websites that contains huge customer base and they are free to communicate to one another, share their contents, save other's contents, contribute in one's
Mobile Application Development Solutions, Mobile Software Development Services
that have helped companies to improve workflow, taking customer orders, and front office
Web Designing Solutions, Website Templates, Website Design Companies
times, the last, impression to any potential customer or lay visitor... be provided in most effective manner to the customer. In this era of global
Best Cloud Computing Applications for Small Business
, developing more competent end to end customer service based on the real time access... business. Zendesk Until a few years back for small businesses customer service... communication with state of the art customer relationship management application
Java Code - Java Beginners
Java Code  Code a statement that assigns a Customer object to the third element of an array of Customer objects named customers. Assume that the Customer class contains a constructor that assigns default values to all
Java Code - Java Beginners
Java Code  Code a statement that assigns a Customer object to the third element of an array of Customer objects named customers. Assume that the Customer class contains a constructor that assigns default values to all
Java Code - Java Beginners
Java Code  Code a statement that assigns a Customer object to the third element of an array of Customer objects named customers. Assume that the Customer class contains a constructor that assigns default values to all
Bank project
Bank project   Create a class Customer a. Having Instance variables Customer id(int), Customer Name(String), Customer Address(String), Customer Telephone(String) and Customer Email id(String) b. Method which generates Customer Id
Java Code - JDBC
Java Code  Write a Java Program using Swings that Keep track of Customer Information in Banks. Make This program using JMenuBar With Menus(Customer,Transcation,Print) Custmer Menu: for entering customer information Transcation
code for implementing sale purchase
is for customer .if customer purchases my sms then the value will be deduct from my table and insert in customer table.how do i implement this code.help me
java programming using RMI - RMI
java programming using RMI  Write a program using RMI to sell an item to the customer remotely and don't allow the customer to purchase the item if the stock is nil , by displaying an appropriate message

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.