homework

Student's Result program in Java

import java.io.DataInputstream; class Student { int roll; void getdata(int r) { roll=r; } void putroll() { System.out.println("The roll number is: "+roll); } } class Test extends Student { int sub1,sub2; void getmarks(int a, int b) { sub1=a; sub2=b; } void putmarks() { System.out.println("Marks 1= "+ sub1 + "\n Marks 2= "+su...

Error in Java Expression

Does the following Java statement have an error in it? If so, what is it? P *= x/y ...

How to compute 10000! without mult/div/mod

This is intended as a programming challenge. Faster solutions better. Note cannot use normal primitives. ...

Can someone explain how Big-Oh works with Summations?

I know this isn't strictly a programming question, but it is a computer science question so I'm hoping someone can help me. I've been working on my Algorithms homework and figuring out the Big-Oh, Big-Omega, Theta, etc, of several algorithms. I'm proving them by finding their C and N0 values and all is going well. However, I've come a...

Why is squaring a number faster than multiplying two random numbers?

Multiplying two binary numbers takes n^2 time, yet squaring a number can be done more efficiently somehow. (with n being the number of bits) How could that be? Or is it not possible? This is insanity! ...

How do I calculate page table size?

I would like to know how to calculate the size of the page table (in bytes) if there is one entry per page, each entry requires 4 bytes and my page size is 64KB. ...

manipulating time in python

In the code shown below, I need to manipulate the time var in python to display a date/time stamp in python to represent that delay. for example, when the user enters the delay time in hours, i need to set the jcarddeliver var to update itself with the value of the current date/time + delay also it should update the date var as well. for...

Calculate the number of days a person has been alive on his Nth birthday? (Leap year challenge)

How to calculate the number of days that person has been alive on his Nth birthday? given his birth month, day, year, and his age? How to solve the leap year challenge? ...

My 'cout' isn't giving correct value - why?

Simple "sum of digits" code. Compiles but when executed, the last cout gives a "0" for the num int rather than the actual user-input number. Feel free to c&p into your own compiler, if you're so inclined, to see what I mean. How can I get this to output the correct "num" value? Thank you! ~~~ #include <iostream> using namespace st...

Converting alphanumeric to ascii and incrementing

Hello all, I'm stumped on how to convert 3 letters and 3 numbers to ascii and increment them by one...it's the old next-license-plate problem. Can anyone give me a nudge in the right direction? ...

How can I find a Binary tree from a given Traversal Method?

How can I find a binary tree from a given traversal method (inorder,post-order,pre-order)? ...

How to Design a Rectangle Class?

Consider a rectangle with sides X and Y, and area Z such that Z=X*Y. The rectangle has to be modeled into the cleanest OOD which will supply the following two services, Given side X and side Y, calculate area Z. Given side X and area Z, calculate side Y. One possible design I was thinking on is, A class Rectangle that have private...

Sorting Doubly Linked List C++

hey guys, as of right now the sort function that I have only sorts 1 node out of the many. I need this function disregard the node that is sorted only after it is printed. I've tried removing the node so that it is not considered twice for the sort, because It will keep printing that same sorted node over and over again. That didnt ...

JButton needs to change JTextfield text

This is homework. Beginning Java class. Still wrapping my head around this stuff. The project is to make an Inventory Management System. I have everything figured out except how to make this button change the text in a JTextField. It needs to add info from an array of a product (DVD's in this case). The book talks about different wa...

JButtons need to modify 8 JTextFields using an Array. Listen to Buttons or Text?

This is homework. Beginning Java class. Still wrapping my head around this stuff. This questions Extends this one So there is a button for First, Prev, Next, and Last Each should modify Item ID, Name, Rating, Price, Units, Value, Fee, ValueW/Fee, Total Inventory Value The last one is a static total of all units) I am not sure if ...

towers of hanoi variation pseudocode

This is a variation to the original towers of hanoi problem. The same rules apply but instead of just one stack of n disks there are two. One stack of red disks on the left pole and another stack of purple disks on the right. The final configuration should be the purple on the left and red on the right. There are a total of 3 poles. I'm ...

C++ Stack by Array Implementation.

Hey all! Thought I'd post anotherhomework question if thats alright :x What I want to happen is for the pushFront(int) function to do this: bool stack::pushFront( const int n ) { items[++top] = n; // where top is the top of the stack return true; // only return true when the push is successful } items is a struct type of the object...

How to run Netbeans IDE Java Desktop Application from command line ?

Hello, I have created one Java desktop application.I have to run it from command line How should I do that ? ...

Octave + GNUPlot + Aquaterm + Mac OS 10.6 -- Student Needs Help!

Greetings, I'm the only person in my Numerical Analysis class attempting to do all of the MatLab based homework assignments in Octave - the opensource representation of MatLab. However, I'm having problems getting graphs to plot and I think it's a simple linking problem. I am running: -Mac OS X Snow Leopard (10.6) -Octave 3.2.2 -Aqua...

How can I implement the unification algorithm in a language like Java or C#?

I'm working through my AI textbook I got and I've come to the last homework problem for my section: "Implement the Unification Algorithm outlined on page 69 in any language of your choice." On page 69, you have the following pseudo-code for the unification algorithm: function unify(E1, E2); begin case both E1 a...