homework

Custom Exception Handling in Java

final class DBGlobalsException extends Exception {    String mistake;    //where this is shorthand for chained constructors that look like Exception    DBGlobalsException(String message, Throwable cause)    {      super(message,cause);    }    // elaborate your exception with whatever error state you want to propagate outwards    void ...

Creating a two box JFRAME HELP!

This is what I currently have but its not not showing the results in two textareas.. Right now all it shows is one textarea with Odd numbers only. I'm not sure why the even numbers wont show. Any help is appreciated Thanks! static TextFileInput inFile; static String inFileName = "lab12.txt"; static JFrame myFrame; static Contai...

Errors when compiling

I am trying to turn my array into an arraylist and I am having trouble modifying this part of my class. I don't have my complete class but this part of it. public boolean add(String title, int productID){//true or false statement if ( numberOfRecords == list.length() ){ // I get an error here at list.length() return fal...

Declaring a struct method in C++

I'm trying to create a recurring struct method in my code to walk through a binary search tree. But I'm getting errors on compile and unsure what is the cause. I've got Node* findNode(const Node *, const Object &); in the private section of the .h file and Node* BSTree::findNode(const Node* current, const Object &target){ if(*current...

Easy Java Array Question

Given: an int variable k , an int array currentMembers that has been declared and initialized, an int variable memberID that has been initialized, and an boolean variable isAMember , write code that assigns true to isAMember if the value of memberID can be found in currentMembers , and that assigns false to `is...

Need advice on proper class design

Hi all, I am supposed to write a simple Cinema Booking System, which allows a customer to make reservations for movies. The Cinema consists or different theatres, with different amount of seats, price and movie showtimes. The user should be able to input his name and other credentials and then make reservations for 1 or more movies a...

Looking through an array for an empty string

An array of Strings, names, has been declared and initialized. Write the statements needed to determine whether any of the the array elements are null or refer to the empty String. Set the variable hasEmpty to true if any elements are null or empty-- otherwise set it to false. hasEmpty=false; for (int i=0;i<names.length;i++) i...

How do I finish a reverse string?

So my teacher told me to make a string that makes whatever I type go in the opposite order (e.g. "hello there" becomes "ereht olleh"). So far I worked on the body and I came up with this public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { (The input needs to be in...

Assembly Character Comparison Problem

Hi all, We are trying to implement levensteing distance algorithm in assembly and calling the assembly function from C code. But we have some char comparison problem and could not solve the problem. Function takes two char* parameters. In the first two lines i mov the these addressess to ecx and edx. iminusOne and jminusOne are indexe...

How do I get the indexes of specific elements based on value and then replace them in MATLAB?

From the exercises in a book I am using to learn MATLAB: Given x = [3 15 9 12 -1 0 -12 9 6 1], provide the command(s) that will A) set the values of x that are positive to zero B) set values that are multiples of 3 to 3 (rem will help here) C) multiply the values of x that are even by 5 D) extract the values of x that are greater tha...

Big-O Notation Code Algorithm Analysis Homework

for(int i=N; i>0; i=i/2) irrelevant statement; I am asked to find the complexity class and I am unsure of whether I am supposed to use Big-Omega notation or Big-O? But I am assuming that it is O(N/2) and then O(N) if I drop the constants. for (int i=0; i<N; i++) for (int j = i+1; j<N; j++) irrelevant statement; ...

Big O of pre order traversal, in order traversal ,post order, level order for tree

Please let me know the Big Oh of the above. ...

Binary Search Tree Height

I was asked to build a binary search tree after adding about 20 values in a specific order and I finished and found the size to be 16 and the height to be 4. But part (c) of the question asks me to find the Height (after removal) I am unsure what this means and would be grateful if somebody could clarify what this means. ...

Write a program that reduces a fraction. (C programming)

You are to write a program that requests that the user inputs a fraction of the form n/d with d nonzero. Your program then prints out the fraction in reduced form. The program then asks if the user would like to process another fraction and continues to do so as long as the user replies with Y. A fraction n/d is in reduced form provided...

Beginner in a desperate need of python help.

Beginner programmer here! I need to write a simple phone book application. My program should be able to add names and phone numbers to a database. I should use a dictionary to store the information. If the user's input is empty, my program should stop, otherwise it should keep on asking inputs. Honestly I am lost here. I need help. ...

UDP Broadcasting for automatic search of servers

I am making a multiplayer networking game. Now to connect to the server, client needs the ip address of the server. So, the way I implement this is as follows. Client Broadcasts its ip address at Broadcast IP and a port say A. Server listens to it over A, and Server creates a new UDP connection with the client behaving as a client say...

Bitmap in C, binary operations

Hi I am about to create a bitmap that holds control of 512 bits, all 512 bits should be 0 to indicate that the bit is free when the program starts. Function occupyDataBlocks(int number) should find free bits put the position of the bit in the array int data_blocks[] and set the occupied bit to 1. Under is some code that does some of t...

OpenGL MODELVIEW rotations manually

Hello, For my graphics class, our professor wants us to keep track of our current matrix on our own and apply rotations/translations/scaling matrices to it then load it using glMatrixMode(GL_MODELVIEW) and glLoadMatrix(current_matrix). All of this seems fine, but when I actually use it, I keep having an issue: if I apply a rotation to ...

Python Bed module

Hi, I need to create a Bed module with these functions: readBed(file)
–
read 
a 
BED 
format 
file 
and
 constructs 
a 
list 
of 
gene 
model 
objects 
from 
the
 data
 it 
contains.

 writeBed(models=models,fname=file)
 – 
writes 
the 
given 
list
 of
 gene 
model 
objects
 and 
 writes
 them 
to 
a
 file 
named 
fname. For the read...

Convert java to mips

//***********************************************************************// // // //**********************************************************************// package javaapplication1; public class Main{ public static void main(String args[]){ // declare two arrays of char char []a ; char []b; // Two Strings to be ch...