Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6612081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:03:10+00:00 2026-05-25T20:03:10+00:00

My program is creating an array and allowing the user to input 10 double

  • 0

My program is creating an array and allowing the user to input 10 double precision numbers. Then the program will sort them in order from lowest to highest. I have the following but receive .class expected error upon compiling. Any ideas on why this is happening? Note * I have not been able to compile this yet so I don’t even know if this will work. *

import java.io.*;

public class ArrayDemo
{
    public static void main(String[] args) throws IOException
    {
        int i = 0;
        int j = 0;
        int temp = 0;
        double[] intValue = new double[10];
        String[] numbers = {"first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth", "tenth"};
        int len = intValue.length[];

        BufferedReader dataIn = new BufferedReader (new InputStreamReader(System.in));

        for (i = 0; i < len; ++i)
            System.out.println("Enter the " + numbers[i] + " number");
        intValue[i] = Double.valueOf(dataIn.readLine());

        {

        for (j = 0; j < (len - 1) -i; j++)
            if (intValue[j] > intValue[j+1]) 
            {
                temp = intValue[j];
                intValue[j] = intValue[j+1];
                intValue[j+1] = temp;
            }

        for (i = 0; i < 10; i++);
        {
            System.out.println("Array after sorting in ascending order");
            System.out.println();
            System.out.println(intValue[i]);

        }

        }
    }
}

Thank you for any input. 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:03:11+00:00Added an answer on May 25, 2026 at 8:03 pm

    int temp = 0; should be double temp = 0;

    and

    int len = intValue.length[]; should be int len = intValue.length;

    and

    for (i = 0; i < 10; i++); should be for (i = 0; i < 10; i++)

    Sample


    EDIT

    import java.io.*;
    
    public class Main
    {
        public static void main(String[] args) throws IOException
        {
            int i = 0;
            int j = 0;
            int k = 0;
            double temp = 0;
            double[] intValue = new double[10];
            String[] numbers = {"first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth", "tenth"};
            int len = intValue.length;
    
            BufferedReader dataIn = new BufferedReader (new InputStreamReader(System.in));
    
            for (i = 0; i < len; ++i) {
                System.out.println("Enter the " + numbers[i] + " number");
                intValue[i] = Double.valueOf(dataIn.readLine());
            }
    
    
            for (j = 0; j < len; j++)
            {
                for(k = 0; k < len; k++) {
                    if (intValue[j] > intValue[k]) 
                    {
                        temp = intValue[j];
                        intValue[j] = intValue[k];
                        intValue[k] = temp;
                    }
                }
            }
    
            System.out.println("Array after sorting in ascending order");
            for (i = 0; i < 10; i++)
            {
                System.out.print(intValue[i] + ", ");
    
            }
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a program that will be installed using the .net installer project.
I am creating a program that needs to store the user's data in encrypted
I'm creating a program that authenticates from a before it runs. I also want
I have been tasked with creating a program that will generate an amortization schedule.
I have been tasked with creating a program what will create take files in
I'm creating a program that parses a log file for a user's name and
I am creating a program that allows the user to select a drive letter
I am trying to improve my C++ by creating a program that will take
I want to make it so a user of my Record creating program can
I'm creating a program which goes through data in a array and filter outs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.