Java

Moderators: zibadian
Number of threads: 7836
Number of posts: 18235

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Adding sorted data to info string. Posted by UNF_Steph on 28 Nov 2010 at 4:25 PM
if (event.getActionCommand()=="Write")
			//assign empty value to info string variable 
			writeFile = "";
			//start try block
			try{
				// Set up the output file stream
				PrintWriter outFile = new PrintWriter(new PrintStream(new File("GradeReport.txt")));
				// Print a header to the output file
				outFile.printf("Student Test1 Test2 Test3 Test4 Test5 Average Grade%n");			
				// for each value in the gradeList arraylist, add the sorted student data (first name, last name, grade) to the info string variable with separated value.
				for(int c = 0; c < 15; c++)
					     {
						   outFile.printf("%s%t", gradeList.add(fname);
						    for(int s = 0; s < 5; s++)
						 {
						   outFile.printf("%5d%t", gradeList.add(assn);
						          }
						   outFile.printf("%7.2f%t", gradeList.add(avg);
						   outFile.printf("%5c%n", gradeList.add(grade);
						        }



I'm pretty sure I'm not even close but I am getting add errors in the add method.
Report
Re: Adding sorted data to info string. Posted by manloo on 29 Nov 2010 at 3:02 AM
In your code there seem to be methods which you did not show how they work, but to make it easier for me to help;
Can you briefly explain what you want to achieve; i.e. describe the format of the inputs required by your program and also describe the desired output. Just make a description in words. This will make it easier to forward a working example.
Report
Re: Adding sorted data to info string. Posted by UNF_Steph on 6 Dec 2010 at 10:01 PM
Ooopps! I'm sorry.

Here is the instructions.

Write a GUI application that will read student scores, calculate student grade, sort student data, and write output into a text file. Application should provide an option for user to upload a text file containing student course data such as first name, last name, and five assignment scores. Program will ask user to browse and select a file. Program should then determine each student grade (see below for grade scale). Application should provide an option to sort the student data including their grade based on their last name. Application should provide an option to produce an output text file, named as “GradesReport.txt”. Output file should contain list of student names (first and last) and their grade.

Following is the student input data (see Grades.txt)

Björn Borg 90 78 82 84 92
Leander Peas 98 81 86 97 89
Gabriela Sabatini 68 60 84 91 99
Andre Agassi 61 68 86 83 80
Vijay Amritraj 63 62 76 85 87
Venus Williams 55 69 100 67 70
James Blake 83 80 83 78 65
Melanie Oudin 16 58 64 23 89
Roger Federer 60 68 98 91 84
Maria Sharapova 65 65 67 81 75
Sania Mirza 85 88 92 94 98
Mario Ancic 26 49 28 15 44
Zheng Jie 83 62 86 89 70
Boris Becker 82 81 60 32 92
Pete Sampras 62 73 72 66 74

The program should compute the course grade for each student based on below:
90.0 - 100=A
80.0 - 89.9=B
70.0 - 79.9=C
60 - 69.9=D
less than 60=F




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.