homework

Scheme How to create a list.

Okay this may sound like a ridiculous question, but how do you return a list in scheme.? ...

Scheme homework problem, need help.

Okay one of my homework problems is to take a list of lists and return the car of each sublist as a list. I have it to where I can print out the values, but it's not a list. To be honest, I have no clue how to output lists. Here's what I got: (define (car-print alist) (if (null? alist) (newline) (begin (write (car...

Is there an automated way to make sure that all parts of code is unit tested?

I have written JUnit tests for my class, and would like it to tell me if there is any part of my code that is not unit tested. Is there a way to do this? ...

To Plot a x-y graph in c# in Visual Studio 2008?

Using two parameters to plot a line graph in C# using Visual Studio ( Using GUI). ...

Searching an unsorted array

What would be the smallest and largest number of comparisons in an unsorted array that could have duplicate elements as well ? I understand that finding anything in an unsorted array is a O(n) problem. But, is this true if the array contains duplicate elements as well ? By duplicate elements I mean, elements that occur more than once i...

Java: Using Command line arguments to process the names of files

I'm a writing a program that will determine the number of lines, characters, and average word length for a text file. For the program, the specifications say that the file or files will be entered as a command line argument and that we should make a TestStatistic object for each file entered. I don't understand how to write the code for ...

How can I find the first non-repeating character in a string using Perl?

Write a function that returns the first non-repeating character in a string. Example: “Thanks for visiting" returns "h". ...

How can I extract sentences with a particular phrase, in Perl?

How can I write a Perl script that would scrape out sentences that mention 'Calvein Klein' in articles in a file named by $file? (Sentences can cross zero or more CR/LF characters.) I want to create an array of sentences scraped and print it at the end. ...

Scheme homework Black jack help....

So I need to do a game of blackjack simulator, butt can't seem to figure out whats wrong with the shuffle it's suppose to take a card randomly from the pack the put it on top of the pack. The delete it from the rest. so : (ace)(2)(3)(4)(5)...(k) if random card is let say 5 (5)(ace)(2)(3)(4)(5)...(k) then it deletes the 2nd 5 (5)(ace)(2)...

C++ Memory Allocation & Linked List Implementation

I'm writing software to simulate the "first-fit" memory allocation schema. Basically, I allocate a large X megabyte chunk of memory and subdivide it into blocks when chunks are requested according to the schema. I'm using a linked list called "node" as a header for each block of memory (so that we can find the next block without tediou...

jQuery to add vertical scroll bar for a fixed height div container

Hi all: This is uni homework so sorry about :my password protected url Please enter usersame as "uts" and password as "10479475", without the wrapper quotes. It it almost completed, please follow simple steps to see where my problem dwells: (preferably using Firefox, no IE6 welcomed :)) step1: click on any continent highlighted on w...

Java Bucket Sort on Strings

I can't figure out what would be the best way to use Bucket Sort to sort a list of strings that will always be the same length. An algorithm would look like this: For the last character position down to the first: For each word in the list: Place the word into the appropriate bucket by current character For each of the ...

Counting the number of characters in a file

I'm writing a program that for one part asks for the program to print how many characters (including whitespaces) are in a file. The code I have right now though returns 0 every time though and I'm not sure why it isn't counting the characters. public int getcharCount(Scanner textFile) { int count = 0; while(textFile.h...

how to do bar chart in c

i have written a program that prints out the integers in the same order as the input with 5 numbers per line. That is, the first 5 integers will be printed in the first line; the next 5 integers in the next line; andso on. and also i was trying to print out the numbers in a bar chart formatt:like 81-105 ( 1) x 56-80 ( 5) xxxxx 6-11(5) ...

Overriding or overloading?

Guys I know this question is silly but just to make sure: Having in my class method: boolean equals(Document d) { //do something } I'm overloading this method nor overriding right? I know that this or similiar question will be on upcoming egzam and would be stupid to not get points for such a simple mistake; ...

Help with bugs in a C code

This C code is giving me some unpredictable results. The program is meant to collect 6 nos and print out the max, position of the max no and the average. It's supposed to have only 3 functions - input, max_avr_pos and output for doing what the code is supposed to do but I am getting unpredictable results. Please what could be the problem...

java phone number validation....

Here is my problem: Create a constructor for a telephone number given a string in the form xxx-xxx-xxxx or xxx-xxxx for a local number. Throw an exception if the format is not valid. So I was thinking to validate it using a regular expression, but I don't know if I'm doing it correctly. Also what kind of exception would I have to throw...

Displaying an inverted pyramid of asterisks

I help with my program. I am required to create a inverted pyramid of stars which rows depends on the number of stars the user keys, but I've done it so it does not give an inverted pyramid, it gives a regular pyramid. #include <stdio.h> #include <conio.h> void printchars(int no_star, char space); int getNo_of_rows(void); int main(void)...

Scheme redefine a list...

I have a list called hand and another one called deck, the main goal here is to take the first card (or element ) in the list deck and put it in the list hand when i call the fnction draw... > (draw hand deck) (2 C) > (draw hand deck) (2 C) (3 H) > (draw hand deck) (2 C) (3 H) (K D) but everytime i call it the hand never changes valu...

function parameter used to store value

Hi, I have to define an interface. The API in my homework is stated below: int generate_codes(char * ssn, char * student_id); int denotes 0 or 1 for pass or fail. studentid is an output param should return a 6 digit id. ssn is a 9 digit input param they school program will take ssn's and use my code to generate the student id. ...