Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 10 of 10

Thread: You need help

  1. #1
    Junior Member
    Join Date
    Mar 2011
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy You need help

    You need help

    hi I want a solution to this Alsoal I have a test I did not find the right solution I am a newbie I hope he has a solution or explain to me how I work Classic

    Please model, in a simple way and using object-oriented techniques, a bank
    and its customers (private, not business):
    • Model the class inheritance hierarchy: Account, CheckingAccount,
      SavingAccount, and SuperSavingAccount.
    • Model the Customer class
    • Think about the most important attributes and methods for each class.
    • Explain the relationships between the different classes.
    • Return the class diagram as part of the solution!

    Now implement these classes in Java. Comment the code well and submit the source
    code as well as the binaries as part of the solution!


    thanks

  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: You need help

    You are going to have to show folks what you have done so far and ask a more specific question about it...I doubt folks will provide a solution for you based upon what you posted, and even if they do that solution may be deleted as per the forum guidelines for handing over answers to homework assignments.

    If you are truly stuck, I suggest spending some time reading the following: http://download.oracle.com/javase/tutorial/

  3. #3
    Junior Member
    Join Date
    Mar 2011
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: You need help

    Ok thanks
    I will try and offer my attempts and I ask help me

  4. #4
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: You need help

    Quote Originally Posted by javegirl View Post
    Ok thanks
    I will try and offer my attempts and I ask help me
    Please show us the code you have attempted and we will take it from there
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  5. #5
    Junior Member
    Join Date
    Mar 2011
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: You need help

    Oak will send source code for the moment, please

  6. #6
    Junior Member
    Join Date
    Mar 2011
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Re: You need help

    import java.util.*;
     
    public class Account {
     
    	public static void main(String[] args) {
    		Scanner scanner = new Scanner(System.in);
     
     
    		System.out.println("    Welcome to our BANK ");
     
    		    	 int password;
    		    	System.out.print("password= ");
    			password= scanner.nextInt();
    			System.out.println(password);
     
     
    			    }
    		    }

    package bank;
     
    public class CheckingAccount {
     
     
    	public static void main(String[] args) {
     
     
    	}
     
    }

    package bank;
     
    public class SavingAccount {
     
     
    	public static void main(String[] args) {
     
     
    	}
     
    }

    package bank;
     
    public class SuperSavingAccount {
     
    	public static void main(String[] args) {
     
    	}
     
    }

    package bank;
     
    public class Customer {
     
    	public static void main(String[] args) {
     
     
    	}
     
    }

  7. #7
    Junior Member
    Join Date
    Mar 2011
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: You need help

    want to work the relations between my classes, for example Kayvaaml relationship between the client with the account Despaired in resolving this duty help me pleeeeeeas >>>How can one explain to me the solution>>>

    Tired =(
    and thank you from is a question and help me

  8. #8
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: You need help

    Firstly, seeing as Account is your main class, this is the only class that needs to contain the main method.

    You can remove the main method from the other classes and create new methods within them.

    Here is an example of how you can make two classes interact:

    import java.util.Scanner;
     
    public class Account {
     
    	public static void main(String[] args) {
     
    		Scanner scanner = new Scanner(System.in);
    		System.out.println("Welcome to our BANK ");
     
    		CheckingAccount ca = new CheckingAccount();
    		ca.CheckingMethod();
    		ca.AnotherMethod();
    	}
    }


    public class CheckingAccount {
     
    	public void CheckingMethod(){
    		System.out.println("You just called the CheckingMethod method");
    	}
     
    	public void AnotherMethod(){
    		System.out.println("JavaProgrammingForums.com");
    	}
     
    }

    When the Account class is run, this will be the output:

    Welcome to our BANK
    You just called the CheckingMethod method
    JavaProgrammingForums.com
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  9. #9
    Junior Member
    Join Date
    Mar 2011
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: You need help

    package Customer;
    import java.util.Scanner;
    public class Customer {
    	public static void main(String[] args) {
    		Scanner input=new Scanner (System.in);
    		int passward;
    		char name;
    		System.out.println("********************");
    		System.out.println("Welcome to our BANK ");
    		System.out.println("********************");
    		System.out.println("Entar your name:");
    		 name=input.nextline();
     
    		System.out.println("Entar your  passward:");
    	    passward=input.nextInt();
     
    	}
     
    }

    Want to know the name? How Luigi line for why??


    package Account;
    import java.util.Scanner;
    public class Account {
    	public static void main(String[] args) {
    		Scanner input=new Scanner (System.in);
    		int ch;
     
     
    		System.out.println("Welcome to our Account ");
    		System.out.println("********************** ");
    		System.out.println(" * List of Services *");
    		System.out.println("1-Account");
    		System.out.println("2- CheckingAccount");
    		System.out.println("3- SavingAccount ");
    		System.out.println("4-SuperSavingAccount");
            System.out.println("*Choose one of the following services:*");
           ch=input.nextInt();
     
    		if(ch==1) 
    		{
    		System.out.println("1-Account");
    		System.out.println("1-Account");
    		}
    		else
    		if(ch==2){
    		CheckingAccount ca = new CheckingAccount();
    		ca.CheckingMethod();
    			}
    		else
    		if(ch==3){
    		SavingAccount sa =new SavingAccount();
    		sa.SavingMethod();}
    		else
    		if(ch==4){
    		SuperSavingAccount ss =new SuperSavingAccount();
    		ss.SuperSavingMethod();
    				}
     
     
     
    	}
    }

    package Account;
     
     
    public class CheckingAccount {
     
    	public void CheckingMethod()
    	{
    		System.out.println("2- CheckingAccount");
    	}
     
     
    }

    package Account;
     
    public class SavingAccount {
    	public void SavingMethod()
    	{
    		System.out.println("3- SavingAccount ");
    	}
     
     
     
    	}

    package Account;
     
    public class SuperSavingAccount {
     
    		public void SuperSavingMethod (){
    			System.out.println("4-SuperSavingAccount");
    		}
     
     
    	}

    Do as well as the correct solution?? And I want to lay it down properties or accounts within the classses and function??

  10. #10
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Default Re: You need help

    * Model the class inheritance hierarchy: Account, CheckingAccount,
    SavingAccount, and SuperSavingAccount.
    * Model the Customer class
    * Think about the most important attributes and methods for each class.
    * Explain the relationships between the different classes.
    * Return the class diagram as part of the solution!
    Ok, I'm confused here.

    If Account is the main class, what was that about inheritance hierarchy?

    You're never extending any class, other than Object, every time.

    Are you sure you're not supposed to have an abstract class called Account and have either three subclasses (Checking, Savings, and SuperSavings), or have two subclasses and have SuperSavings be a subclass of Savings?

    Also, you seem to have name being a char variable yet reading it in as a String.

    char name;

    name = input.nextLine();