Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

More Books

Students also viewed these Databases questions