Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using java a.Create an array of 15 student records that should not be sorted. b.Create a liked list of 15 student record nodes. Each node

Using java

a.Create an array of 15 student records that should not be sorted.

b.Create a liked list of 15 student record nodes. Each node is a node of one student record from the above unsorted array. The list of student records should be sorted by student ID. (Insert function without sort function to create a linked list.)(If you insert correctly, the resulting linked list is sorted.)

c.Each student record consists of student ID, student name, Student address, and GPA.

d.The student records must be defined as student object class with member functions. (No class definition declaration will be no credit for the project.)

e.Turn in source programs and Execution output:

1.Display the student records from the unsorted array

2. Display the student records from the linked list. (Display function) The output of the linked list should be sorted by using insert function from beginning of the list. Do not use SORT Program. Using it will get penalty.

3. Delete the kth record from the middle of the sorted list and display the resulting list. (Delete function.)

4. Insert a mth record to the middle and display the resulting sorted list. (You decide the kth and mth with proper message.)

f.You can not use the high level STL library or functions such as container classes or container adapter classes if you know how to use them (section 17.1 in ninth edition.) If you do not know, just ignore this statement.

Please just add on to what I already have.

This is what I have so far. It is not sorted (step b) and i'm confused on step 2, 3, and 4.

package linkedList;

public class StudentRec {

String ID;

String name;

String address;

float GPA;

public void records() {

System.out.println(" ID: " + ID + " Name: " + name + " Address: " + address + " GPA: " + GPA);

}

}

package linkedList;

public class LinkedList {

StudentRec s;

LinkedList l;

public void append(LinkedList x) {

l=x;

}

public void records() {

this.s.records();

}

}

package linkedList;

import java.io.IOException;

import java.util.Scanner;

public class Main {

private static Scanner sc;

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

// TODO Auto-generated method stub

sc = new Scanner(System.in);

int n=15;

StudentRec[] sr = new StudentRec[n];

for(int i=0; i

System.out.println("Enter student " + (i+1) + " ID:");

sr[i] = new StudentRec();

sr[i].ID = sc.next();

sc.nextLine();

System.out.println("Enter student " + (i+1) + " name:");

sr[i].name = sc.nextLine();

System.out.println("Enter student " + (i+1) + " address:");

sr[i].address = sc.nextLine();

System.out.println("Enter student " + (i+1) + " GPA:");

sr[i].GPA = sc.nextFloat();

}

System.out.println(" Student records from array:");

for(int i=0;i

sr[i].records();

System.out.println(" Student records from linked list:");

LinkedList[] x=new LinkedList[n];

x[0]=new LinkedList();

x[0].s=sr[0];

for(int i=1;i

x[i]=new LinkedList();

x[i].s=sr[i];

x[i-1].l=x[i];

}

for(int i=0;i

x[i].records();

}

}

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

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago