Questions tagged [homework]

Questions requesting help with school homework. This tag lets potential answerers know that they should GUIDE the student in solving the problem, rather than showing a complete solution. CAUTION: Before posting, consider that classmates may be tempted to reuse code from your post. (Read the tag wiki.)

Filter by
Sorted by
Tagged with
7
votes
4answers
16k views
7
votes
2answers
1k views

Search procedure to find inputted DWORD in MASM Array

Is there any way to make this more efficient? ...
5
votes
1answer
554 views

Fallout-style homework game

I've been going through LPHW (learn Python the hard way) lessons and I am now at exercise No36 where I have to create a similar game. Could you please review it and point out beginner mistakes? <...
6
votes
2answers
1k views

Garden sprinkler system

I was given this assignment below and wrote the code below that as the solution. My instructor has been blasting me for writing inefficient code for my last several assignments, and rails at me for ...
6
votes
1answer
1k views

Finite Automaton for a Typing Game

I'm creating a game that implements a finite automaton and I don't know if I'm doing it right. Any advice? Game class ...
24
votes
8answers
4k views

Feedback on a programming practice problem in C

This is a programming practice that our teacher gave us, and I would appreciate if someone can look over my program and tell me if I did a good job. Basically, the context is I joined a company and ...
5
votes
1answer
1k views

Optimization for add function in queue

I would prefer if more experienced users could give pointers on how I can optimize and think better when writing code. Using Homework Questions as reference, as this is a homework related question. ...
8
votes
2answers
174 views

Inputting and displaying strings

I have written some code for one of my assignments. However, I feel that I am repeating myself slightly in a few places. I have that niggling feeling that there is a better way to do things. Here ...
11
votes
4answers
3k views

Turning an array of words into a random license plate

This is an assignment question from school: Write a method called licencePlate that takes an array of objectionable words and returns a random licence plate that ...
6
votes
4answers
386 views

Organizing semaphores into a pyramid

My homework was to organize semaphores into a pyramid. The task was accomplished, but I ended up with this long ugly conditional and was wondering if anyone can see a better way/algorithm to ...
6
votes
2answers
314 views

Design feedback for automaton to draw a checkerboard pattern

I've just completed the 3rd task of the 1st assignment offered by Stanford's programming methodologies (see the full resources for it here too). I just need some helpful feedback on how my code can ...
15
votes
2answers
1k views

Is this C++ quicksort program okay?

I wrote a quicksort program in C++. Is it okay to implement it this way? Am I using pointers correctly? Is my style okay? Any ideas to speed it up or save memory? ...
6
votes
4answers
1k views

Converting an integer into the written form

For my homework assignment I have to create a class which converts an integer between 0 and 9999 into the written form. For example, 713 would be written as "seven ...
4
votes
2answers
2k views

Battleship type game in Java

I made the code, and it works, but it uses many if conditions and it looks ugly. I would really appreciate it if someone could give me a hand by pointing me in the ...
1
vote
2answers
65 views

Which way should I use while writing this method? [closed]

I've got a homework that is about methods. So first part is Write a method that prompts the customer for the car type. There are three acceptable car types (E: Economy, M: Midsize, F: Fullsize). ...
4
votes
3answers
1k views

Sorting strings in a one dimensional array

What are the better solutions possible? I have a character array with different strings. There is a max size for the strings. In case a string is smaller than max size remaining places are filled ...
6
votes
3answers
264 views

Hour averaging program

I am looking for tips on improving my short program. I am using system("PAUSE") because this was for an assignment. Code: ...
4
votes
4answers
300 views

is there a better way than replace to write this function?

I am doing my homework and i have done this? Is there any other better way to do this? ...
2
votes
2answers
21k views

Calculating a total price by using switch statement and sentinel controlled loop

My homework is to make a program that calculates the total value of products sold. It works, but I use the if statement because it was asking for the quantity on ...
12
votes
2answers
28k views

Perfect Hashing Implementation

I'm building a hash table for this problem: Implement a class for storing a set of integers: ...
0
votes
1answer
107 views

Processing a string from the console

How can I make this program run faster? On enter, I have a string from the console. For example: 1 1 7 3 2 0 0 4 5 5 6 2 1 On exit, it will be ...
2
votes
2answers
1k views

In-order Predecessor BST review

I was referred here from StackOverflow, so here is what I posted over there: So, for an assignment, I have to construct a binary search tree, plus an assortment of related functions. I have them all ...
5
votes
1answer
3k views

How is my quarterly sales statistics program?

Am I making good use of a 2-D array? Is this code inefficient? I am supposed to receive input from 6 departments for 4 quarterly periods in Java. My assignment asks: Quarterly Sales Statistics ...
1
vote
1answer
113 views

Function that multiplies all numbers between “a” and “b” with do loop

I'm making a function that multiplies all numbers between an "a" input and a "b" input with do loop. If you please, check my function and say what's wrong since I ...
3
votes
2answers
957 views

Print largest two integers from a stream

I'm writing a program for my intro to comp sci course where I'm supposed to prompt the user to enter a stream of integers, and then return the largest two. We were given the hint to use a scanner and ...
2
votes
2answers
12k views

Conversion of expression from Prefix to Postfix notation (Problem with precedence) [closed]

I have been attempting to write a code that converts Prefix expressions to Postfix expressions. So far here's what I have made (note that I am new and hence it may not be efficient!) ...
11
votes
4answers
29k views

Simple C++ function to determine the circumference and area of a circle

First off I would like to state that this is a homework assignment. However, I am not looking for you to complete anything for me. I code I am posting is the completed homework assignment. However, ...
3
votes
2answers
455 views

Optimization of exponentiation

I'm writing some crypto code, and as part of it, we have to implement modular exponentiation. I have it working, both with the right-to-left binary method and with the Montgomery formula. While ...
1
vote
4answers
280 views

Insertion vs Selection

I currently have a selection sorting algorithm, but need some help turning it into a insertion sort, I understand a insertion sort if faster? The hand array is full, and it needs to sort from lowest ...
4
votes
2answers
176 views

Ordinary Data Processing Task in Haskell: Vague Misgivings

This is an ordinary data processing task: read a list of dates and amounts (for example, deposits and withdrawals from a bank account) and report the date on which the lowest balance was recorded and ...
3
votes
2answers
2k views

Format names to title case

So I'm writing a program to format names to title case and display them in alphabetic order. Any advice please? And how can i add more methods? ...
2
votes
3answers
1k views

C inner product function without using array subscripting

As part of a question designed to help us understand the relationship between pointers and arrays in C, I've been asked to write an inner product function that doesn't use any array subscripting. Here'...
3
votes
1answer
469 views

Scheme, first timer first program, simple list removal technique

I have started my hand at writing some scheme code. I am trying to get the first n primes. I plan to do so but first getting a list from 2 to ...
3
votes
2answers
295 views

PHP function to compare two Roman numerals

This was for an assignment. I had to write a function to compare two roman numerals. This had to return true only if the second number was larger than the first and ...
2
votes
3answers
905 views

Is this correct java? Attributes and constructors especially

I'm learning java, although because of work I didn't had much time to go to classes. We had a final work to do but since I'm more familiarised with python I'm not sure if I'm doing java correctly... ...
3
votes
3answers
1k views

JavaScript Objects- Can you confirm?

Ok, I am in a JavaScript class, and I have no desire for anyone to do my schoolwork, I have already done what I think is correct, I am just hoping someone can take a look and tell me if I am close, or ...
3
votes
3answers
4k views

Iterating through a dictionary in C#

I am trying to get my dictionary to iterate seven times after the dateTime is found. I want to iterate through the next week of objects in my dictionary ...
5
votes
2answers
5k views

pipe 2 linux commands in C

I am writing a simpel program that can basicly do the same as piping two linux commands can do. For example, ls -l | grep vars.sh, this can be done on the Linux ...
3
votes
1answer
589 views

python: less ugly solution to the intersection of 3 lines in 3 dimensional space

I've tagged this as homework because it was originally a school project, it was accepted but I'm not satisfied with the code. I've used cramers rule to find the intersection of 3 lines in three ...

1
6 7 8 9
10