homework

Make function of this repetitive piece of java code

I've got this piece of java code: int maxDigit = 4; for(int a = 0; a <= maxDigit; a++) { for(int b = 0; b <= maxDigit; b++) { if(b != a){ for(int c = 0; c <= maxDigit; c++) { if(c != a && c != b) { for(int d = 0; d <= maxDigit; d++) { if(d != a && d != b && d != c) ...

How would I write this program for controlling a remote control car with voltage drops?

So my partner and I need some help; we are working on a final project which is for an electrical engineering degree. Our problem, no one really knows much programming in the class. We need help or some general ideas on how to program this. The project: We have a monster truck with two IR (infra red) sensors detecting it's path via volt...

stack, printing after the pop

i have a problem with my program. It should be program that recognize palindome through the stack. Everything works great, only thing that don't work is printing stacks(original and reversed) after the funcion is done. Here is my entire code, and the problem is at case d and e: #include <iostream> using namespace std; const int MAXST...

How to convert a 3D point into 2D perspective projection?

I am currently working with using Bezier curves and surfaces to draw the famous Utah teapot. Using Bezier patches of 16 control points, I have been able to draw the teapot and display it using a 'world to camera' function which gives the ability to rotate the resulting teapot, and am currently using an orthographic projection. The resul...

Is it appropriate to ask for subjective input on self-taught homework code?

I'm teaching myself Java, and it's (effectively) my first programming language. Sometimes when I complete an exercise I wonder if I've done things in the right way. For example, perhaps I write a little program that successfully copies a file. Have I dealt appropriately with the things that can go wrong? Is my code unusual, or hard...

function trying to put dot after n characters

I am trying to write a function, it has 2 parameters one is of string and another is of number datatype, my function has to place a dot after every N characters, where N is provided at run time (some number provided through number datatype). Can anybody help me out please? ...

How does a string differ from an array of char pointers in C?

I was under the impression that they were the same thing. However, it looks to my like they are being treated differently here. The part I am confused about looks like this. Foo* initFoo(char* name); int main { Foo* foo; char* player_name[25]; scanf("%s", player_name); foo = initFoo(player_name); } Foo* initFoo(char* name) { ...

MIPS code broken

I'm working on some MIPS code for my Computer Organizations class, and well I just can't seem to get the MIPS to work correctly and there's not that many MIPS resources online. I'm running the code on PCSPIM. The code is supposed to add 10 to the contents of array2 and store them in array1 and then print array 1. Reworked the code works ...

How do I add text to graph in Perl's GD::Graph?

I am drawing a graph using GD::Graph module in Perl. I can draw the graph fine but in the drawn image I want to add some text around the top of the drawn graph image. Basically just want to add some text to this drawn image. However, I don't see an option to do that. Does someone know if this is doable? ...

Finding all the subsets of a set

I need an algorithm to find all of the subsets of a set where the number of elements in a set is n. S={1,2,3,4...n} Edit: I am having trouble understanding the answers provided so far. I would like to have step-by-step examples of how the answers work to find the subsets. For example, S={1,2,3,4,5} How do you know {1} and {1,2} ar...

error with FileOutputStream

I'm having trouble with the following code. I'm trying to write to a .ppm file, and I get "Red.java:6: unreported exception java.io.FileNotFoundException; must be caught or declared to be thrown" FileOutputStream fout = new FileOutputStream(fileName); ^ Any ideas? import java.io.*; public class Red { ...

How to display data from txt file in specific format

I have a text file input which contains data as below. How can I display data from the text file into specific format? Monday Jessy Walking 20 minutes Matthew Run 20 minutes Karen Jogging 40 minutes Jessica Run 12 minutes Tuesday Messia Walking 10 minutes Matthew Run 20 minutes Pete Run 10 minutes Carol Walking 30 minutes I want to dis...

Linked lists,polynoms ,overloading operators << and >> in C++

I have to build a class polynom (polinom) inherited from class lista (list). I have to add , substract ,multiply , divide 2 objects from the polynom class. I have this piece of code. I don't understand why my destructors aren't working. I also have to overload the operators: +,-,<<,>> but I don't know how to. #include <iostream> #inclu...

How do you compare 2 items in a generic list?

I wrote a linked list implementation for my java class earlier this year. This is a generic class called LList. We now have to write out the merge sort algorithm for a lab. Instead of creating a new List implementation that takes Ints, I decided to just reuse the generic list I had created before. The problem is how do I compare two gen...

OnKeyUp event in Access 2007

I have a textbox and a label in an Access form. Whatever is typed in the textbox needs to be reflected/mirrored in the label and I must use the OnKeyUp event for the textbox. How can I do this? This is a homework assignment. I have no programming experience and this is my first programming class. So far I have this: Private Sub Text0...

Simple exception handling in Java

Can you please let me know if my code is correct? I'm studying for my test in two hours so I dont really have time to write an application to test it. Question is: if I have a JLabel with a number as its label. simply a label that says 34 for example. I want to extract the number from the label. but i need to handle exceptions, i.e i...

Java runtime vs OS calls

The Java runtime provides a set of standard system libraries for use by programs. To what extent are these libraries similar to the system calls of an operating system, and to what extent are they different??? ...

'Multipurpose' linked list implementation in pure C

( if you get easily bored reading long posts, you can focus on the bold parts ) Hello all! This is not exactly a technical question, since I know C kind of enough to do the things I need to (I mean, in terms of not 'letting the language get in your way'), so this question is basically a 'what direction to take' question. Situation is: ...

How do I find the smallest item in an array?

I have an array, and need to find the index of the smallest item. a = [2, 2, 2, 3, 3, 4, 3] This should return 0. Please note that the content and ordering of the array must not be modified. I am looking for a solution in either C or Java. ...

Symbolic JCL Confusion

I am a bit confused on how to create a symbolic variable in JCL for an assignment I am doing in my COBOL class. For example, I am supposed to "Specify a symbolic parameter for the PARM option and specify TEST and APOST as the default." How do I designate the "PARM" option to be a symbolic parameter? EDIT: Forgive the oversight; it see...