Search:

Type: Posts; User: m2msucks

Search: Search took 0.31 seconds.

  1. Re: Checking whether a string is a substring of another string without using indexOf

    import java.util.*;
    import java.lang.String;

    public class CheckingSubstring2 {
    public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    System.out.print("Please...
  2. Re: Checking whether a string is a substring of another string without using indexOf

    Oh I see. I guess my code isn't working correctly. I also found out I need to put a test to make sure string2 is longer than string1. Thanks.
  3. Re: Checking whether a string is a substring of another string without using indexOf

    @Junky Thanks. I modified my code and it seems like it's working. I've tried using several different strings and they all seem to work. For some reason, I think there might still be something wrong...
  4. Checking whether a string is a substring of another string without using indexOf

    The following topic has been cross posted here.

    Write a method that checks whether a string is a substring of another string. Write a test program that prompts the user to enter two strings, and...
  5. Replies
    8
    Views
    14,481

    Re: Check Password Program

    I didn't know that before. Thanks.
  6. Replies
    8
    Views
    14,481

    Re: Check Password Program

    This topic has just been cross posted here.

    I got the code to work now.
  7. Replies
    8
    Views
    14,481

    Re: Check Password Program

    Here's a more updated version of my code:

    import java.util.*;
    import java.lang.String;
    import java.lang.Character;

    public class CheckingPassword {
    public static void main(String[] args) {...
  8. Replies
    8
    Views
    14,481

    Re: Check Password Program

    Thanks, I fixed up those parts of my code.

    Here is the updated code:

    import java.util.*;
    import java.lang.String;
    import java.lang.Character;

    public class CheckingPassword {
    public...
  9. Replies
    8
    Views
    14,481

    Check Password Program

    Some Websites impose certain rules for passwords. Write a method that checks whether a string is a valid password. Suppose the password rule is as follows:


    A password must have at least 8...
  10. Replies
    9
    Views
    2,483

    Re: Using the ArrayList Class

    Thanks. I already emailed the program to my professor so it's to late to make that change now.
  11. Replies
    9
    Views
    2,483

    Re: Using the ArrayList Class

    @Norm I didn't realize that. Thanks.

    @Squiffy Thanks. I made those changes to my code and got the right output.

    Here's the final code:

    import java.util.Date;
    import java.util.ArrayList;
    ...
  12. Replies
    9
    Views
    2,483

    Re: Using the ArrayList Class

    Instead of showing "[]", the last line should display an array that shows all the transactions.
  13. Replies
    9
    Views
    2,483

    Re: Using the ArrayList Class

    I made the changes to my code however I'm still getting the same output as before. I'm not sure why.

    Here's my revised code.

    import java.util.Date;
    import java.util.ArrayList;

    public class...
  14. Replies
    9
    Views
    2,483

    Using the ArrayList Class

    This problem wants me to use an account class from another problem and add stuff to it.

    Design a new Account class as follows:

    Add a new data field name of the String type to store the name...
  15. Replies
    16
    Views
    9,842

    Re: Designing an Account Class

    Ok I understand.
  16. Replies
    16
    Views
    9,842

    Re: Designing an Account Class

    Nevermind I got it.

    Here's the finished code:

    import java.util.Date;

    public class AccountProblem {
    public static void main(String[] args) {
    //create an instance object of class Stock...
  17. Replies
    16
    Views
    9,842

    Re: Designing an Account Class

    @mccolem I just read the whole thing and I still have no idea what to type.

    @copeg Why was ravindu's post edited? I want to know what it said.
  18. Replies
    16
    Views
    9,842

    Re: Designing an Account Class

    Yes I did. I'm guessing you are doWhile over on that forum. I fixed up my code and got it to compile.

    Here is the revised code:

    import java.util.Date;

    public class AccountProblem {
    public...
  19. Replies
    16
    Views
    9,842

    Re: Designing an Account Class

    "You attempt to access a constructor in the Account class with 3 parameters - there is no constructor of that definition."
    I'm trying to access this constructor:

    //constructor with specific id...
  20. Replies
    16
    Views
    9,842

    Designing an Account Class

    Here is my attempt:

    import java.util.Date;

    public class AccountProblem {
    public static void main(String[] args) {
    //create an instance object of class Stock
    Account myAccount =...
  21. Replies
    4
    Views
    6,073

    Re: Eliminating Duplicates in an Array

    Thanks, I fixed up that part of the code. I am able to get numbers to show up after "The distinct numbers are:". However they are not correct. I think there may be something wrong with my...
  22. Replies
    4
    Views
    6,073

    Eliminating Duplicates in an Array

    Write a method to eliminate the duplicate values in the array using the following method header:

    public static int[] eliminateDuplicate(int[] numbers)

    Write a test program that reads in ten...
  23. Replies
    7
    Views
    1,362

    Re: Using Nested Loops

    Ok thanks. I managed to fix my code and get the right output. Here it is.


    public class UsingLoops {
    public static void main(String[] args) {
    for (int line = 1; line <= 5; line++) {
    ...
  24. Replies
    7
    Views
    1,362

    Using Nested Loops

    Display the following: Using loops


    1
    21
    321
    4321
    54321
    This is my attempt.
Results 1 to 24 of 24