homework

AddInOrder Best Structure? Java homework

Hi Currently I have a problem where I have a list of IDs, each with a related score. For example: ID : SCORE 1 : 12 2 : 15 3 : 2 4 : 99 I want to loop over these and add them to a structure in decending order of score. So the output will look something like {4,2,1,3} What is the best way of doing this in Java? A queue? Thanks ...

Ruby Program/Problem

Given a string of characters as input, without using regular expression or pattern matching, how to get the output, if the characters matches aaa should output 1 and if the characters matches aBa should output 2. (Note: Should not re-process characters so as to output both “1” and “2” when processing the same input) So for example: giv...

C# Beginner: I have a Northwind Access database and I need to build some objects. How do I do it?

I need to build two objects: an OrderList and an Order. Using those two objects, I have to populate a datagridview with a history of the orders. However, I am instructed not to use binding sources for the connection or other drag and drop controls. Unfortunately, from Google it seems like those are the most popular options for this type...

Check mySQL is Correct

Hey SO PHPmyAdmin keeps rejecting this mySQL im pretty sure its right and don't actually need it to run, its uni work and just have to hand in, it looks right to me. the actual error I get is #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '...

VB.net. Find the 2 lowest values in an array and remove them.

I have a simple array created for a Die roller. I want to roll 5 six sided dice, and remove the lowest 2 values. What code would help me do this. here is my basic code for the 5 dice Public Partial Class MainForm Public Sub New() Me.InitializeComponent() End Sub Sub Button1Click(sender As Object, e As EventArgs) Dim d61 a...

Having problems with sql triggers

Hi there, At the moment I am learning sql and begin to encounter problems with certain triggers. This is very basic but I do not know how to solve it. The problem is this: I have two tables Person and BankAccountInfo. The table Personincludes personal information. as identification number, name, birth date, etc. . TheBankAccountInfo` ...

Backtracking recursion question

There is a bag that can take X kilogram. You will get an array of stuff and their weight. Print true and the each weight of the stuff and false if there is no answer Example: for X=20 array {4,9,1,15,7,12,3} print true and 4 1 15 (4+1+15=20) ...

Best way to calculate differnce between two times in java?

Hi, I have two times in an array and I need to calculate the difference between both of these. I have converted the hours into mins, then added the remaining mins. This gives me the total minuites overall, once I did this for both I simply minus one total mins from the other. Then converted them back to hours and minuites. double no1 ...

Python data structures, dictionary?

Hi I hope somebody can help. I am using Python and I would like to be able to do the following. I have a set of objects (shapes for example) and a series of commands to act on these objects. The commands have the a format of a command string followed by a variable number of parameters which can be strings or integers For example the s...

Dictionary Matching / Spell Check Program

Please help me with a spellcheck program in C. The majority of the coding are complete (I think...). I'm really stuck because I'm not sure why the program wouldn't compile. Admittedly, I'm still an amateur coder, would you also provide a few suggestions on some of the bad coding habits that I have in the code? Thank you! Error Message: ...

Java: problem with hashmap and keyset()

Here's what I'm doing (it's my "homework"): the assignment is to make a map of gerbils and then flip through it using keySet() and get(key); import java.util.*; class Gerbil { int gerbilNumber; Gerbil(int i) { gerbilNumber = i; } void hoop() { System.out.println("The gerbil can ju...

Find unique words in a file - java

Using a msdos window i am piping in a amazon.txt file. I am trying to use the collections framework. Keep in mind i want to keep this as simple as possible. What i want to do is count all the unique words in the file... no duplicates This is what i have so far.. please be kind this is my first java project. import java.util.Scanner; im...

Browsing Web page (.aspx page) from a remote PC

I am unable to browse a simple asp.net page from a remote PC through the IP address of that computer. However IIS is responding on a local computer with http://localhost and even when I type the local computer's IP address where the page is present. Computer is running XP and IIS 5.1 The message displayed on browser is "The server is ta...

Tips for writing a DBMS

Hi, I have taken a graduate level course which is just one big project - to write a DBMS. The objective is not to reinvent the wheel and make an enterprise DBMS to rival Oracle. Only a small subset of SQL commands need to be supported. Nor is the objective to create some fancy hybrid model DBMS for storing multimedia or something. It ha...

How can I write a Bash Script to display a menu, accept user input and display data?

I want to write Bash Script with User Input for my assignment called "book store service". Firstly, it has option menu like "add new book name " "author name" "remove book" "update" "search" "show book list" "Exit". If I choice option 1, I've got to input new book's name. How could I write the user input and display output data when I ch...

What is the execution time T(n) of the algorithms?

Happy new year and peace to you all! Can you please explain to me what is the execution time T(n) of the 2 algorithms? Assuming execution time T(n) = # executions of (a:=a+1) Algorithm 1: for i ← 1 to n do for j ← 1 to i do for k ← j to i+j do a ← a + 1 end for end for end for Algorithm 2: ...

java implementation of Linked List Data Structure

Hello, I am trying to implement the linked list data structure using java, it works fine for insertion or removing first elements but fails to remove the last element via using the removeLast() method. My Linked List Node class: public class LLNode { String value; LLNode next; public LLNode(String value){ ...

How to get next and previous record from cursor?

Hi... I have a table named testtransaction which stores pervQuestionId and NextQuestionId... How to insert records in this table through cursor? there is something cursoe.getnext()...how do i implement it? My code is shown below: create or replace function store_data(disciplineid in char, NoO...

Drawing triangles with CUDA

I'm writing my own graphics library (yep, its homework:) and use cuda to do all rendering and calculations fast. I have problem with drawing filled triangles. I wrote it such a way that one process draw one triangle. It works pretty fine when there are a lot of small triangles on the scene, but it breaks performance totally when triangl...

MATLAB: How to find the image of the line at infinity corresponding to a plane?

There is an image of two separated papers on the floor. How to find the image of the line at infinity corresponding to the plane of the floor? See the image at: (larger) Anyone has some idea on how to start with MATLAB? Thank you, ...