User Profile

Collapse

Profile Sidebar

Collapse
ccarter45
ccarter45
Last Activity: Mar 27 '08, 11:03 AM
Joined: Mar 1 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • How to reformat a phone number (string) to (###) ###-####?

    I really need help with this. Your tips are greatly appreciated:
    Code:
     import java.util.Scanner;
    
    public class PhoneNumbers
    {
     public static void main(String[] args){
        Scanner input;
    
           Scanner scan = new Scanner(System.in);//get user input
       
           System.out.print( "Please enter a phone number:");
        
           String word = scan.nextLine();
    ...
    See more | Go to post

  • ccarter45
    started a topic Password problem help! URGENT!!!
    in Java

    Password problem help! URGENT!!!

    I'm new to java and writing a program that accepts user input for a password and it has to meet the following requirements:
    1. At least 6 characters long.
    2. Leading character can't be a digit.
    3. Password must have at least 1 digit.
    4. Password must have at least 1 upper case letter.
    The main method will keep asking the user for a password (using a while loop) until it gets one that's okay.
    The other method...
    See more | Go to post

  • What's wrong with my code? Counting letters in a string

    I need to count the number of letters in a string, disregarding case. It needs to use these two methods. What's wrong?
    Code:
    import java.util.Scanner;
    
    public class CountLetters
    {
      public static void main(String[] args)
      {
        Scanner input;
    
        input = new java.util.Scanner(System.in);
      
      String s;
      int count = 0;
        
        
        System.out.print(
    ...
    See more | Go to post

  • How to Read/Write image files? compute differences in 2 pictures...

    I need to compute the differences in color between 2 pictures. Also, I need to write a method that computes a useful difference color of two colors (where the colors and their difference will be represented as single int's). The formula you should use for colordiff, the difference color between color1 and color2, with color1 = (R1, G1, B1) and color2 = (R2, G2, B2) is as follows:
    colordiff = (Rdiff, Gdiff, Bdiff) where
    Rdiff = |R1-R2|...
    See more | Go to post

  • ccarter45
    started a topic SNAKES ON PLANE program help!!!
    in Java

    SNAKES ON PLANE program help!!!

    Okay, so I need to write this program that first declares an array and inputs the number of each snake present on a plane (there are 5 diff. snakes). Next, it must print out the number of each snake: "The number of snakes in element 1 is: 7." I also need to make sure that no snakes escape the cart they are stored on on the plane. To keep them contained, the combined weight of the number of carryon pieces in front of the cart door must be...
    See more | Go to post

  • ccarter45
    started a topic Reading and Writing a Text File???
    in Java

    Reading and Writing a Text File???

    Help! I need to write a program that reads a text file with numbers and sums up each line of numbers. Then write a part of the program that outputs the text to another file. How do I do this?
    Here's what the data file looks like:
    1 2
    2 3
    3 4
    4 5
    5 6
    Here is the code I have:
    Code:
    import java.util.Scanner;
    import java.io.File;
    import java.io.PrintWriter;
    
    public
    ...
    See more | Go to post

  • ccarter45
    started a topic how to sum values in columns in a 2D array?
    in Java

    how to sum values in columns in a 2D array?

    Code:
    public class SumColumn 
    {
      public static void main( String[] args ) 
      {
        int[][] grid = {{1, 2, 3}, {4, 5, 6}}; // array initializer for 2D array
        
        print2DArray("The array is: ", grid);
        
        sumColumn(grid);// write method call to sumColumn here
      }
       
      // print out a 2D array
      public static void print2DArray( String message, int[][] a
    ...
    See more | Go to post

  • ccarter45
    started a topic SEATING CHART java program help?
    in Java

    SEATING CHART java program help?

    I need to write a program that goes through a seating chart row by row and find n consecutive seats in a row. If the seating charts has seats available, it must print out the message saying in what row and what seats. If there are no seats available, it must return the message: "There's no group of seats to satisfy your request." It must also print out the seating chart I need help on how to find the n consecutive seats and find the row...
    See more | Go to post

  • ccarter45
    started a topic How to PRINT OUT THE MENU in the code (methods)?
    in Java

    How to PRINT OUT THE MENU in the code (methods)?

    What am I missing?
    Code:
    import java.util.Scanner;
      
    public class MathTutor
    {
      public static void main( String[] args ) 
      {  
        int choice;
        
        choice = printMenu();
        while (choice != 4)
        {
          if ( choice == 1 )
            additionTutor();
          else if ( choice == 2 )
            substractionTutor();
          else if ( choice == 3 )
    ...
    See more | Go to post

  • Desperately need help with this HW problem on methods!

    I guess I really don't have a good understanding of methods, it's really confusing for me. I'm not asking anyone to solve this for me, but any help would be GREATLY appreciated. This is the assignment:

    Method getIntBetween that gets user input for an integer within certain range. It receives a string, message, to be printed out as the prompt message, and two integer min and max that indicate the desired range of the input. It error-checks...
    See more | Go to post
No activity results to display
Show More
Working...