You are to write a program that reads a data file of numbers and inserts them into a list in the correct sorted position. Your program should have the following functionality:

• Ask user for file name to read from.
• Read in data from the file, numbers.txt. The numbers will be between 0 and 100.
• Data should be inserted in the appropriate place.
• Do not store duplicates, but do record when they occur.
o Do not presort the list
• Have menu options (just text using a console application) to do the following:
o Display the list.
o Request the length of the list
o The user should be able to delete a single number from the list. To do this you either decrement the count parameter ( see below, or delete the node)

To do this efficiently you should include a count parameter in your node class. Each time you find a duplicate of a number that is already in the list, increment the count. A new node is put into the list only if the number is not already in the list.
Code requirements
1. You must have separate functions for each list operation (i.e insert, empty, delete, etc.)
2. No GUI’s required, concentrate on the functionality.
3. JAVA or C/C variant
4. No fancy built in types will be accepted. Make your own structures, your own functions, etc.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

import java.util.Scanner;

class Node {
    int num;
    int count;
    Node next;

    Node(int n) {
       num = n;
       count = 1;
       next = null;

class SortedLinkedList {
    Node head;

    SortedLinkedList() {
       head = null;

    public void insert(int number) {
       Node newEl;
       Node temp = head;

       if (isEmpty()) {
            head = new Node(number);
       else if (head.num == number) {
       else if (head.num > number) {
            newEl = new Node(number);
   = head;
            head = newEl;
       else {
            newEl = new Node(number);
            while ( != null) {...
$30.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats