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
Expressions provide an easy way to perform operations on data values to produce other data values. True False
Papessa [141]

Expressions provide an easy way to perform operations on data values to produce other data values, True.

<h3>What is an Expression? </h3>

An expression is a combination of one or more operands (Constant, Variable, Array element, Function), operators(Multiplication,Division, Subtraction etc) to be interpreted by a programming language following rules of precedence or association to produce other data values.

Three kinds of expressions includes:

  • An arithmetic expression

  • A character expression

  • A logical or relational expression

Therefore, it is true that Expressions provide an easy way to perform operations on data values to produce other data values.

6 0
2 years ago
Is 37 words per minute when typing an okay grade?
Olegator [25]
It is okay but you should be able to type up to 60+ words per minute and keep doing that to practice then if you can get into a typing class.
4 0
3 years ago
Read 2 more answers
Apache web server is the most widely used network operating system used on web servers.
Zarrin [17]
The statement that Apache web server is the most widely used network operating system used on web servers is true. This server runs on <span>67% of all webservers in the world</span>
The Apache web server is a free and open-source cross-platform HTTP Server,<span> developed and maintained by </span>Apache Software Foundation.
7 0
2 years ago
Read 2 more answers
Which tcp/ip troubleshooting command should you use to determine whether a client and server are communicating with each other?
sesenic [268]
The answer is <span>The ping command.   The </span><span>tcp/ip troubleshooting command you should  use to determine whether a client and server are communicating with each other is The ping command.  </span><span>The </span>ping command<span> is used to verify that a device can communicate with another on a network.</span>
5 0
2 years ago
Danica now wants to add a picture of her cookies to her flyer.
gavmur [86]

Answer:

C for Edgenuity

Explanation:

-Ted from Ted Talk

6 0
3 years ago
Read 2 more answers
Other questions:
  • The ____ operation is used to add an element onto the stack.
    15·1 answer
  • Write a paragraph on the orgin or development of ONE of the following elementss of the Internet:
    15·1 answer
  • Find a, b, and c<br> A a=4 square root of 6 b= 8 square root of 2 ; c= 4 square root of 2
    12·1 answer
  • Using the _____ model brings sellers and buyers together on the web and collects commissions on transactions between these parti
    5·1 answer
  • All animations on the world wide web are flash animations
    11·2 answers
  • Bran is writing a book on operation system errors. Help him complete the sentences.
    7·1 answer
  • Please answer this correctly what’s the answer opening modify style dialog box enables you to
    8·1 answer
  • Given two int variables , firstplacewinner and secondplacewinner, write some code that swaps their values . declare any addition
    11·1 answer
  • Presentation graphics programs contain an assortment of tools and operations for creating and editing slides, including preforma
    8·2 answers
  • You are a Data Scientist at Anthem Blue Cross Blue Shield. You want to check if a patient will develop diabetes. Please write th
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!