Assignment Help

Hi Everyone newbie here.
I need to write a method that returns the number of coins of the required currency currently stored in a Euro Converter machine. This will be used as follows to give the number of ten cent coins remaining in the machine.
The paramaters that we have to work with are :
@param - currency constant {either EuroMachine.EURO or EuroMachine.STERLING}
@param - the denomination constant (EuroMachine.TENPENCE) etc
@return - the number of coins stored
here is what i have written so far :
public int noCoinsStored(int currency, int coinConstant) {
    noCoinsStored(EuroMachine.EURO,EuroMachine.TENCENT);
    return 0;
  }in the above case Euromachine is the file which holds the value. EURO and TENCENT are final static values. How then can i get java to tell me how many EURO i have in the machine ?
I hope i am making myself clear.

public class EuroMachine {
  private static int EURO = 1;
  private static int STERLING = 2;
  private static int TENPENCE = 10;
  Hashmap coinMap; // Key = currencyType + "_"  + coinType
  public EuroMachine() {
    this.coinMap = new HashMap();
    initialize(EuroMachine.EURO, EuroMachine.TENPENCE);
    initialize(EuroMachine.STERLING, EuroMachine.TENPENCE);
  private void initialize(int currencyType, int coinType) {
    String key = "" + currencyType + "_" + coinType;
    this.coinMap.put(key, new Integer(0));
  public void addCoin(int currencyType, int coinType) {
    String key = "" + currencyType + "_" + coinType;
    int coins = (Integer) coinMap.get(key);  
    coinMap.set(key, new Integer(coins + 1));  
  public void removeCoin(int currencyType, int coinType) {
    String key = "" + currencyType + "_" + coinType;
    int coins = (Integer) coinMap.get(key);  
    if (coins > 0)
      coinMap.set(key, new Integer(coins - 1));  
  public void getRemainingCoins(int currencyType, int coinType) {
    String key = "" + currencyType + "_" + coinType;
    int coins = (Integer) coinMap.get(key);
    return coins; 
}Will accept dukes :-)
OG

Similar Messages

  • Finance Homework Help, Accounting Assignment Help, Business Homework Help, Math Homework help

    The site ACCOUNTINGHOMEWORKTUTORcom helps the students in Accounting Homework Help, Finance Homework Help, College Homework Help, Business Homework Help, Math Homework Help, Marketing homework help, statistics assignments help answers, economics assignment solutions.
    The website ACCOUNTINGHOMEWORKTUTORcom, which is, a Global community of Students and Subject Experts where Students can interact with Tutors/Experts to get the Homework Help/Solutions of their Queries/Assignments/Projects. As per the past track records of last four years, organization is committed towards Quality College Homework Help to the Students who want to become part of Homework Help Team.
    ACCOUNTING HOMEWORK TUTOR provides Homework and Assignment Help in all Subjects. The website can also help you with Essays & Research Papers. Most of the tutors and writers of the company are either PhD or Master degree holders in their respective subjects.
    Their Team is efficient in College Homework Help, Statistics Homework Help, Finance Homework Help, Accounting Homework Help, Business Homework Help, Chemistry Homework Help, Math Homework Help, Algebra Homework Help, and Science Homework Help etc.
    Tutors and writers are committed to fulfill the requirements and meet the deadline with the highest quality of writing. All essays are plagiarism free and are checked for plagiarism before being delivered to you. The dedicated team of academic writers has great experience and writing skills.
    All tutor/writers are highly qualified and trained to write all types of dissertations, essays, research papers, book reviews etc.. All writers write exclusively for them so that there is no problem of plagiarism. Also this ensures that a student gets the very same writer/tutor always for his series of assignments. The services ensure that the paper is delivered to the client well within deadline. This enables the student to review the work and ask for minor changes that he would like.
    The site ACCOUNTINGHOMEWORKTUTORcom deals into variety of subjects like Anthropology, Archeology, Arts, Biology, Business, Chemistry, Computers & Technology, Community Studies, Criminology, Ecology, Economics, Education, Engineering, English Language, Finance, Geography, Geology, History, IT (information technologies), International Studies and Diplomacy, Languages & Linguistics, Law, Leisure and Tourism, Literature, Mathematics, Media Studies, Music, Marketing, Management, Medicine & Health Care, Nursing, Philosophy, Political Science, Psychology, Programming, Religion, Science, Social Issues, Statistics, Teaching, Technology.

    Whenever It comes to my mind the word Accounting, I get really sick & weak to my kneels. It happens a lot. Once I came across www.accountinhomeworktutor.com
    The guys are really helpful in accounting homework help & finance assignment help for financial comparative analysis, case study analysis, ratio analysis.
    I recommend this to everyone out there.
    finance homework help

  • Variable Assignment help needed.

    Hi guys i have some problem in following code as it is giving me an error.
    I just want to assign value of variable abc to DBQ how would i accomplish the same.
    abc="C:/ProjectForList/software List as on 16th Nov 09-GO.XLS";
    con=DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=abc");

    Milindk007 wrote:
    con=DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Excel Driver (***.xls)};DBQ=""& abc");When posting code, code snippets, HTML/XML or input/output, please use the code tags, to help retain the text exactly as it is in your editor. To do that, select the code and click the CODE button. E.G.
    con=DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=""& abc");
    Even this is not working.Maybe it is just tired. Give it a good night's sleep, and ask it to work in the morning. If symptoms persist, copy/paste the exact error message.
    BTW - what gives with the 'U must be Russian' comment?

  • Assignment Help - Again looking for clarification only

    Hi All,
    I'm again having some trouble with the second half of an assignment. I had it all working on my computer and it was working without any problems.
    Now when I upload to the CSE servers and test I get some some weird errors that I cant track down.
    Basically this assignment was to implement a tiny bank system with the ability to deposit, withdraw and transfer. These transactions were read from a file and processed concurrently.
    I am having serious issues where it seems like threads just disappear and the stack trace never seems to go all the way down. Instead always throwing a java.lang.NullPointerException in different random Threads about halfway down where I would expect it.
    Does anyone have any suggestions to what may be causing it??
    As it is an assignment I cannot really post any code but any help would be greatly appreciated.
    Cheers,
    Chris

    Does anyone have any suggestions to what may be causing it??There is only one reason for a null pointer exception - something is null.
    The stack trace will tell you the exact line that the null pointer is showing up on.
    As a wild guess you are using threading a sychronization and expecting something to occur or not occur without considering how threads actually run.

  • Introduction to java class program assignment help

    We are susposed to be writing a program that calculates the best angle for firing a cannon ball to get the best distance through different substances. My teacher and i could not see why the program was not working and i was wondering if anyone could spot what is wrong with the code. The program is susposed to go through theta from 0 - 90 and remember the best theta for the best distance. we were testing with the drag constant as 0 because the theta should be 45 but the program outputs 81 instead. The big problem is that my x value goes negtive which should not happen and this is where my teacher gave up because he was unable to see why. my code is below for the program.
    Thanks for the help in advance
    Brian
    import javax.swing.*;
    public class Cannon2
        private static final double g = -9.8;
        public static void main(String[] args)
            int theta = 0; // initilizes theta
            int maxtheta = 0;
            double speed = 100; // initilizes speed
            double dt = 0.01;
            double time = 0.0;
            double vx, vy, vx1, vy1, xpos, ypos, oxpos, dragconst;
            double x = 0;
            double y = 0;
            ypos = 0;
            xpos = 0;
            oxpos = 0;
            dragconst = Double.parseDouble(JOptionPane.showInputDialog(null, "Enter drag constant:"));
            while (theta <= 90)
                vx = speed * Math.cos(theta);
                vy = -speed * Math.sin(theta);
                x = 0;
                y = 0;
                ypos = 0;
                xpos = 0;
                while (ypos >= 0)
                    ypos = y + vy * time; // y position
                    xpos = x + vx * time; // x position
                    time = time + dt; // increments time
                    x = xpos;
                    y = ypos;
                    vx = vx - Math.pow(vx, 2) * dragconst; // velosity calculator for x
                    vy = (vy + g * time) - (Math.pow(vy, 2) * dragconst); // velosity calculator for y
                    System.out.println(ypos);
                    System.out.println(xpos);
                    System.out.println(theta);
                if (xpos > oxpos)
                 oxpos = xpos;
                 maxtheta = theta;
                theta = theta + 1;
          System.out.println("The best angle is: " + maxtheta);
    }

    Simple. Reread the Math.cos (and Math.sin) documentation:
    cos
    public static double cos(double a)...
    Parameters:
    a - an angle, in radians.
    Returns:
    the cosine of the argument.
    I don't think 90 is what you want...

  • Programming Assignment Help

    Hello guys, I am a little rusty on my Java programming skills and I need some assistance with an assignment. I have created the program below and I keep getting the following error:
    Exception in thread "main" java.lang.NullPointerException
    *     at MemoryManager.main(MemoryManager.java:22)*
    but I am not sure why. I created a class called MemoryTable, but have not set any methods yet (at the bottom). Any assistance is appreciated.
    =========================================
    import java.util.Scanner;
    public class MemoryManager
         public static void main(String[] args)
              String partitionlength;
              int numofpartitions;
              Scanner input = new Scanner(System.in);
              System.out.println("How many partitions are there?");
              partitionlength = input.nextLine();
              numofpartitions = Integer.parseInt(partitionlength);
              System.out.println("There will be " + numofpartitions + " partitions.");
              MemoryTable[] mtable = new MemoryTable[numofpartitions];
              for(int i = 0; i < numofpartitions; i++)
                   mtable.partitionsize = (100 + i);
                   System.out.println(mtable[i].partitionsize);
    _________________________________________________________________________import java.util.*;
    public class MemoryTable
         int partitionsize;
         int memoryaddress;
         int access;
         int partitionstatus;
         public MemoryTable()
         partitionsize = 0;
         memoryaddress = 0;
         access = 0;
         partitionstatus = 0;
         public void SetPartitionSize()
         public void SetNumOfPartitions()

    OK. I don't completely understand what you meant by that, but this is what I tried, and I still get the error.
    ================================
    import java.util.Scanner;
    public class MemoryManager
         public static void main(String[] args)
              String partitionlength;
              int numofpartitions;
              Scanner input = new Scanner(System.in);
              System.out.println("How many partitions are there?");
              partitionlength = input.nextLine();
              numofpartitions = Integer.parseInt(partitionlength);
              System.out.println("There will be " + numofpartitions + " partitions.");
              MemoryTable[] mtable = new MemoryTable[numofpartitions];
              for(int i = 0; i < numofpartitions; i++)
                   mtable.partitionsize = 100 + i;
                   mtable[i].memoryaddress = 0;
                   mtable[i].access = 0;
                   mtable[i].partitionstatus = 0;
                   System.out.println(mtable[i].partitionsize);

  • Opportunity assignment -help

    HI,
    I try to use opportunity assignment to assign a default user to opportunities different that the creator.
    I created a rule with a simple condition that analyze if a box is checked (checked by default at the creation). If it is checked user 1 is assigned as owner.
    If not, user 1 is assigned as owner. My rule is defined as active!
    I also checked the box reassign opportunity. The process doesn't work when I create or edit an opportunity, I'm still the owner and not the user 1. Do you know why?
    Thanks for your help

    Hey,
    Assignment rules take 24 hours before they become active. That could be it.
    Thanks
    Oli @ Innoveer

  • Accounting homework help

    Can’t do Accounting Homework?
    Email me your accounting homework & accounting assignments & I will send you back the solutions. In addition to Accounting homework help & accounting assignments help, I also help in online accounting exams, online accounting tests & tutoring, accounting word problems, accounting case study & accounting essays.
    Send me your accounting & finance assignments and i will send you back the answers. I also help in projects, papers and essays.
    I also help in:-
    (a) accounting homework help
    (b) finance homework help
    (c) managerial accounting assignment solutions
    (d) net present value, future value & compounding
    (e) bonds, stocks, options, derivatives homework
    (f) financial management homework help
    (g) statistics homework help
    (h) homework ratio analysis & cash flow statement homework
    (i) income statement & balance sheet & shares & debentures
    (j) marginal costing, standard costing & variable costing
    (k) marketing homework help
    (l) economics homework help
    (m) accounting-finance homework
    (n) activity based costing , break even point & cap analysis
    (o) LIFO, FIFO, weighted average & journal entries homework & trial balance
    please visit once http://www.theaccountinghomework.com
    or email me on the [email protected]

    Whenever It comes to my mind the word Accounting, I get really sick & weak to my kneels. It happens a lot. Once I came across www.accountinhomeworktutor.com
    The guys are really helpful in accounting homework help & finance assignment help for financial comparative analysis, case study analysis, ratio analysis.
    I recommend this to everyone out there.
    finance homework help

  • ACCOUNTINGHOMEWORKTUTORcom, for finance homework help, Accounting Homework

    Email me your accounting homework & accounting assignments & I will send you back the solutions. In addition to Accounting homework help & accounting assignments help, I also help in online accounting exams, online accounting tests & tutoring, accounting word problems, accounting case study & accounting essays.
    Send me your accounting & finance assignments and i will send you back the answers. I also help in projects, papers and essays.
    I also help in:-
    (a) accounting homework help
    (b) finance homework help
    (c) managerial accounting assignment solutions
    (d) net present value, future value & compounding
    (e) bonds, stocks, options, derivatives homework
    (f) financial management homework help
    (g) statistics homework help
    (h) homework ratio analysis & cash flow statement homework
    (i) income statement & balance sheet & shares & debentures
    (j) marginal costing, standard costing & variable costing
    (k) marketing homework help
    (l) economics homework help
    (m) accounting-finance homework
    (n) activity based costing , break even point & cvp analysis
    (o) lifo, fifo, weighted average & journal entries homework & trial balance
    please visit once http://www.AccountingHomeworkTutor.com
    or email me on [email protected]

    Whenever It comes to my mind the word Accounting, I get really sick & weak to my kneels. It happens a lot. Once I came across www.accountinhomeworktutor.com
    The guys are really helpful in accounting homework help & finance assignment help for financial comparative analysis, case study analysis, ratio analysis.
    I recommend this to everyone out there.
    finance homework help

  • Sales org. - plant assignment

    Hii,
    what is the reason to assign plant to sales organization when all sales references can be made against sales organization and how are the logically related?

    Hi,
    Plant is assigned to the combination of |Sales Organisation and \distribution Channel, which we call as the Sales Line.
    The reasons are:
    1. When goods is sold by a Sales Organisation, at the time of Delivering goods we require a Delivering Plant.
    2. Shipping Point can not be assigned to the Plant unless & untill the above assignment is done.
    3. In case of multiple plants and sales areas under one company code, this assignment helps to distinguish that which Sales Organisation is responsible for the selling of goods from a particular plant
    4. This assignment is usefull at the time of crosscompany sales and stock transfers.
    Regards,
    Supriya

  • Help URL for ESS web dynpro applications

    Hi gurus,
      I am trying to assign help URL for a standard ESS iView( Record working time).
      When i go to the iView properties i have property showhelp. I have the same property for the page record working time.
      When i set this property to yes at the page level the help option shows up and whn i set this at the iView level the help option does not show up ( in the right hand corner of the page or iView)
      My main question... how do i set up the help url for this help. becuase even for page when i click on help it says "no help found"
      I want to give a URL for this help link.
       Any thoughts on why this option is not popping up when i set the show help option for iView and how to enable the help URL for iView as well.
       Appreciate any help on the same.
    regards
    Sam

    The Help option should show up in the iview tray if you set it at the iView level.  Im not sure why that part isnt working for you.
    For the iView help, you can set the property URL to Help Topic property on the iview or page. 
    If your version doesnt have this property, you can use the PCD inspector (available under system administration>Support>Portal Content Directory-->PCD Inspector).  Browse to the iview, click on prop editor, click the Switch to PCM property.  Edit the com.sap.portal.iview.HelpUrl and enter your help url.
    Hope this helps-
    Marty
    Message was edited by:
            Marty McCormick

  • Accounting homework help, finance homework help

    The guys at ACCOUNTINGHOMEWORKTUTORcom are one of the pioneers in the field of Accounts and Finance Assignments help. They provide the guidance in the areas Accounting homework help & financial management help, cost accounting homework, lifo, fifo, break-even point, decision making, probability & statistics helpers. Marketing Essay writing, research writing, dissertation writers services also provided besides case studies, projects, reports & powerpoint presentations & excel calculations.
    The site ACCOUNTINGHOMEWORKTUTORcom provides Marketing, Stats, Accounts, Management, Homework solutions, Assignment help for five areas viz., Accounting Homework Help, Finance Assignment help, Case study help, Project reports & presentation help, Marketing homework help, essay writing services, Dissertation writing, Stats Help, Probability help, SPSS Research help, SPSS Projects solutions, Excel Reports & presentations, case studies help, company reports & comparisons studies, economics homework help.
    If you stuck on accounting or finance or case studies or essays or reports & presentations work then ACCOUNTINGHOMEWORKTUTORcom are the best guys on internet. If you are unable to open the site then simply put a . between ACCOUNTINGHOMEWORKTUTOR and com

    Whenever It comes to my mind the word Accounting, I get really sick & weak to my kneels. It happens a lot. Once I came across www.accountinhomeworktutor.com
    The guys are really helpful in accounting homework help & finance assignment help for financial comparative analysis, case study analysis, ratio analysis.
    I recommend this to everyone out there.
    finance homework help

  • Help. Thing won't compile!!!!

    Homework Assignment help!
    Have four classes. Grade, Group, CreateGroup, Inquiry.
    Grade compiles. Group compiles. CreateGroup compiles.
    Having trouble with Inquiry in the process().
    Please help. When I try to compile Inquiry I get IOException not caught at
    group = create.loadFromInput();
    when I try and catch it, I get nullpointerexception!!
    Grade
    import java.util.Arrays;
    /** Get student ID, student name, array of quiz scores,
         compute average, computer letter grades.
    public class Grade
         private final int STUDENT_ID_LENGTH = 4;
         private String studentID;
         private String studentName;
         private double quizScores[];
         private double averageQuizScore;
         private char grade;
         /** This constructor initializes ID, name and scores.
              @param ID The student ID
              @param name The Student name
              @param scores The student quiz scores.
              @throws IllegalArgumentException if argument is null or empty
              @throws IllegalArgumentException if Student Id is not valid
        public Grade(String id, String name, double[] scores)
            throws IllegalArgumentException
              char[] idChars = new char[STUDENT_ID_LENGTH];
            if(id == null || id.trim().length() == 0)   // If ID is null or length of ID is 0
                   throw new IllegalArgumentException("The student ID is null");
            else if(id.trim().length() != 4)  // If length of ID is not 4
                throw new IllegalArgumentException("Student ID not 4 digits: "
                + id.trim());
            else if(name == null || name.trim().length() == 0)  // If name is null or length of name is 0
                   throw new IllegalArgumentException("Student Name is null");
            else if(scores == null || scores.length == 0)  //If scores is null or length of scores is 0
                   throw new IllegalArgumentException("There are no quiz scores");
            id = id.trim();
            id.getChars(0, STUDENT_ID_LENGTH, idChars, 0);
            for(int index = 0; index < idChars.length; index++)
                   if(!Character.isDigit(idChars[index]))                //if not digits then throw exception
                    throw new IllegalArgumentException("Student ID is not 4 digits: "
                    + id.trim());
            studentID = id;  // set the value of studentID to ID
            studentName = name;  //set the value of studentName to name.
            quizScores = (double[])scores.clone(); // cloning quizScores
            averageQuizScore();
            grade();
        /** This method calculates the average quiz score
              @param averageQuizScore the average quiz score
        private void averageQuizScore()
            double total = 0.0;
            if (quizScores.length == 1)  //If length of quizscores is 1 then average score is the score.
                   averageQuizScore = quizScores[0];
            else if (quizScores.length == 2) // If length is 2, average score is average of the scores.
                averageQuizScore = (quizScores[0] + quizScores[1]) / 2;
            else
                double lowestScore = quizScores[0];
                //index is equal to length of quizscores - 1 and when index >= 0, decrement index
                for(int index = quizScores.length - 1; index >= 0; index--)
                    total += quizScores[index];
                    if(quizScores[index] < lowestScore)
                        lowestScore = quizScores[index];
                averageQuizScore = (total - lowestScore) /
                     (double)(quizScores.length - 1);  // drop the lowest score.
         /** This method calculates the letter grade.
              @param grade The letter grade
        private void grade()
              if (averageQuizScore < 60)
                   grade = 'F';
              else if (averageQuizScore < 70)
                   grade = 'D';
              else if (averageQuizScore < 80)
                   grade = 'C';
              else if (averageQuizScore <90)
                   grade = 'B';
              else if (averageQuizScore > 90)
                   grade = 'A';
         /** This method returns the student ID
              @return The student ID
        public String getStudentID()
            return studentID;
         /** This method returns the student Name
              @return the student name
        public String getStudentName()
            return studentName;
        /** This method returns the student quiz scores
             @return the student quiz scores
        public double[] getQuizScores()
            return (double[])quizScores.clone();
        /** This method returns the average quiz scores
             @return the average quiz scores
        public double getAverageQuizScore()
            return averageQuizScore;
         /** This method returns the letter grade
              @return The student letter grade
        public char getAverageQuizGrade()
            return grade;
    /** This method returns a string representation of the object
    @return The string representation of object
        public String toString()
            return ("Student ID:" + studentID + "; Student Name:" + studentName
              + "; Student Average:" + averageQuizScore + "; Student Grade:" +
              grade + "; Student Scores:") + Arrays.toString(quizScores);
    }Group
    /** This class adds, retrieves, removes grade objects and returns array of IDs
    public class Group
         public static final int MAXIMUM_STUDENTS = 60;
         private static final int NOT_FOUND = -1;
         private int actualStudents;
         private String idArray[];
         private Grade gradeArray[];
         /** The default constructor creates empty arrays
         public Group()
              idArray = new String[MAXIMUM_STUDENTS];
              gradeArray = new Grade[idArray.length];
         /** This method adds a Grade object and returns true when information added
              and false when information is not added.
              @param studentID The Student ID
              @param studentRecord The Grade object
         public boolean add(String studentID, Grade studentRecord)
              boolean status = false;
              if(NOT_FOUND == getStudentIndex(idArray, studentID))
                   if(actualStudents == MAXIMUM_STUDENTS)
                        System.err.println("There are more student recors than can be"
                             + "handled, extra records are discarded.");
                   else
                        idArray[actualStudents] = studentID;
                        gradeArray[actualStudents] = studentRecord;
                        actualStudents++;
                        status = true;
              else
                   System.err.println("Error with record;" + " (This ID is duplicate: "
                        + studentID + "); record discarded");
                   System.err.println("Record Content: " + studentRecord);
              return status;
         /** This method uses student ID to get the student id, student name
              and student quiz scores
              @param ID The student ID
              @return The instance of Grade
         public Grade get(String studentID)
              Grade grade = null;
              int index = getStudentIndex(idArray,studentID);
              if(index != -1)
                   grade = gradeArray[index];
              return grade;
         /** This method uses the student ID to remove the student's id,
              name, scores
              @param studentID The student ID
              @return  A reference to removed object or null for no student id.
         public Grade remove(String studentID)
              Grade grade = null;
              int index = getStudentIndex(idArray, studentID);
              if(index != -1)
                   grade = gradeArray[index];
                   for( int i = index; i < actualStudents - 1; i ++)
                        gradeArray[index] = gradeArray[index + 1];
                        idArray[index] = idArray[index + 1];
                   gradeArray[actualStudents - 1] = null;
                   idArray[actualStudents - 1] = null;
                   actualStudents--;
              return grade;
         /** This method returns the Student ID array in ascending order
              @return The sorted Student ID array
         public String[] getIDs()
              insertionSort(idArray, gradeArray);
              return idArray;
         /** This method returns the index of the Grade Object in the Array
              @param studentID The student ID
              @param array The Array to look in
              @return The student index in the array
         private int getStudentIndex(String[] array, String studentID)
              return binarySearch(array, 0, actualStudents - 1, studentID);
         /** This method performs a recursive binary search on String array
              @param array The array to search
              @param first The first element in the search range
              @param last The last element in the search range.
              @param value The value to search for.
              @return The subscript of the value if found, otherwish -1.
         private int binarySearch(String[] array, int first, int last, String id)
              int middle;
              if(first > last)
                   return -1;
              middle = (first + last) / 2;
              if (array[middle].equals(id))
                   return middle;
              else if (array[middle].compareTo(id) < 0)
                   return binarySearch(array, middle + 1, last, id);
              else
                   return binarySearch(array, first, middle - 1, id);
         /** This method performs an insertion sort on String arrays.
              The arrays is sorted in ascending order.
              @param idArray the ID array to sort
              @param gradeArray The grade array to sort
         private void insertionSort(String[] idArray, Grade[] gradeArray)
              String unsortedID;
              Grade unsortedGrade;
              int scan;
              for(int index = 1; index < actualStudents; index ++)
                   unsortedID = idArray[index];
                   unsortedGrade = gradeArray[index];
                   scan = index;
                   while (scan > 0 && idArray[scan - 1].compareTo(unsortedID) > 0)
                        idArray[scan] = idArray[scan - 1];
                        gradeArray[scan] = gradeArray[scan - 1];
                        scan--;
                   idArray[scan] = unsortedID;
                   gradeArray[scan] = unsortedGrade;
    }CreateGroup
    import java.io.IOException;
    import java.io.BufferedReader;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.PrintWriter;
    /** Create an object of Grade class, load the object from the file,
         and write the object to data file
    public class CreateGroup
         final int MAXIMUM_STUDENTS = 60;
         String studentRecord;
         String studentID;
         String studentName;
         int actualStudents;
         String input = "CS076C16B_Input.txt";
         String output = "CS076C16B_Output.txt";
         Group group;
         /** Read the input file and validate it and print good records to output file.
         public Group loadFromInput() throws IOException
              group = new Group();
              int index = 0;
              BufferedReader inputFile = new BufferedReader(new FileReader(input));
              studentRecord = inputFile.readLine();
              while(studentRecord != null && actualStudents < MAXIMUM_STUDENTS)
                   index++;
                   String tokens[] = studentRecord.split(",");
                   double scores[] = new double[tokens.length - 2];
                   for(int i = 0; i < scores.length; i++)
                        scores[i] = Double.parseDouble(tokens[i+2]);
                   try
                        Grade grade = new Grade(tokens[0], tokens[1], scores);
                        if(group.add(studentID, grade))
                             actualStudents++;
                   catch(IllegalArgumentException illegalargumentexception)
                        System.err.println("Error with record " + index + "; " +
                             illegalargumentexception.getMessage() + "; record discarded");
                        System.err.println("Record content: " + studentRecord);
              if(actualStudents == MAXIMUM_STUDENTS && studentRecord != null)
                   System.err.println("There are more student records than can be"
                        + "handled, extra records are discarded.");
              inputFile.close();
              return group;
         /** This method writes Grade objects out to a data file in ascending order
         public boolean saveFile()
              Grade grade;
              boolean successful = false;
              String holdLine;
              String[] studentIDs = group.getIDs();
              try
                   FileWriter fwriter = new FileWriter(output);
                   PrintWriter output = new PrintWriter(fwriter);
                   for(int i = 0;i < actualStudents; i++)
                        grade = group.get(studentIDs);
                        studentID = grade.getStudentID();
                        studentName = grade.getStudentName();
                        double[] scores = grade.getQuizScores();
                        holdLine = studentID + "," + studentName;
                        for(int index = 0; index < scores.length; index++)
                             holdLine += "," + scores[index];
                        output.println(holdLine);
                   output.close();
                   successful = true;
              catch(IOException e)
                   System.err.println(e.getMessage());
              return successful;
    Inquiryimport java.util.Scanner;
    import java.util.Arrays;
    import java.io.IOException;
    /** This class prompts the user to add, delete, retrieve or
         save student information.
    public class Inquiry
         CreateGroup create;
         Group group;
         String studentID;
         final int EXIT_SENTINEL = 0;
         Scanner keyboard = new Scanner(System.in);
         public static void main(String[] args)
                   Inquiry inquiry = new Inquiry();
                   inquiry.process();
         /** This method gets information from user
         private void process()
              String input;
              CreateGroup create = new CreateGroup();
              char retrieve = 'R';
              char delete = 'D';
              char add = 'A';
              char save = 'S';
              final String OUTPUT_MESSAGE = "\n Enter " + retrieve +
                   " to retrieve a student record " + "\n Enter " + delete +
                   " to delete a student record " + "\n Enter " + add +
                   " to add a student record " + "\n Enter " + save +
                   " to save a student record ";
              group = create.loadFromInput();
              System.out.println("Hello." + OUTPUT_MESSAGE);
              input = keyboard.nextLine();
              while(input.length() != 0)
                   char hold = input.charAt(0);
                   switch(hold)
                        case 'R':
                             retrieve();
                             break;
                        case 'D':
                             delete();
                             break;
                        case 'A':
                             add();
                             break;
                        case 'S':
                             save();
                             break;
         /** This method gets the student id, student name and student quiz scores
              and adds it to the file
         private void add()
              String studentName;
              String holdScores;
              System.out.println("Please enter a Student ID to add");
              studentID = keyboard.nextLine();
              System.out.println("Please enter the Student's Name");
              studentName = keyboard.nextLine();
              System.out.println("Please enter the scores, and seperate them" +
                   "with a ','");
              holdScores = keyboard.nextLine();
              String[] tokens = holdScores.split(",");
              double scores[] = new double[tokens.length];
              try
                   for(int i = 0; i < tokens.length; i++)
                        scores[i] = Double.parseDouble(tokens[i]);
                   Grade grade = new Grade(studentID, studentName, scores);
                   if(group.add(studentID, grade))
                        System.out.println("Record added successfully");
              catch(IllegalArgumentException illegalargumentexception)
                   System.err.println("Error with record; " +
                        illegalargumentexception.getMessage());
         /** This method gets the student id from the user and deletes the
              student Info from the file.
         private void delete()
              System.out.println("Enter the student ID to delete:");
              studentID = keyboard.nextLine();
              if(group.remove(studentID) != null)
                   System.out.println("Record deleted successfully");
         /** This method gets the student id from the user and retrieves the student Info.
         private void retrieve()
              Grade grade;
              System.out.println("Enter the student ID to retrieve:");
              studentID = keyboard.nextLine();
              grade = group.get(studentID);
              System.out.println("ID" + grade.getStudentID() +
                   "; Name:" + grade.getStudentName() + "; Scores:" +
                   Arrays.toString(grade.getQuizScores()));
         /** This method saves the file.
         private void save()
              if(create.saveFile())
                   System.out.println("The file was successfully saved.");
    }Edited by: pranavss11 on Oct 12, 2008 6:45 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         

    Changed process a bit
    private void process()
              CreateGroup create = new CreateGroup();
              String userInput;
              int retrieve = 1;
              int delete = 2;
              int add = 3;
              int save = 4;
              final String RETRIEVE = "retrieve a student record";
              final String DELETE = "delete a student record";
              final String ADD = "add a student record";
              final String SAVE = "save a student record";
              String[] options = {RETRIEVE, DELETE, ADD, SAVE};
              final String OUTPUT_MESSAGE = "\n Enter " + retrieve + " to " +
                   options[retrieve - 1] +
                   "\n Enter " + delete + " to " + options[delete - 1] +
                   "\n Enter " + add + " to " + options[add - 1] +
                   "\n Enter " + save + " to " + options[save - 1] +
                   "\n Enter " + EXIT_SENTINEL + " or the enter key to exit";
              final String REPEAT_OUTPUT_MESSAGE = "Enter " + retrieve + ", " +
                   delete + ", " + add + ", or " + save + " to" +
                   " preform a task or " + "0 or the enter" + " key to exit.";
              try
                   group = create.loadFromInput();
              catch(IOException e)
                   System.err.println(e.getMessage());
              //Ask the user if they want to retrieve, delete, add, load, or save information
              System.out.println("Welcome to Student Inquiry." +
                        " What do you want to do?" + OUTPUT_MESSAGE);
              userInput = keyboard.nextLine();
              while (userInput.length() != EXIT_SENTINEL)
                   try
                        //try to convert userInput into an integer
                        int optionNumber;
                        optionNumber = Integer.parseInt(userInput);
                        if (optionNumber > 0 && optionNumber < 5)
                             //echo user input
                             System.out.println("You chose to " + options[optionNumber - 1]);
                             switch (optionNumber)
                                  case 1:
                                       retrieve();
                                       break;
                                  case 2:
                                       delete();
                                       break;
                                  case 3:
                                       add();
                                       break;
                                  case 4:
                                       save();
                                       break;
                        else if (optionNumber == EXIT_SENTINEL)
                             System.exit(0);
                        else
                             System.out.println("The input " + optionNumber +
                                  " is not a valid" +     " choice. " + REPEAT_OUTPUT_MESSAGE);
                   catch (NumberFormatException e)
                        System.out.println("The input " + userInput + " is not a" +
                             " valid choice. " + REPEAT_OUTPUT_MESSAGE);
                   System.out.println("\n What do you want to do next?" + OUTPUT_MESSAGE);
                        userInput = keyboard.nextLine();
              if (userInput.length() == EXIT_SENTINEL)
              System.exit(0);
         }Exception in thread "main" java.lang.NullPointerException
    at Group.binarySearch(Group.java:137)
    at Group.getStudentIndex(Group.java:117)
    at Group.add(Group.java:33)
    at CreateGroup.loadFromInput(CreateGroup.java:53)
    at Inquiry.process(Inquiry.java:55)
    at Inquiry.main(Inquiry.java:25)

  • Need help: Few of APs suddenly fail for user connection establish

    Hi there,
    Need advice in this probe. Our campus internal wireless system is working fine until weeks ago this issue occurred.
    Our campus is running on LWAPP AP1242, WISM ver 5.1, and external Radius server using 802.1x.
    Client will authenticate to the SSID via 802.1x ext server that is compliment with WLC. The client around certain APs had a problem to authenticate even the signal of the SSID was so strong. The user had register to the radius server and they had succesful connected to others AP before with same system.
    This certain APs were random, each day more than hours it fail to establish connection to the SSID. After several hours, it is back to normal( working fine). For those APs that suspected, i had change to totally new AP assuming that the previous had a hardware prob. But it keep happen to the new AP that been install.
    Then i suspected that external radius might be the reason, so i configure one SSID with open access for that AP. But i fail to connect the SSID with open access during the problem. After hours it then successful connected to open access.
    Why this suddenly happen? It is all working fine, and suddenly this occured. If this because of the rouge AP jamming signal? configuration? SSIDs brodcast? Firmware issue?

    1. Maybe someone with a similar system is detecting your AP's as rogue AP's and is containing them.
    - Not really sure with that, how can we detect it? By enable rouge detection, the area involve with this issue, showing not much rouge around.
    2. Among the clients having issues; what band are they using b/g, a, both?
    - 11b will the minority. 11g will the largest user.
    3. Do you have a load restriction policy defined? When an ap reaches its max load it will drop additional clients trying to associate.
    - Not really. Threshold client per AP will 70 user. We had identify only 30 user that assct with single AP.
    4. What type of wireless cards are the clients using? Are they all the same or all different?
    - we handle around 2000 user during peak time. So wireless card will be mix. - Intel card will be the most.
    Additional inquiries
    - by allowing client to use only one single vlan for ip assignment, help to handle this issue?. Currently we are using AP group via different segment of vlan.
    - By disable WLAN override on each AP, help to handle this issue?

  • 10g and 11g installation problem on Vista Business version

    Hi Everyone
    I could not get either 10g or 11g database install in my vista business version.
    11g Oracle universal installer was running, but many button does not work, like the folder browser and at some stage the program just terminate itself.
    10g gave me a total green screen during the universal installer, the window taskbar showed the installer was running.
    someone said it is the jre problem but i dont know how to fix it anyway. I tried to remove or update jre in my computer, but nothing get better.
    My window has the newest updates. below are the database files i was using from oracle.
    11g - win32_11gR1_database_1013.zip
    10g - 10203_vista_w2k8_x86_production_db.zip
    Could someone help me please, thank you.
    Bryan

    Please consider opening this as a completely separate question rather than a continuation of an existing, but not quite related, question.
    The reasons include:
    - each user sees a summary page which reveals the topic of the first question asked - yours is now buried;
    - others may wish to contribuite to the original and you have now side-tracked (if not completely derailed) it
    - you are able to assign helpfulness points of your own which encourages some to participate in YOUR issue
    - it is consideredd normal courtesy in forums

Maybe you are looking for