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]
4 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]4 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
what is the definition of web search(ing)? when I look it up it keeps trying to give me definitions for search engines but that'
AysviL [449]

Answer:

Web searching is when one types keywords into a search engine to retrieve data.

You're welcome.

6 0
4 years ago
Read 2 more answers
_____ is a system in which a finite set of words can be combined to generate an infinite number of sentences.
Sedbober [7]

Generativity is a system in which a finite set of words can be combined to generate an infinite number of sentences.

<h3>What is a sentence?</h3>

A sentence is a grouping of words, phrases, or clauses that convey meaning to us. An object or a subject can be found in a sentence. These help the person to communicate with one another.

Generativity can be defined as the way to weigh A grammar or a sentence being spoken for. It is defined as a found set of the whole with is defined, usually made with a finite number, to create an infinite number of sentences or words combined.

Learn more about sentences, here:

brainly.com/question/12684453

#SPJ1

8 0
1 year ago
An attacker obtains a connection to your LAN and then uses SETH to perform a MiTM attack between your system and the company RDP
maxonik [38]

The type of attack which has occurred in this scenario is known as credential harvesting.

<h3>What is credential harvesting?</h3>

Credential harvesting is also known as account harvesting and it can be defined as a type of attack that involves the use of the following techniques to illegally obtain large numbers of user credentials (username or password):

  • MITM attacks
  • DNS poisoning
  • Phishing

In conclusion, the type of attack which was used in this scenario is known as credential harvesting.

Read more on phishing here: brainly.com/question/23850673

#SPJ1

3 0
2 years ago
Which protocol sends a request to view or download a website or file ​
Paul [167]
The answer is HTTP protocol
5 0
4 years ago
Printed versions of your presentation that contain the slides and blank lines below are called speakers notes
Vadim26 [7]

No, printed versions of your presentation that contain the slides and blank lines below are not called speakers notes.

Speakers notes are notes that are hidden within a PowerPoint presentation and allowing the speaker to refer back to them during the presentation.

6 0
4 years ago
Read 2 more answers
Other questions:
  • The dashed lines that display on your slide when you are moving an object are
    10·1 answer
  • WILL MARK BRAINLIEST IF ANSWERED ASAP
    10·1 answer
  • Hello... does anyone know why Brainly notifications aren’t working???
    11·2 answers
  • Assume that an array named salarySteps whose elements are of type int and that has exactly five elements has already been declar
    11·1 answer
  • Fill in the blanks of the SQL Statements: Fund_Id VARCHAR(10) , Donor_id VARCHAR(10) , Count_Of_Receipts INTEGER, Total_Receipts
    15·1 answer
  • Pls help with this (20 points again)
    8·1 answer
  • The I/O modules take care of data movement between main memory and a particular device interface.A. TrueB. False
    9·1 answer
  • The following method is intended to remove all values from the ArrayList a that have the same value as val; however, this method
    8·1 answer
  • Wake up to reality. Nothing ever goes as planned in this world. The longer you live,the more you realize that only pain, sufferi
    5·1 answer
  • What solicits online input such as product ratings from consumers?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!