Question
This is my homework Assignment. I am having an issue under the stage 3. This is what I have so far. I need help with
This is my homework Assignment. I am having an issue under the stage 3. This is what I have so far. I need help with making an array for Data1.txt and Data2.txt and sorting it.
import java.util.*;
import java.io.*;
public class PersonTester extends Person
{
public static void main(String[] args) throws IOException
{
String text = null;
String a = "data1.txt";
BufferedReader brst = new BufferedReader(new FileReader(a));
text = brst.readLine();
int aSize = Integer.parseInt(text);
System.out.println(aSize);
String text2 = null;
String b = "data2.txt";
BufferedReader brst2 = new BufferedReader(new FileReader(b));
text2 = brst2.readLine();
int bSize = Integer.parseInt(text2);
System.out.println(bSize);
String[] studArray = new String[bSize];
/* 8
Larry 20 12345 CPSC
Amy 23 34343 IT
Ashley 18 99923 ENGL
John 17 23434 CPSE
Eric 19 11111 Engineering
Jennifer 20 33333 Biology
Christina 19 55555 French
Mike 21 77777 Chemistry
*/
}
}
Programming Assignment 3: Inheritance and Interface CPSC 131: Introduction to Computer Programming II (Fall 2016) Due October 31, 2017 1 Description of the Program In this assignment, you will make two classes, Student and Instructor, that inherit from a superclass Person. The implementation of class Person is given. You will also need to write a test program to test the methods you write for these two classes. The implementation details are described as follows Stage 1: In the first file Student.java, you should include the following additional instance variables and methods (other than al instance variables and methods inherited from class Person) . Private instance variables studentID, and major; . A constructor takes four inputs (name, age, studentID and major); . Two additional getter methods to return each of instance variables (accessor); . Two setter methods to change each of instance variables (mutator) . A method toString that converts a student's information into string form. The string should have the format as shown in Figure 1. You should override superclass toString) methood . A method compareTo that implements the interface Comparable, so that Student objects can be sorted by studentID in an ascending order Stage 2: In the second file Instructor.java, you should include the following additional instance variables and methods (other than all instance variables and methods inherited from class Person) Private instance variable salary; . A constructor takes three inputs (name, age, and salary); One additional getter method to return the instance variable (accessor); . One setter method to change the instance variable (mutator)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started