Questions
The program reads a text file with student records (first name, last name and grade on...

  • The program reads a text file with student records (first name, last name and grade on each line) and determines their type (excellent or ok). <--- Completed
  • Need help on this
  • Then it prompts the user to enter a command, executes the command and loops. The commands are the following:
    • "all" - prints all student records (first name, last name, grade, type).
    • "excellent" - prints students with grade > 89.
    • "ok" - prints students with grade <= 89.
    • "end" - exits the loop the terminates the program.

import java.util.Scanner;
import java.io.*;
import java.util.ArrayList;

public class Students
{
public static void main (String[] args) throws IOException
{ String first_name, last_name;
int grade, count=0;
Scanner fileInput = new Scanner(new File("students.txt"));
//Object st;
ArrayList<Student> st = new ArrayList<Student>();
while (fileInput.hasNext())
{
first_name = fileInput.next();
last_name = fileInput.next();
grade = fileInput.nextInt();

if (grade>89)
st.add(new Excellent(first_name, last_name, grade));
else
st.add(new Ok(first_name, last_name, grade));

count++;
}
  
for (int i=0; i<st.size(); i++)
{
if (st.get(i) instanceof Excellent)
st.get(i).info();
else
st.get(i).info();
}   
  
System.out.println("There are " + count + " students");
  
}
}

public class Ok implements Student
{
private String fname, lname;
private int grade;
  
public Ok(String fname, String lname, int grade)
{
this.fname = fname;
this.lname = lname;
this.grade = grade;
}

public void info()
{
System.out.println(fname + " " + lname + " "+ grade + "\t" + "ok");
}
}

public class Excellent implements Student
{
private String fname, lname;
private int grade;

public Excellent(String fname, String lname, int grade)
{
this.fname = fname;
this.lname = lname;
this.grade = grade;
}

public void info()
{
System.out.println(fname + " " + lname + " "+ grade + "\t" + "excellent");
}
}


public interface Student
{
void info();
}

In: Computer Science

create a file in java where you can store the first name, last name and the...

create a file in java where you can store the first name, last name and the grade of the student. this will repeats until the answer of the question "are you done?" is.equals (y). then write another program that you can read from this file the student's information .

I have dome most of it but my program stores only 1 student's information. WRITE IN FILE

public static void main(String[] args) {

System.out.println("Enter the file name");

Scanner keyboard=new Scanner(System.in);

String fileName= keyboard.next();

boolean done=false;

String response;

PrintWriter output=null;

try {

output=new PrintWriter(fileName);

}

catch(FileNotFoundException e) {

System.out.println ("error in " + fileName);

System.exit(0);

}

while(!done) {

//for (int i=1;i<=2;i++) {

System.out.println("first name:");

String fname= keyboard.next();

System.out.println("Last name:");

String lname=keyboard.next();

System.out.println("Grade:");

double grade=keyboard.nextDouble();

output.println(fname +" "+ lname+" " +grade);

output.close();

System.out.println("Are you done?");

}

String response1 =keyboard.next();

if (response1.equals("y"))

done=true;

}

}

READ THE FILE.

public class ReaderFile {

public static void main(String[] args) throws Exception {

System.out.println("Enter the file name");

Scanner keyboard=new Scanner(System.in);

String fileName=keyboard.next();

File file= new File(fileName);

Scanner input=null;

try {

input= new Scanner(new File(fileName));

}

catch(Exception e) {

System.out.println("Error reading the file" + fileName);

System.exit(0);

}

while(input.hasNext()) {

String fname=input.next();

String lname=input.next();

double grade=input.nextDouble();

System.out.println(fname+" "+lname+" "+grade);

}

}

}

In: Computer Science

A: Name the three types of claims. Explain the difference between claims. B: Name the four...

A: Name the three types of claims. Explain the difference between claims.

B: Name the four validities used to interrogate claims. If you were to question a study’s four validities, provide a question you might ask related to each validity.

In: Psychology

Question1: Define a class Human that contains: - The data fields "first name" and "last name"...

Question1: Define a class Human that contains: - The data fields "first name" and "last name" - A constructor that sets the first and last name to the instance variables. Create also a no-argument constructor - A getName() method which prints the first and last name Define the class Student which inherits Human and contains: - Private data field "mark" of type integer and a constructor which calls the superclass constructor Define the class Worker which inherits Human and contains: - Private date fields "wage" and "hours worked", and a constructor which calls the superclass constructor - A setWageInfo() method which sets the wage information to the instance variables - A calculateWage() method which calculates a worker’s salary based on wage and hours worked Write a program called HumanTest that instantiates two Human objects (one using the noargument constructor and another using the constructor with parameters). Call the method getName(). Create a Student object which calls the getName() method. Create a Worker object which calls the methods getName(), setWageInfo(), and claculateWage().

In: Computer Science

A) DDL For Company DB Schema, Answer the below questions: Emp (Empno, Ename, Job, Hiredate, Sal,...

A) DDL

For Company DB Schema, Answer the below questions:

Emp (Empno, Ename, Job, Hiredate, Sal, Comm, Deptno)

Dept (Deptno, Dname, loc)

1. Retrieve the data of all employees.

2. Retrieve the data of all Salemanemployees.

3. Retrieve the name and Salary of all employees.

4. Retrieve the name and salary of Salemanemployees.

5. Retrieve the name and salary of all employees with Salary more than 2000.

6. Retrieve the Name and Salary of all employees who work in department no 20.

7. Retrieve the name and Job of all employees with Salary more than 2000 and hiredate after 01-01-1981.

8. Retrieve the Job and Salary of all employees with Name = FORD or MARTIN.

9. Retrieve the Name and Number of all Departments.

10. Retrieve the Employee Name and Department number for all employees.

11. Retrieve the Employee Name and Department name for all employees.

12. Retrieve the Employee Name and who works in Department name = RESEARCH.

13. Retrieve the Employee names who workin one of these Departments: RESEARCHand SALES.

14. Retrieve the Employee name who works in department located in NEW YORK.

please write in computer word not on paper

In: Computer Science

*// 1- Add JavaDoc to This classes 2- Mak a UML */ import java.util.*; public class...

*//
1- Add JavaDoc to This classes 
2- Mak a UML
*/
import java.util.*;
public class Display
{
   public static void main(String[] args)
   {
       altEnerCar car1 = new altEnerCar(20000, 2001, 20000);
       altEnerCar car2 = new HydrogenCar(0, 2012, 50000, 100, false);
       altEnerCar car3 = new ElectricCar(0, 2014, 30000, 10, 50);
       altEnerCar car4 = new NaturalGasCar(0, 2000, 60000, 5, 20);
       altEnerCar car5 = new PropaneCar(0, 2011, 45000, 10, true);
      
       ArrayList<altEnerCar> cars = new ArrayList<altEnerCar>();
      
       cars.add(car1);
       cars.add(car2);
       cars.add(car3);
       cars.add(car4);
       cars.add(car5);
       Collections.sort(cars);
       System.out.println(cars);
      
   }


}




/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */


/**
 *
 * @author charl
 */






public class ElectricCar extends NoEmissionsCar
{
   private double batterycharge;
   public ElectricCar()
   {
       this.batterycharge = 200;
   }
   public ElectricCar(double miles, int yearmade, double price, double fuelcost, double batterycharge)
   {
       super(miles, yearmade, price, fuelcost);
       this.batterycharge = batterycharge;
   }
   @Override
   public void setFuelCost(double fuelcost)
   {
       this.fuelcost = fuelcost;
   }
   @Override
   public double getFuelCost()
   {
       return this.fuelcost;
   }
   public void setBatteryCharge(double batterycharge)
   {
       this.batterycharge = batterycharge;
   }
   public double getBatteryCharge()
   {
       return this.batterycharge;
   }
   @Override
   public String toString()
   {
       return "\tMiles: "+miles+"\tMake year: "+yearmade+"\tPrice: "+price+"\tFuel cost: "+fuelcost+"\tBatery Charge: "+batterycharge;
   }


}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */


/**
 *
 * @author charl
 */




public abstract class EmissionsCar extends altEnerCar
{
   protected double emissions;
   public EmissionsCar()
   {
       this.emissions = 60;
   }
   public EmissionsCar(double miles, int yearmade, double price, double emissions)
   {
       super(miles, yearmade, price);
       this.emissions = emissions;
   }
   public abstract void setEmissions(double emissions);
   public abstract double getEmissions();
}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */


/**
 *
 * @author charl
 */


public class HydrogenCar extends NoEmissionsCar
{
   private boolean infastructure;
   public HydrogenCar()
   {
       this.infastructure = false;
   }
   public HydrogenCar(double miles, int yearmade, double price, double fuelcost, boolean infastructure)
   {
       super(miles, yearmade, price, fuelcost);
       this.infastructure = infastructure;
   }


   
   @Override
   public void setFuelCost(double fuelcost)
   {
       this.fuelcost = fuelcost;
   }
   @Override
   public double getFuelCost()
   {
       return this.fuelcost;
   }
   public void setInfastructure(boolean infastructure)
   {
       this.infastructure = infastructure;
   }
   public boolean getInfastructure(boolean infastructure)
   {
       return this.infastructure;
   }
   @Override
   public String toString()
   {
       return "\tMiles: "+miles+"\tMake Year: "+yearmade+"\tPrice: "+price+"\tFuel Cost: "+fuelcost+"\tInfrastructure: "+infastructure;
   }
}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */


/**
 *
 * @author charl
 */


public class NaturalGasCar extends EmissionsCar
{
   private double methaneemissions;
   public NaturalGasCar()
   {
       this.methaneemissions = 15;
   }
   public NaturalGasCar(double miles, int yearmade, double price, double emissions, double methaneemissions)
   {
       super(miles, yearmade, price, emissions);
       this.methaneemissions = methaneemissions;
   }


    
   @Override
   public void setEmissions(double emissions)
   {
       this.emissions = emissions;
      
   }
   @Override
   public double getEmissions()
   {
       return this.emissions;
   }
   public void setMethaneEmissions(double methaneemissions)
   {
       this.methaneemissions = methaneemissions;
      
   }
   public double getMethaneEmissions()
   {
       return this.methaneemissions;
   }
   @Override
   public String toString()
   {
       return "\tMiles: "+miles+"\tMake Year: "+yearmade+"\tPrice: "+price+"\tEmission: "+emissions+"\tMethane Emission: "+methaneemissions;
   }


}
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */


/**
 *
 * @author charl
 */




public abstract class NoEmissionsCar extends altEnerCar
{
   protected double fuelcost;
   public NoEmissionsCar()
   {
       this.fuelcost = 30;
   }
   public NoEmissionsCar(double miles, int yearmade, double price, double fuelcost)
   {
       super(miles, yearmade, price);
       this.fuelcost = fuelcost;
   }
   public abstract void setFuelCost(double fuelcost);
   public abstract double getFuelCost();
}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */


/**
 *
 * @author charl
 */


public class PropaneCar extends EmissionsCar
{
   private boolean infastructure;
   public PropaneCar()
   {
       this.infastructure = true;
   }
   public PropaneCar(double miles, int yearmade, double price, double emissions, boolean infastructure)
   {
       super(miles, yearmade, price, emissions);
       this.infastructure = infastructure;
   }
   @Override
   public void setEmissions(double emissions)
   {
       this.emissions = emissions;
      
   }
   @Override
   public double getEmissions()
   {
       return this.emissions;
   }
   public void setMethaneEmissions(boolean infastructure)
   {
       this.infastructure = infastructure;
      
   }
   public boolean getMethaneEmissions()
   {
       return this.infastructure;
   }
   @Override
   public String toString()
   {
       return "\tMiles: "+miles+"\tMake Year: "+yearmade+"\tPrice: "+price+"\tEmissions: "+emissions+"\t Infrastructure: "+infastructure;
   }


}
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */


/**
 *
 * @author charl
 */
public class altEnerCar implements Comparable<altEnerCar>
{
   protected double miles;
   protected int yearmade;
   protected double price;
  
   public altEnerCar()
   {
       this.miles = 0;
       this.yearmade = 2019;
       this.price = 50000;
   }
   public altEnerCar(double miles, int yearmade, double price)
   {
       this.miles = miles;
       this.yearmade = yearmade;
       this.price = price;
   }
   public void setMiles(double miles)
   {
       this.miles = miles;
   }
   public void setYearMade(int yearmade)
   {
       this.yearmade = yearmade;
   }
   public void setPrice(double price)
   {
       this.price = price;
   }
   public double getMiles()
   {
       return this.miles;
   }
   public int getYearMade(int yearmade)
   {
       return this.yearmade;
   }
   public double getPrice()
   {
       return this.price;
   }
   public String toString()
   {
       return "\nmiles: "+miles+"\nyear made: "+yearmade+"\nprice: "+price;
   }
   public int compareTo(altEnerCar otherAECar)
   {
       return -1*(Double.valueOf(otherAECar.getPrice()).compareTo(this.price));
   }
  
}

In: Computer Science

The following information pertains to PCX Company: Temporary differences for the year 2016 are summarized below....

The following information pertains to PCX Company:

Temporary differences for the year 2016 are summarized below.

Expenses deducted in the tax return, but not included in the income statement:

Depreciation: $60,000

Prepaid Expense: $8,000

Expenses reported in the income statement, but not deducted in the tax return:

Warranty Expense: $9,000

No temporary differences existed at the beginning of 2016.

Pretax accounting income was $67,000

The tax rate is 30%.

Required-

Prepare the journal entry to record the tax provision for 2016.

Account Debit Credit

In: Accounting

Income taxation Compute allowable MACRS, section 179 and special first year write off for Queen Corp....

Income taxation

Compute allowable MACRS, section 179 and special first year write off for Queen Corp. (QC) for 2016, 2017, 2018, 2018 and 2019. Compute gain/loss on widget sold in 2019.

In 2016 QC purchased a Framus (ten-year item) for $3 million. QC mad no special elections for 2016.

In 2017 QC purchased four widgets (five-year) items for 450,000 each, QC declined special first year write off only.

In: Accounting

On January 1, 2016, Badger Inc. adopted the dollar-value LIFO method. The inventory cost on this...

On January 1, 2016, Badger Inc. adopted the dollar-value LIFO method. The inventory cost on this date was $114,000. The 2016 ending inventory, valued at year-end costs, was $165,000. The relative cost index for this inventory in 2016 was 1.20.

  

Suppose that Badger's 2017 ending inventory, valued at year-end costs, was $176,400 and that the relative cost index for this inventory in 2017 was 1.26. In determining the inventory balance should Badger report in its 12/31/17 balance sheet:

In: Accounting

Danisco Manufacturing consists of 85 full-time employees and 25 part-time employeess. The full-time employees' working hours...

Danisco Manufacturing consists of 85 full-time employees and 25 part-time employeess. The full-time employees' working hours are 8-hour per day, 5 days per weel in a year. The total overtime worked by the full-time employee is 2900 hours, and the total hours worked by the part-time employee is 1500 hours in year 2016. 18 injuries were recorded at the workplace in year 2016. Determine the OSHA incidence rate based on injuries for year 2016.

In: Other