homework

Rounding up with pennies in Python?

I am making a change program in python. The user must input a dollar amount and then the program will calculate the change in twenties, tens, fives, ones, quarters, dimes, nickels, and pennies. I was instructed to use the round function for the pennies because If I input an amount of $58.79, the program tells me to give 3 pennies back w...

First Java Game: Ideas & Tips

I started learning java last week. ( I took one C class last year.) Now I need to create/code a simple game. Here are the directions, followed by my questions: You get to decide what kind of role-playing game you wish to have. It must either be a top-down view game, or a side-scroller game. The player is to do something: kill things,...

N-gram generation form sentence

how to generate ngram of a string like String Input="This is my car." i want to generate Ngram of this input Input Ngram size = 3 Output should come: This is my car This is is my my car This is my is my car give some idea in java, how to implement that or any library is available for it. I am trying to use this NGramTokenizer ...

corejava Project help needed

Hi I'm Riya a B.Tech. student and i have to make a corejava project on the topic COLLEGE MANAGEMENT SYSTEM . I have created the required database using MS Access. I m facing problem in a code which i m attaching here. Actually i want to update a data in the data base so i have made 2 frames in one of them Roll no. is asked when it is e...

For text box A = a persons name then excute code

I am looking to create a simple project but its turning out not to be so simple. The project I am trying to do is. If textboxA is a persons name, then I want to excute textboxB/10 and display the results in the label box on the form. I try to code the button for textboxA = Andrea Then (labelA.text = textBoxB/10) I am not able ...

Error checking for if a person enters an incorrect name

How would I check for errors. If a person enters an incorrect name or doesnt spell it correctly I would like for a messagebox.show to display a message stating "Incorrect name or spelling" private void button1_Click(object sender, EventArgs e) { String Andrea; String Brittany; String Eric; if (textBo...

Java Problems - ArrayList and Time Elapsed Function

I'm trying to create 5 ArrayLists of various size, fill them with random numbers between 0 and 1, and then time (and print) how long it takes to iterate through each. I think I've initialized and filled them correctly. But when I iterate through and check the time, the numbers are off. I get something like (0, 0, 2, 0, 0 seconds) when t...

Fixing a weird write to file bug in c++

i got this really wierd problem, i'm writing my results to an output file, i use functions A B and C i activate them in that order, the results in the file is printed in a different order, first from A than from C and after that from B. i just can't understand why the results printed in a different order than the activation order. thanx....

how to extract uppercase words from a file, extract unique words

Hi all can you help me out through this question!!! ...

Display all process using a posix function.

I am trying to display currently running process in Ubuntu. Right now I am using system() function to print running process in the terminal. Code: system("ps -A"); This function displays all running process in the terminal. But I want to this functionality using a POSIX function. I am not looking for a ready made code. Can some on...

Greatest GCD between some numbers

Hi, We've got some nonnegative numbers. We want to find the pair with maximum gcd. actually this maximum is more important than the pair! For example if we have: 2 4 5 15 gcd(2,4)=2 gcd(2,5)=1 gcd(2,15)=1 gcd(4,5)=1 gcd(4,15)=1 gcd(5,15)=5 the answer is 5. ...

Help need in creating a hashset from a hashmap

I've been able to read a four column text file into a hashmap and get it to write to a output file. However, I need to get the second column(distinct values) into a hashset and write to the output file. I've been able to create the hashset, but it is grabbing everything and not sorting. By the way I'm new, so please take this into consid...

Big O for code snippet

Hello it has been some time sins i have used Big O notation, so i'm a bit rusty. I know that having 1 loop, that loops n times is O(n), and having 1 loop that loops n time within another loop that loops n times is O(n^2). But in the following code snippet do i have a loop that loops n times, and within that a loop that loops n-i times....

Java homework question

kindly suggest how to use multiple checkboxes using else if in java and please check the code below if(cb1.isSelected()) MyFrame9 m1=new MyFrame9(); else if(cb2.isSelected()) MyFrame10 m1=new MyFrame10(); else if(cb3.isSelected()) MyFrame11 m1=new MyFrame11(); else if(cb4.isSelected()) MyFrame12 m1=new MyFrame12(); else if(cb1.isSelecte...

Error checking problem

For the most part this does work the problem is the message box pops up for Andrea and Brittany but it works correctly for Eric. If I try to put the else statement after each if statement it still pops up on Brittany, and Andrea, but then also pops up on Eric then. Can someone tell me what i am doing wrong. private void button1_Clic...

Do loops and while loops

When I type in the word "Andrea" the program crashes. I am guessing, but I think it's because I am inside the loop and it doesn't know when to stop. If I am correct can you tell me how to get out of the loop. when I put a break in it tells me there is no loop to end. private void button1_Click(object sender, EventArgs e) { ...

C - How to print time in format: 2009‐08‐10
18:17:54.811

What's the best method to print out time in C in the format 2009‐08‐10
18:17:54.811? Atm, I have Thu Sep 9 11:10:08 2010 but can't figure out the above. ...

Stack implementation in C

typedef struct pilha Pilha; struct pilha { char metodo[31]; Pilha *next; }; void create_empty_stack(Pilha *Stack) { Stack->next = NULL; } int main() { Pilha *Stack; create_empty_stack(Stack); } Gives me an execution error. What's the problem with this function? ...

Types of Errors during Compilation and at Runtime

I have this question in a homework assignment for my Computer Languages class. I'm trying to figure out what each one means, but I'm getting stuck. Errors in a computer program can be classified according to when they are detected and, if they are detected at compile time, what part of the compiler detects them. Using your ...

Makefile circular dependency

New to the idea of makefiles. Here is my Makefile: .PHONY: all homework1 CFLAGS= -g -O0 -Wall -Werror -Wno-unused-function LDFLAGS= -lm all : homework1 homework1 : program.tab.o program.lex.o %.o : %.c gcc -o$@ -c $(CFLAGS) $< %.lex.c : %.lex %.tab.h flex -o$@ $< %.tab.c %.tab.h : %.y bison --verbose -o$@ -d $< Whenever ...