2.1k views
4 votes
Write the code of the StdList, Node, and Std classes using the above UML

data:
next:Node
Node()
Node(data:T)
name: String
gpa: double
major:Major(CSEC,CIT)
Std()
Std(String,double, Major)
Write Java program that reads students information form a text file "data.txt" and save each
student information in a Student list that implements MyList interface
<>
MyList
get(index:int): T
set(index:int, data:T): void
append(data:T):void
insert(index:int,data:T):void
getSize():int
remove(index:int): T
head: Node
size:int
StdList()
gpaAvg():double

User Asad Rao
by
8.0k points

1 Answer

5 votes

Final answer:

The given question is asking for the code of the StdList, Node, and Std classes, along with implementing a Java program to read student information from a text file and save it in a Student list. Here is an example implementation.

Step-by-step explanation:

The given question is asking for the code of the StdList, Node, and Std classes, along with implementing a Java program to read student information from a text file and save it in a Student list. Here is an example implementation:

public class Node<T> {
T data;
Node<T> next;
public Node(T data) {
this.data = data;
next = null;
}
}

public class Std {
String name;
double gpa;
Major major;

public Std(String name, double gpa, Major major) {
this.name = name;
this.gpa = gpa;
this.major = major;
}
}

public class StdList {
private Node<Std> head;
private int size;

public StdList() {
head = null;
size = 0;
}

// Implement the required methods (MyList interface)
// ...

public double gpaAvg() {

}
}

User Jef
by
8.0k points