Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Please help!!

  1. #1
    Junior Member
    Join Date
    Jun 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Please help!!

    Hey guys,
    was just wondering if anyone would be able to help me out with this question - im a complete beginner to this whole java subject:

    Techno-Tech is a small private college running various diploma courses. Currently, the college consolidates all their results manually.
    You have been called as an IT consultant who can help them create a small JAVA program that will help their teachers consolidate the results and grade their students. Currently, the college does not have any database server and is not interested in buying one in near
    future. You are required to create a JAVA program using flat files only.

    1. College Requirements:

    The requirements of your program are given below:
    --> Each student is enrolled in 4 subjects where they have already got the marks.

    -->The eacher can add new student that get saved into file, delete a students that will be
    deleted from the file.

    -->The teacher will be able to generate the result on the basis of the following grading rules:
    Marks (Total of Marks1, marks2 and marks2) > 85% - Grade “HD”
    Marks (Total of Marks1, marks2 and marks2) 70 – 85% - Grade “D”
    Marks (Total of Marks1, marks2 and marks2) 60 – 69% - Grade “C”
    Marks (Total of Marks1, marks2 and marks2) 50 – 59% - Grade “P”
    Marks (Total of Marks1, marks2 and marks2) <50% - Grade “F”

    2. Required Technical Solution:

    Write a JAVA program that will allow the teachers to use your program and generate
    the results of their students. Your JAVA program is console based program that will
    ask the teacher to select from the following options:
    1. Create Students file
    2. Add new student to file
    3. Delete a student from file
    4. Print Grades
    5. Exit.

    When teacher creates a new student the details of the student and the marks are taken as user input from the teacher.
    You will need to do a complete exception handling and data validations for this
    program so get the validated data for your program



    HERE's WHAT i have so far: (for part 2.)

     public source;
    import java.io.ObjectInput;
     
    public class Question2() {
     
     
    	public Object;
     
    	public class student {
    		private static final String System = null;
    		private int input;
    		public void menu() {
    			//print the menu
    	 		System.out.println("1. Create Student file");
    	 		System.out.println("2. Add New Student file");
    	 		System.out.println("3. Delete Student file");
    	 		System.out.println("4. Print Grades");
    	 		System.out.println("5. Exit");
     
    			//get input
    	 		input = keyboard.nextInt();
    			// process the input and invoke the method required
    	 		switch (input) {
    	 		case 1:  //call the method to create student file
    	 			break;
    	 		case 2: //call the method to add a new student to file 
    	  			break;
    	 		case 3: // call the method to delete a student from file
    	 			break;
    	 		case 4: // call the method to print grades
    	 			break;
    	 		case 5: // call the method to exit
    		}
     
    	}
    	public  void createFile() {  		//creating the file
    	 	String filename;
    	 	System.out.println("Enter a filename");
    	 	filename = new keyboard.next();
    	 	FileoutFile = new File(filename);
    	 	FileoutputStream outStream = new FileOutputStream(outFile);
    	 		outObjectStream.close();
    	 }	
    	public void addToFile() {
    	 	String filename;
    	 	System.out.println("Enter a filename");
    	 	filename = new keyboard.next();
    	 	//ensure that file existed otherwise call method createFile
    	 	//get input for student and marks
    	 	FileWriter fileWriter = new FileWriter(filename,true);       //append to the file, false will replace
    	 	BufferedWriter  bufferWriter = new BufferedWriter(fileWriter);
    	 	bufferWriter.write(student);
    	 	bufferWriter.close();
    	}
    	public void deleteFile() {
    	String filename;
    	System.out.println("Enter a filename");
    	filename = new keyboard.next(); 
     
    	//method to delete a student
    	//get the filename in which the student record is going to be deleted from file
    	//get input which student to delete
    	//read file and in an array
    	//loop through the array
    	//search the student in the array
    	//if not the student to be deleted, write to file
     
    	//method to print grade
    	//get the filename
    	// read file and calculate the average mark
    	//use if statements to figure out the letter grade and print to console
    	public void 
    	 	File;outfile = new File(filename);
    	 	FileInputStream inStream = new FileInputStram(infile);
    	 	FileInputStream outStream = new FileOutputStream(outFile);
    	 	ObjectInputStream inObjectStream = new ObjectInputStream;

    This is what have so far, but I'm not too sure hhow to finish it. If you can help out could you please explain it as you go?


    Any help would be greatly appreciated!
    TTHANKYou so much in advance!


    ---------------------
    Last edited by javastudent4; June 16th, 2012 at 08:39 AM.

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    18,552
    Thanks
    45
    Thanked 1,953 Times in 1,927 Posts

    Default Re: Please help!!

    Please Edit your post and wrap your code with[code=java]<YOUR CODE HERE>[/code] to get highlighting

    not too sure hhow to finish it
    Can you explain what your problems are with finishing the code? What has been coded, compiled and tested and what needs to be done.
    If you don't understand my answer, don't ignore it, ask a question.

Tags for this Thread