Question

Create an application that allows you to enter student data that consists of an ID number,...

Create an application that allows you to enter student data that consists of an ID number, first name, last name, and grade point average. Depending on whether the student’s grade point average is at least 2.0, output each record either to a file of students in good standing (located at StudentsGoodStanding.txt) or those on academic probation (located at StudentsAcademicProbation.txt). Enter ZZZ to Quit. This is in Java

0 0
Add a comment Improve this question Transcribed image text
Answer #1
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

public class StudentsStanding {

    //main method
    public static void main(String[] args) throws IOException {
        //scaner object to read input from user
        java.util.Scanner Sca = new java.util.Scanner(System.in);
        File GoodFile=new File("StudentsGoodStanding.txt");
        File ProbFile=new File("StudentsAcademicProbation.txt");
        FileWriter fp1 = new FileWriter(GoodFile);
        FileWriter fp2 = new FileWriter(ProbFile);
        String NameFirst;
        String NameLast;
        int Stud_ID;
        double Grad_Avg;
        String tempStr1 = "", tempStr2 = "";
        while(true){
            System.out.println("Enter the student ID: ");
            Stud_ID = Sca.nextInt();
            System.out.println("Enter the First Name: ");
            NameFirst = Sca.next();
            System.out.println("Enter the Last Name: ");
            NameLast = Sca.next();
            System.out.println("Enter the Grade average: ");
            Grad_Avg = Sca.nextDouble();
            if(Grad_Avg >= 2.0){
                tempStr1 = tempStr1 + Stud_ID +"\t"+NameFirst+"\t"+NameLast+"\t"+Grad_Avg+"\n";
            }
            else{
                tempStr2 = tempStr2 + Stud_ID +"\t"+NameFirst+"\t"+NameLast+"\t"+Grad_Avg+"\n";
            }
            System.out.println("Enter ZZZ to Quit OR press any key to continue");
            String MyChoice = Sca.next();
            if("zzz".equalsIgnoreCase(MyChoice)){
                fp1.write(tempStr1);
                fp1.flush();
                fp1.close();
                fp2.write(tempStr2);
                fp2.flush();
                fp2.close();
                System.out.println("Data stored in File");
                break;
            }
        }

    }

}

Add a comment
Know the answer?
Add Answer to:
Create an application that allows you to enter student data that consists of an ID number,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Create an application that allows you to enter student data that consists of an ID number,...

    Create an application that allows you to enter student data that consists of an ID number, first name, last name, and grade point average. Depending on whether the student’s grade point average is at least 2.0, output each record either to a file of students in good standing (located at StudentsGoodStanding.txt) or those on academic probation (located at StudentsAcademicProbation.txt).

  • Create a class named Student, where each Student consists of a student id (a number between...

    Create a class named Student, where each Student consists of a student id (a number between 0 and 99999), grade level (1-12), and a full name. Include set and get methods for all fields. Save this as Student.java. Then, write an application that declares a Student object and prompts the user for the three required pieces of information, one at a time. For student id, keep prompting until the user enters a valid number (0-99999). Likewise, keep prompting for a...

  • Java - In NetBeans IDE: • Create a class called Student which stores: - the name...

    Java - In NetBeans IDE: • Create a class called Student which stores: - the name of the student - the grade of the student • Write a main method that asks the user for the name of the input file and the name of the output file. Main should open the input file for reading . It should read in the first and last name of each student into the Student’s name field. It should read the grade into...

  • Shell Programming USA College wants you to create a simple application. The program will enter the...

    Shell Programming USA College wants you to create a simple application. The program will enter the student name, student id, Student Level, Enter the marks for four (4) courses. Calculate the total marks and the SGPA. If the SGPA less than 2.0 then students will enter into probation.display the appropriate output.

  • Graded Exercise Create a class named Student. A Student has fields for an ID number, number...

    Graded Exercise Create a class named Student. A Student has fields for an ID number, number of credit hours earned, and number of points earned. (For example, many schools compute grade point averages based on a scale of 4, so a three-credit-hour class in which a student earns an A is worth 12 points.) Include methods to assign values to all fields. A Student also has a field for grade point average. Include a method to compute the grade point...

  • In Java, Please do not forget the ToString method in the Student class! In this exercise,...

    In Java, Please do not forget the ToString method in the Student class! In this exercise, you will first create a Student class. A Student has two attributes: name (String) and gradePointAverage (double). The class has a constructor that sets the name and grade point average of the Student. It has appropriate get and set methods. As well, there is a toString method that prints the student's name and their grade point average (highest is 4.0) You will then write...

  • In JAVA please! Write program for exercises You will write a Graphical User Interface(GUI) application to manage student...

    In JAVA please! Write program for exercises You will write a Graphical User Interface(GUI) application to manage student information system. The application should allow: 1. Collect student information and store it in a binary data file. Each student is identified by an unique ID. The user should be able to view/edit an existing student. Do not allow student to edit ID. 2. Collect Course information and store it in a separate data file. Each course is identified by an unique...

  • Language: C++ Write a program that will allow the instructor to enter the student's names, student...

    Language: C++ Write a program that will allow the instructor to enter the student's names, student ID, and their scores on the various exams and projects. A class has a number of students during a semester. Those students take 4 quizzes, one midterm, and one final project. All quizzes weights add up to 40% of the overall grade. The midterm exam is 25% while the final project 35%. The program will issue a report. The report will show individual grades...

  • Java This application will be menu driven. The application should allow: 1. Collect student information and...

    Java This application will be menu driven. The application should allow: 1. Collect student information and store it in a binary data file. Each student is identified by an unique ID.   The user should be able to view/edit an existing student. Do not allow the user to edit student ID. 2. Collect Course information and store it in a separate data file. Each course is identified by an unique ID. The user should be able to view/edit an existing course...

  • Write the program WritePatientRecords that allows a doctor’s staff to enter data about patients and saves...

    Write the program WritePatientRecords that allows a doctor’s staff to enter data about patients and saves the data to a file called Patients.txt. The output should be in the following format: p#, PATIENT_NAME, BALANCE. Create a Patient class that contains fields for ID number, name, and current balance owed to the doctor’s office. Save the contents of your output file as you will use them in the subsequent labs. An example of the program is shown below: Enter patient ID...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT