homework

Where can I find C# code for console application designs. The star pyramid for example

Hi guys, I want to know if there's a website that provides amazing code star designs for my console application. For example I want a code that can output the pyramid using for loops: * *** ***** ********* Or code that can output the half-life logo using for loops. It doesn't matter where the code was created, as long as I c...

Help with sort method. Java Homework

I stayed up till 3 last night reading till my eyes bled. This is homework, but I need a "nudge". I can't find how to sort by name. My Questions: (Please keep answers beginner friendly) Does what have look right so far? How to sort? Does anyone have recommendations for optimizing/cleaning this? Here is the assignment: The Inve...

Algorithm Question - Team Scheduling - Quiz design

I've got a weird problem to solve - this is to be used in designing a quiz, but it's easiest to explain using teams. There's 16 teams. There's 24 matches. 4 teams play in every match. Each team has to appear once against 12/16 teams and twice against the remaining 3/16, and has to appear exactly 6 times. Any ideas on how to do this? If...

Recursive function to add sum of sequence of numbers and the sums thereof

Given a sequence of n numbers (n can be any number, assume n <= 100 for this question), say for eg. 11, 23, 9, 17, 20, 8, 5, 6 . Problem is to write a recursive function in C to add each number in the sequence to get the sum. If this sum is of more than one digit then sum the digits again and again if the sum is of more than one digit th...

Beginner java question

I am taking an intro to programming online. However, I am stuck on one assignment. The assignment is to write a breakout game. I have succesfully written 97% of the game. However, the game stops before all the bricks are removed. Sometimes there are 4 bricks remaining, some times 11. The program is designed to stop when the score counte...

How to make the array sort by Product[counter].getProductTitle() ?

Question: Where does "productArray" come from in these: for ( Product product : productArray ) & Arrays.sort( productArray, new ProductComparator() ); Question: What am I doing wrong? How do I make this sort? Related Post from Yesterday EDIT :::EDIT::: Ok I took your advice here about Produ...

LinkedList "node jump"

Trying to figure out why my list() class pointers are being overwritten with the third node. What happens in the insert function (below) is that the third time the insert function is called my "headByName->nextByName" node pointer is overwritten by the third node, when it should point to the second. So as you can guess the 4th node is ov...

How Prim's algorithm time complexity is ElogV using Priority Q?

Pseudo code which i used: for all V vertices: visited[n]=0 pick any vertex r from graph and set visited[r]=1 For all edges e incident to r PQ.insert() while(PQ is not empty)//line 1 f=PQ.min()//f(r,s) is such that visited[s]=0 for all edges e(s,t) incident to s//line 2 if(visited[t]==0) PQ.insert(e);//line 3 ...

c++ return if invalid input

hi, i have done up a program which requires the following: 1) prompts user input account no 2) prompts user input account type 2.1) if account type = a, prompts some input and does a certain formula [if] 2.2) if account type = b, prompts some input and does another formula [else if] 2.3) if account type is wrong(not a or b), promp...

Name 2 java VM threads

Hey, I am studying for a java exam and on a past exam the lecturer asked this question and im wondering if someone can help me. "In the context of java explain threads. Give an example of when you might use a thread. Name two java virtual machine threads." The first two parts of the question are easy enough but the part about naming th...

trigger for when a sale is made to update the despatch table

I was wondering how I would go about creating a trigger to update the despatch table once a new sale has been inserted into the sales table. I am guessing that the first few lines of the code will look like this: create trigger sale_trig after insert of sale_id on sales ..... But I am not sure how to do the rest. I am using iSQL Plus. ...

XSLT: tricky transformation, need help!

hi! i have to build an XSLT stylesheet that transforms an xml like this: <message> <line/> <silence/> <dot/><line/><line/> <silence/> <dot/> <silence/> <line/><dot/><dot/><dot/> </message> into something like this: <complexMessage> <word code="-"/> <word code=".--"/> <word code="."/> <word code="-..."/> </compl...

integer value of a string

What function is to be used in java so as to print the integer value of a string. Please explain, maybe with the help of an example. Example String: String str = new String("HELLO"); ...

functions taking in two variables

Hello again, I have this question which I don't understand and need help here. 1) I have this function double covertD(double, int), which takes in two arguements and returns a double. It will have to convert between Fahrenheit and Celsius and vice versa. This conversion depends on the passed in integer value. Test case 1 If the p...

Weird C++ templating issues

So basically the assignment was we had to create a doubly linked list that's templated generically instead of locked to a single data type. I've tried compiling both with gcc and msvc and both compilers are giving me roughly the same errors so I'm assuming its just my bad coding and not the quirkyness of one compiler or the other. Curr...

nextval sequence for varchar in sql?

HI there, i was wondering if there was a way of making a nextval sequence for a varchar value? I am using iSQL plus, oracle. For e.g. I have a sales table which consists of sale_id, prod_id, cust_name, sale_name. where i insert the data by doing the following: insert into sales select sale_id_seq.nextval, trunc(dbms_random.value(1,100))...

Is it possible to set a unique constraint as a foreign key in another table?

Is it possible to set a unique constraint as a foreign key in another table? If yes, how would you go about declaring it? How would you go about assigning a candidate key? Is it possible? Sorry, I'm a real noob at oracle. Example: I have a product table that consists of: prod_id, prod_name, prod_price, QOH Where I want prod_name to ...

Beginner's database questions

I am, effectively, a bare beginner to databases, and am very inexperienced at programming generally. For a C# console app (I'm writing with VS Express), which after testing will have a UI added, I need to use a database to store its data. Can someone tell me, or point me to, bare beginner's explanations, and pros and cons, of these dat...

How do you insert into a sorted linked list?

I just need to have a linked list in order by name. I can only get it as far as 1st, 3rd, 5th, .. nodes. I just can't think this far. I want to be a C++ programmer but if I can't understand this is their any hope? STL containers std::lists are not an option for me at this point as a student. What you see in the list function is what I am...

What is an Extension Class?

My teacher asked us to investigate what an Extension Class was but I can't seem to find anything on MSDN or Google. Any help? ...