1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Lunna [17]
3 years ago
14

Part 1: Create an application that allows you to enter student data that consists of an ID number, first name, last name, and gr

ade 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 or those on academic probation. Save the program as StudentStanding.java.
Part 2: Create an application that displays each record in the two files created in the StudentStanding application. Display a heading to introduce the list produced from each file. For each record, display the ID number, first name, last name, grade point average, and the amount by which the grade point average exceeds or falls short of the 2.0 cutoff. Save the program as StudentStanding2.java.
Computers and Technology
1 answer:
aleksley [76]3 years ago
6 0

<u>PART A</u>

import java.io.*;

import java.util.Scanner;

public class StudentsStanding {

   private static final double CUT_OFF = 2.0;

   public static void main(String[] args)

   {

       try {

           PrintWriter goodFile = new PrintWriter(new FileWriter("goodStanding.txt"));

           PrintWriter probationFile = new PrintWriter(new FileWriter("probation.txt"));

           char choice;

           String firstName,lastName;

           Scanner input = new Scanner(System.in);

           int id;

           double gradePoint;

           do {

               System.out.print("Enter student Id: ");

               id = input.nextInt();

               input.nextLine();

               System.out.print("Enter First name: ");

               firstName = input.nextLine();

               System.out.print("Enter last name: ");

               lastName = input.nextLine();

               System.out.print("Enter grade point: ");

               gradePoint = input.nextDouble();

               if(gradePoint<CUT_OFF)

                   probationFile.println(id+","+firstName+","+lastName+","+gradePoint);

               else

                   goodFile.println(id+","+firstName+","+lastName+","+gradePoint);

               System.out.print("Do you want to continue..(y/n): ");

               choice = input.next().toLowerCase().charAt(0);

           }while (choice!='n');

           //close the streams

           goodFile.close();

           probationFile.close();

       }

       catch (IOException ex)

       {

           System.err.println("IO Exception occurs...");

       }

   }

}

<u>PART 2</u>

import java.io.File;

import java.io.FileNotFoundException;

import java.util.Scanner;

public class StudentsStanding2 {

   private static final double CUT_OFF = 2.0;

   public static void main(String[] args)

   {

       String header = "ID\t"+"First Name"+"\t"+"Last Name"+"\t"+"Grade Point"+"\t"+"Exceeds/Fall\n";

       try {

           Scanner probationFile= new Scanner(new File("probation.txt"));

           Scanner goodFile = new Scanner(new File("goodStanding.txt"));

           System.out.println("Cut Off is: "+CUT_OFF);

           System.out.println(header);

           double point ,exceed;

           while (probationFile.hasNextLine())

           {

               String[] tokens = probationFile.nextLine().split(",");

               point = Double.parseDouble(tokens[3]);

               exceed = CUT_OFF-point;

               System.out.println(String.format("%4s %7s %10s %10s %10s",tokens[0],tokens[1],tokens[2],point,String.format("%.2f",exceed)));

           }

           //Close the stream

           probationFile.close();

           while (goodFile.hasNextLine())

           {

               String[] tokens = goodFile.nextLine().split(",");

               point = Double.parseDouble(tokens[3]);

               exceed = point - CUT_OFF;

               System.out.println(String.format("%4s %7s %10s %10s %10s",tokens[0],tokens[1],tokens[2],point,String.format("%.2f",exceed)));

           }

           goodFile.close();

       }

       catch (FileNotFoundException ex)

       {

           System.err.println("File not found!!!");

       }

   }

}

You might be interested in
Debevec mentions using the technology he described to animate entire human bodies. Discuss why you think this is or is not a goo
snow_tiger [21]

Answer:

Debevec is using the light of his team because this and that and because it’s manipulated

Explanation:

8 0
2 years ago
A developer of a relational database refers to a file as a
goldenfox [79]
This is the correct Answer    <span>Attribute</span>
5 0
2 years ago
How do mark somebody as brainliest??
svet-max [94.6K]

Answer:

Once more that one person answer, you will get an option next to the heart and the star that would look like a crown

Explanation:

That is how you do it.

4 0
2 years ago
Anyone got E-aqa login?​
pashok25 [27]

Answer:no

Explanation:

3 0
2 years ago
Write a function named ilovepython that prints out I love Python three times. Then, call that function.
Brums [2.3K]

Answer:

The program to this question can be described as follows:

Program:

def ilovepython(): #defining a method

   for i in range(3): #defining a loop that print messasge three times

       print('I love Python')#print messasge

ilovepython() #calling the method

Output:

I love Python

I love Python

I love Python

Explanation:

Description of the python program can be described as follows:

  • In the above Python program, a method "ilovepython" is defined, inside the method a for loop is used, inside the loop print method is used, that print the message "I love Python".
  • In python for loop is used to iterate over series and we can execute a set of statements with the loop, tuple, series, once for each element in the list.
8 0
2 years ago
Other questions:
  • What is are example of an engineered item?
    12·1 answer
  • Which is NOT a type of SD card?
    8·2 answers
  • What are the key goal, performance, and risk indicators?
    15·1 answer
  • Allie needs to add a long row of numbers. She should enter a
    13·2 answers
  • nside of your organization that checks how often client machines access it. If a client machine hasn't accessed the server in th
    6·1 answer
  • What should be included in the closing portion of your letter or e-mail?
    12·2 answers
  • Create a class named CarRental that contains fields that hold a renter's name, zip code, size of the car rented, daily rental fe
    13·1 answer
  • Where is the "delete account" button in my profile? And please give me a legit answer and not just a word.
    10·2 answers
  • Write a function that will sum all of the numbers in a list, ignoring the non-numbers. The function should takes one parameter:
    8·1 answer
  • a company recently implemented a secure sockets layer/transport layer security (ssl/tls) version that supports secure hashing al
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!