Question: You are to develop a program that will store names and grades of students in a linked list. You are to prompt the user for

You are to develop a program that will store names and grades of students in a linked list. You are to prompt the user for the number of students in the class. Use the class size to determine how many names and grades to accept as input. Store the names and grades in a linked list.

Create two files to submit.

StudentNode.java - contains the class declaration

ClassLinkedList.java - contains the main() method

Build the StudentNode class per the following specifications.

Private fields

String name - Initialized to empty string in default constructor

double courseAvg - Initialized to 0 in default constructor

StudentNode nextNodePtr - Initialized to null in default constructor

public StudentNode() - Default constructor which sets private fields as specified above

public StudentNode(String name, double courseAvg) - Parameterized constructor

Public member methods

public void insertAfter(StudentNode nodeLoc) - Inserts the nodeLoc student object between this and next student objects

public StudentNode getNext() - returns the object pointed to by nextNodePtr

public void printNodeData() - prints the name and average for a single student

In your main method, inform the user the purpose of the program and then prompt the user for a class size. You should then input a name and corresponding grade for the number of students specified. As student names and grades are read in, the data should be stored in a linked list.

Sample program input and output:

You are to develop a program that will store names and grades

of students in a linked list. You are to prompt the user

for the number of students in the class. Use the class size

This program will store class data (names and grades) in a linked list How many students are in the class? 3 Enter a name for student 1: Jane Smith Enter the course grade for Jane Smith: 100 Enter a name for student 2: Pat Jones Enter the course grade for Pat Jones:90 Enter a name for student 3: Juan Lopez Enter the course grade for Juan Lopez: 95 Linked list of students and grades Jane Smith: 100.0 Pat Jones: 9 Juan Lopez: 95.0 0.0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!