# mike statham

Greenhorn
since Feb 24, 2012
For More
Cows and Likes
Cows
0
In last 30 days
0
Total given
0
Likes
0
0
Total given
3
Given in last 30 days
0
Scavenger Hunt
Ranch Hand Scavenger Hunt
Greenhorn Scavenger Hunt

## Recent posts by mike statham

That's correct......The file is there with nothing in side......
8 years ago
Yes sorry it does repeat for other files, Problem is that it doesn't print to the file at all

8 years ago
I'm trying to figure out why this will not actually print to the file
Any help would be appreciated

8 years ago

Guess overthinking the problem was my biggest problem. I just figured it was something more complex.

Thanks for the information.

8 years ago
No I have no restrictions on this exercise. I wrote the program last week and got 18 out of 25, miss putting a priority to the right level and this part.
I originally printed out "AA thru BB" 6 times instead of what I need now.
8 years ago

Which produces:
1 thru 1
2 thru 2
3 thru 3
4 thru 4
5 thru 5
6 thru 6

I've search the wrong books or what to search on the net to figure away or how to the following output:
1 thru 10
11 thru 20
21 thru 30
31 thru 40
41 thru 50
51 thru 60

Can some one give a clue or a place to look, driving me nuts
8 years ago
I have the following code but need to read from a file

10 years ago

output is:
How many tickets would you like?
5

Ticket 1: 1 30 38 39 45 14
Ticket 2: 35 3 42 18 40 2
Ticket 3: 27 7 19 40 25 35
Ticket 4: 34 17 0 4 38 33
Ticket 5: 14 6 5 46 48 1

The following is my requirements:
•Each row is called a "play." The plays are lettered A, B, C, etc.
•There are always an even number of plays on a ticket. (Lotto tickets cost \$1 for two plays)
•Each play has the following characteristics
•There are 6 randomly selected integers
•The integers are from 1 through 44
•Integers may not be repeated
•Integers are sorted from smallest to largest on each line
•Integers are always shown as 2 digits. If the number is less than 10, a leading zero is printed.
•There are a maximum of 10 plays per ticket. (A - J)

Your program should begin by asking the user to enter an even number of plays. The program should do "input validation" and not let the program continue until the user enters an even number. The minimum requirement for this program only requires you to pick numbers up to 10.
10 years ago
Here is my code below

My problem is that the current print out to my file is:
*
**
***
****
*****
******
*******
********
*********
**********
*********
********
*******
******
*****
****
***
**
*
*

***

*****

*******

*********

***********

@

@@@

@@@@@

@@@@@@@

@@@@@@@@@

@@@@@@@

@@@@@

@@@

@

My quest is there a way to display it so that they are side by side with space between them?

11 years ago

Michael Dunn wrote:at the moment you're using a bunch of System.out.println's to print:

Total number of excuses: 264
The Excuse Water spilled on it had the max numer of excuses
The Excuse A tornado got it had the min numer of excuses

Excuse name # of excuses
My dog ate it 15
It burned 12
I lost it 18
I ate it 23
It fell down the sewer 16
It shredded 44
I forgot it 19
I can't remember 17
Water spilled on it 0

continue with the current program, but try to print all of the above in a single println,
which would mean using a StringBuffer, or StringBuilder to create a single String of the above
so it would be
String message = [will end up as all of the above];
System.out.println(message);

now when it prints out exactly as above, you change
System.out.println(message);
to
javax.swing.JOptionPane.showMessageDialog(null,message);

Ok, I've re wrote my code, but instead of printint in a dialog box like:

Total number of excuses: 264
The Excuse Water spilled on it had the max numer of excuses
The Excuse A tornado got it had the min numer of excuses

Excuse name # of excuses
My dog ate it 15
It burned 12
I lost it 18
I ate it 23
It fell down the sewer 16
It shredded 44
I forgot it 19
I can't remember 17
Water spilled on it 0

it displays in a straight line!

12 years ago
I not or dont know how to convert to a dialog box out put print!

I need to print this information to a dialog box

Total number of excuses: 264
The Excuse Water spilled on it had the max numer of excuses
The Excuse A tornado got it had the min numer of excuses

Excuse name # of excuses
My dog ate it 15
It burned 12
I lost it 18
I ate it 23
It fell down the sewer 16
It shredded 44
I forgot it 19
I can't remember 17
Water spilled on it 0
12 years ago

Campbell Ritchie wrote:

mike statham wrote:I need to read from a file that is set up like called (filename.txt)
. . .
but I have to do it from a pane because I cannot figure out how do it easier without having to type it in from a window. . . .

What does that mean? It seems contradictory to me.

If you are reading from a file, you ought not to do it in the main method. Your main method contains 49 lines. That is 48 too many. You ought to have a method which reads from the file. Then you can create an object of a class which encapsulates the pay, tax allowance, parking tickets, etc. You are inappropriately using the static keyword for things which ought not to be static in your example.

You see the program I was given was:
Re-write programming assignment # 3 with the following exceptions:
Input file definitions:
First Name, Last Name, Hours Worked, Pay Rate, Parking Tickets
Example:
Linda Lou 45 10.50 3
Sam Martin 40 15.00 1
2. Modularize your program by sending parameters too and receiving data from at least the following 4 methods that must be invoked:
b. Calculate overtime if it exists.
d. Pay Parking tickets if needed.
3. Write results to an output file in the following pay stub format for each employee :

Sam Martin
Basic Pay \$600.00
Overtime Pay 0
Gross Pay \$600.00
State Tax Amt \$54.00
Fed. Tax Amt. \$120.00
Total Taxes \$174.00
Net Pay \$426.00
1 Parking ticket \$20
Total Pay \$406.00
12 years ago
I need to read from a file that is set up like called (filename.txt)
Linda Lou 45 10.50 3
Sam Martin 40 15.00 1
Mike darvin 56 12.75 2
jeff corbin 42 13.65 4
Joseph smith 37 15.25 5
peter thomas 52 11.35 0

but I have to do it from a pane because I cannot figure out how do it easier without having to type it in from a window.

But right now my Output file is:

null null
Basic Pay \$0.0
Overtime Pay \$0.0
Gross Pay \$0.0
State Tax Amt \$0.0
Fed Tax Amt \$0.0
Total Taxes \$0.0
Net Pay \$0.0
Parking Ticket \$0.0 Total Pay \$0.0

which should output all the files

12 years ago
I need Someone to help me or show me what I need to do for the average to print out correctly

output is:
Connie has an average grade of 85.33 You will receive a B in this class.
James has an average grade of 92.00 You will receive a A in this class.
Susan has an average grade of 52.33 You will receive a F in this class.
Jake has an average grade of 66.33 You will receive a D in this class.
Karen has an average grade of 77.33 You will receive a C in this class.
Bill has an average grade of 99.00 You will receive a A in this class.
Fred has an average grade of 85.33 You will receive a B in this class.
Cheryl has an average grade of 75.00 You will receive a C in this class.
Pam has an average grade of 65.00 You will receive a D in this class.
Steve has an average grade of 45.00 You will receive a F in this class.
John has an average grade of 86.33 You will receive a B in this class.
David has an average grade of 81.67 You will receive a B in this class.
Corina has an average grade of 91.67 You will receive a A in this class.
Delia has an average grade of 74.00 You will receive a C in this class.
Evan has an average grade of 99.00 You will receive a A in this class.

Overall Class Average is 21.67 ****HERE'S THE PROBLEM*****

The following lists the number of students earning each letter grade:

Number of A's = 4
Number of B's = 4
Number of C's = 3
Number of D's = 2
Number of F's = 2

The following program generates 3 random numbers, then averages them.

The average of 22 43 49 is 38
12 years ago