homework

Candidate Elimination Question---Please help!

Hi , I am doing a question on Candidate Elimination Algorithm. I am a little confused with the general boundary G. Here is an example, I got G and S to the fourth case, but I am not sure with the last case. Sunny,Warm,Normal,Strong,Warm,Same,EnjoySport=yes Sunny,Warm,High,Strong,Warm,Same,EnjoySport=yes Rainy,Cold,High,Strong,Warm,...

Is it possible to call the main(String[] args) after catching an exception?

I'm working on a Serpinski triangle program that asks the user for the levels of triangles to draw. In the interests of idiot-proofing my program, I put this in: Scanner input= new Scanner(System.in); System.out.println(msg); try { level= input.nextInt(); } catch (Exception e) { System.out.print(warning); //restart main met...

How to obtain dependency metrics from Java source code?

For an assignment we have to extract some software metrics from the Hibernate project. We have to extract the afferent coupling and efferent coupling metrics (dependency fan-in, fan-out) from each revision of each package in Hibernate. Some tools were provided which are able to extract these metrics, such as ckjm and JDepend. Other tools...

How to define clock input in Xilinx

Hey, I have almost no experience with Xilinx. I have a group project for a Digital Logic course that is due soon, where my partner, who was supposed to take care of the Xilinx simulations decided to bail on me. So here I am trying to figure it out last minute. I have designed a synchronous counter using a few JK Flip Flops and I need to...

public String shorthand(String in)

Hi All, I am stuck on this code. The code should use the class StringBuilder to build an output string by appending non-vowel characters from its argument in to the result it returns. It needs to identify vowels to be removed using the helper method i created which is public boolean isVowel(char c). public String shorthand(Str...

how to return a list using SwingWorker

I have an assignment where i have to create an Image Gallery which uses a SwingWorker to load the images froma a file, once the image is load you can flip threw the image and have a slideshow play. I am having trouble getting the list of loaded images using SwingWorker. This is what happens in the background it just publishes the resul...

Help with shopping cart in javascript

Hey guys, (question edited) What I am trying to achieve is this: I want button where I can add my item to the shopping cart e.g AddToCart() so I can add my items with the number of quantities that the person will want. To do this I need global arrays like sum, quanitity and name. Except the way I have done it does not have this and I'm...

Simple 'database' in c++

Hello. My task was to create pseudodatabase in c++. There are 3 tables given, that store name(char*), age(int), and sex (bool). Write a program allowing to : - add new data to the tables - show all records - sort tables with criteria : - name increasing/decreasing - age increasing/decreasing - sex Using function templa...

Graph representation in Dr Scheme

I want to represent a graph in Dr. Scheme in the following manner: For each node I want to store it's value and a list of adjacent nodes,the problem which i'm having difficulties with is that I want the adjacent nodes to be stored as references to other nodes. For example: I want node ny to be stored as („NY“ (...

operator overloading of stream extraction operator in C++ help

I'm having some trouble overloading my stream extraction operator in C++ for a hw assignment. I'm not really sure why I am getting these compile errors since I thought I was doing it right... Here is my code: Complex.h #ifndef COMPLEX_H #define COMPLEX_H class Complex { //friend ostream &operator<<(ostream &output, const Complex...

How do I cast a void pointer to a struct in C?

In a project I'm writing code for, I have a void pointer, "implementation", which is a member of a "Hash_map" struct, and points to an "Array_hash_map" struct. The concepts behind this project are not very realistic, but bear with me. The specifications of the project ask that I cast the void pointer "implementation" to an "Array_hash_ma...

How to synchronize multiple proccess in c through basic signal handling

Hi, people. For a academic exercise i have to implement a program in c for nix platform which is to synchronize multiple processes through signal handling, using only signal,pause,kill and fork basic functions. I searched google and have not found any clear example: I hope the wisdom of one of you will light my way. Thanks! ...

Write pointer to file in C

I have a stucture: typedef structure student { char *name; char *surname; int age; } Student; I need to write it to binary file. Student *s = malloc(sizeof(*s)); I fill my structure with data and then i write in to the file: fwrite(s, sizeof(*s), 1, fp); In my file doesnt exist a name and surname, it have an adresses of c...

Pseudo Transparant images

Hello World! For an assignment at university we program in a pretty unknown language Modula 2, which lacks major graphic support. I was wondering how to achieve a 'transparency' effect on images, i figured it would work like this: Create a 2D array for the background area of the image filled with the colours of the different pixels in...

Level Order Successor of node in BST

How can we find level order successor of a node in bst if parent pointer is given(with out using Queue ) ? ...

c++ tables of unions and structures

I was told to write a program, that creates a union and structure, then creates two-element arrays of unions and structures and fills their fields. I have created a union and a structure, but how to fill their fields in arrays ? #include <iostream> #include <stdlib.h> #include <stdio.h> using namespace std; union complex; union comple...

C threads question

Write program that has two threads one is reading numbers from the user and the other is printing them such that the first thread reads a new number only after it has been printed by the second thread. Declare one global varaible to use for reading and printing. #include <stdio.h> #include <pthread.h> #include <semaphore.h> sem_t m; vo...

problem with threads

I want to be done for 10 times, to scan the number and print it again. How can I do that? #include <stdio.h> #include <pthread.h> #include <semaphore.h> sem_t m; int n; void *readnumber(void *arg) { scanf("%d",&n); sem_post(&m); } void *writenumber(void *arg) { //int x =3; //while(x>0) //{ //x ...

Write to a file in java

How can I modify this run method to not only print the srting in the output window, but also write to a file for example outfile.txt in project directory. Also each string should be on a separate line in the file. So I have already created a file in the project directory called outfile.txt A the moment the code is print fine on window ...

Design patterns, how do they differ from other programming styles?

Design patterns aren't necessarily a programming style but rather a template for solving a problem in a number of different situations. But how do they differ from other programming styles? Thanks Edit: "(a) What are design patterns? How do these differ from other programming styles? [7]" ...