Help With My Java Project?

Ads
 

Help With My Java Project?

Write a console program that repeatedly prompts the user to enter data until they type done (any case, Upper, Lower, or Mixed). As they enter the data, assign it to a two-dimension array where the first dimension contains exactly what they type and the second dimension contains the first non-whitespace character of what they type, in lowercase. If they enter a blank line, it is acceptable to skip that line. When they type done, do these steps: display: As Entered for each entry in the array, display the index of the first dimension, the second dimension's value, and the first dimension's value on a single line separated by : (colon). display: Bubble Sorted using a bubble sort, for each entry in the array, display the original index of the first dimension, the second dimension's value, and the first dimension's value on a single line separated by : (colon) sorted by the second dimension. display: Selection Sorted using a selection sort, for each entry in the array, display the original index of the first dimension, the second dimension's value, and the first dimension's value on a single line separated by : (colon) sorted by the first dimension. Grading Notes:

Example:

User types: apple Apple Zone apple done

You display: As entered 0:a:apple 1:a:Apple 2:z:Zone 3:a:apple Bubble Sorted 0:a:apple 1:a:Apple 3:a:apple 2:z:Zone Selection Sorted 1:a:Apple 0:a:apple 3:a:apple 2:z:Zone

Here is what i got and i cant seem to put it all together to make it work. please help

import java.util.Scanner;
import java.util.*;
public class A4A
{
    public static void main(String[] args) { 
        Scanner input=new Scanner(System.in);
        System.out.print("Enter value of i: ");
        int a=input.nextInt();

System.out.print("Enter value of j: "); int b=input.nextInt(); int[][] a2 = new int[a][b]; System.out.println("Enter elements of your choice: "); for(int i=0 ; i < a2.length ; i++){ for(int j=0 ; j < a2[i].length ; j++){ a2[i][j] = input.nextInt(); } } for(int i=0 ; i < a2.length ; i++){ System.out.println(); for(int j=0 ; j < a2[i].length ; j++){ System.out.print(a2[i][j]+" "); } } } } static class bubbleSort{ { int i; int array[] = {12,9,4,99,120,1,3,10}; System.out.println("Values Before the sort:\n"); for(i = 0; i < array.length; i++) System.out.print( array[i]+" "); System.out.println(); bubble_srt(array, array.length); System.out.print("Values after the sort:\n"); for(i = 0; i public static void bubble_srt( int a[], int n ){ int i, j,t=0; for(i = 0; i < n; i++){ for(j = 1; j < (n-i); j++){ if(a[j-1] > a[j]){ t = a[j-1]; a[j-1]=a[j]; a[j]=t; } } } } } public static void selection_srt(int array[], int n){ for(int x=0; xofmin = x; for(int y=x; yofmin]ofmin = y; } } int temp = array[x]; array[x] = array[indexofmin]; array[indexofmin] = temp; } } }
View Answers

Ads









Related Tutorials/Questions & Answers:
PLEASE HELP WITH MY JAVA
Help With My Java Project?
Advertisements
Help Me in My Java Work
java projects
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out
Java Projects
Java projects for beginners
Java projects
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out
sir/mam i want to have knowledge on live projects of java/jsp/servlets.Can you plz help me out
Java Marketing projects
ModuleNotFoundError: No module named 'project2'
hello. can anyone help me with my java project, using jcreator?
Please help me to modify my java code from php code
Please help me to modify my java code from php code
Simple Java Projects
Java Example projects about STRUTS
I need help on my Java code.... please please help me out!?
Need help with my project
ModuleNotFoundError: No module named 'projectq'
ModuleNotFoundError: No module named 'projectq'
ModuleNotFoundError: No module named 'projectq'
need help....how to connect and disconnect multiple databases(databases created in mysql) using java and my sql
projects
projects

Ads