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
True or false with reason :- profit and loss account is a real account​
frosja888 [35]

Answer:

False

Explanation:

Account of expenses, losses, gains, and incomes is called the Nominal account. Profit and Loss Account contains all indirect expenses and indirect incomes of the firm. Therefore, Profit and Loss Account is a Nominal Account and not a real account.

:)

5 0
2 years ago
Observation and screening data should not influence curriculum development true or false?
Anton [14]

Answer:true

Explanation: we cant rely on computers

8 0
2 years ago
Can you guys report my last question trying not to get caught for cheating all questions please
AfilCa [17]

Answer:

Yes

Explanation:

mark as best answer please

7 0
3 years ago
What kinds of components are tangible assets?
Snezhnost [94]

Answer:

Tangible assets are physical like cash, inventory, vehicles, equipment, buildings and investments.

Explanation:

4 0
3 years ago
you are the it manager for your company. you have been asked to give the executive group the right to read, change, and assign p
inn [45]

The permission to give the executive group the right to read, change, and assign permissions to document is Give executive Change to shared permissions

<h3>What do you mean of executive?</h3>

An executive is seen as a kind of a powerful person  and they are the people that are known to be  responsible for making things go on or  run smoothly in any organization.

Therefore, The permission to give the executive group the right to read, change, and assign permissions to document is Give executive Change to shared permissions

Learn more about executive  from

brainly.com/question/838027

#SPJ1

5 0
2 years ago
Other questions:
  • What are vertical sets of cells called
    5·2 answers
  • What is the operating system?
    9·1 answer
  • Why is continual user involvement a useful way to discover system requirements? Under what conditions might it be used? Under wh
    5·1 answer
  • What is the windows server 2012 r2 feature that enables you to maintain previous versions of files on a server, so that if users
    10·1 answer
  • Which statement regarding socializers is true?
    10·2 answers
  • Several students are making presentations for a science class. The chart describes the concept that each student will present to
    10·1 answer
  • All slides in a presentation must use the same transition. True or False?
    13·2 answers
  • Write a program to create a customer bill for a company. The company sells only five products: TV, DVD player, Remote Controller
    12·1 answer
  • One key feature of malware is that it:
    13·1 answer
  • How do we make a acount
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!