topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday April 26, 2024, 8:03 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - jabborwoc [ switch to compact view ]

Pages: [1]
1
General Software Discussion / Re: Java code help
« on: April 17, 2011, 03:39 PM »
---------- Capture Output ----------
> "C:\Program Files\Java\jdk1.6.0_23\bin\java.exe" PassArg4
The values are 25, 50000.0 ,  and T

> Terminated with exit code 0.

see is should have 50000.00  , why doesn't it???

2
General Software Discussion / Re: Java code help
« on: April 17, 2011, 03:19 PM »
ok its working now butr it dsiplays 50000.0   <-- thats odd why wont is show 50000.00   ???
// A programs contains the following method:
//public static void display(int arg1, double arg2, char arg3)
//{
// System.out.println("The values are " + arg1 + ", " +
//arg2 + ", and " + arg3);
//}
//Write a statement that calls this method and passes the following varibles as arguements:
//char initial = 'T';
//int age = 25;
//double income = 50000.00


public class PassArg4
{
   public static void main(String[] args)
   {
    
  char initial = 'T';
     int age = 25;
     double income=50000.00;
     display(age, income, initial);

    
     }


// A programs contains the following method:
public static void display(int arg1, double arg2, char arg3)
{
System.out.println("The values are " + arg1 + ", " +
arg2 + " ,  and " + arg3);
}
// Write a statement that calls this method and passes the following varibles as arguments:
// char initial = 'T';
// int age = 25;
// double income = 50000.00
}
Why does it just show 50000.0       <------?
instead of 50000.00    <-- everything else is right

3
General Software Discussion / Java code help
« on: April 17, 2011, 01:34 PM »
I am probably way off
// A programs contains the following method:
//public static void display(int arg1, double arg2, char arg3)
//{
// System.out.println("The values are " + arg1 + ", " +
//arg2 + ", and " + arg3);
//}
//Write a statement that calls this method and passes the following varibles as arguements:
//char initial = 'T';
//int age = 25;
//double income = 50000.00

public class PassArg4
{
   public static void main(String[] args)
   {
       
     System.out.println("I am passing values to displayValue.");
           
      System.out.println("Now I am back in main.");
   
  }
       
   public static void display(int arg1, double arg2, char arg3)
   
   {
    int arg1 = 25;
    double arg2 = 50000.00;
    char arg3 = 'T';
 
    display(arg1, arg2, arg3);
    System.out.println("the values are " + arg1 + ", " +
    arg2 + ", and " + arg3);
   
   System.out.println("The values are  " + arg1 + ", " +
    arg2 + ", and " + arg3);
   }
}

4
General Software Discussion / Re: java help
« on: April 03, 2011, 04:34 PM »
it just needs to count the number of times a specified letter occurs in a specified file :tellme:

5
General Software Discussion / java help
« on: April 03, 2011, 03:33 PM »
Java help open user spec file , count user spec character,
Code: Java [Select]
  1. import java.util.Scanner;
  2. import java.io.*;
  3. public class progChal6
  4.  {
  5.    public static void main(String[] args) throws IOException
  6.    {
  7.      
  8.      //needed for scanner class
  9.       Scanner kb = new Scanner(System.in);
  10.       String filename;   // file name
  11.       int charCount = 0;
  12.      
  13.       // get users filename
  14.       System.out.print("Enter the file name:  ");
  15.       filename = kb.nextLine();
  16.       Scanner inputFile = new Scanner(filename);
  17.       // get users character
  18.       System.out.print("Please enter a character: ");
  19.       char userChar = kb.nextLine().charAt(0);
  20.       // tell the user what the program does
  21.       System.out.println("\n****This program will return how many times" +
  22.                           " the character you entered showed up in" +
  23.                           " the string you entered.****");
  24.                      
  25.       while(inputFile.hasNext()) ;
  26.       {
  27.                (filename.charAt() == userChar);
  28.                   {
  29.                   charCount++;
  30.                   }
  31.       }
  32.       System.out.println("\nThe specified character " +"\"" + userChar +
  33.                           "\" is inside the string " + filename +
  34.                           " " + charCount +   " times.\n");            
  35.     inputFile.close();
  36.     }
  37. }

Pages: [1]