Lets say have this immutable record type:
public class Record
{
public Record(int x, int y) {
Validator.ValidateX(x);
Validator.ValidateY(y);
X=x;
Y=y;
}
public final int X;
public final int Y;
public static class Validator {
public void ValidateX(int x) { if(x < 0) { throw n...
I am using netbeans glassfish bundle to create a webservice. I am adding operations to the webservice from the design view. In the exception tab I noticed theres no way to create a custom exception and you can only search for a predefined exception. Is this a standard for webservices? Or can I just create my own exception classes and the...
What methods should i be implementing?
How do you individually pop off characters from the strings in the .txt file?
How should i approach making the bins?
...
Hey All :)
Well I was doing this simple code snippet to generate the Month name by using the Day Number! But I Got This Error.. Im not trying to change MonthName into int!
class Module04
{
public static void Exercise01()
{
Console.WriteLine("Please Enter a day number between 1 and 365: ");
...
Consider a file on disk containing 100 records.
For both searches, what is
the average number of comparisons needed to find a record in a file.
number of comparisons if the record is not in the file
the average number of comparisons if the record has a 68% chance of being in the file
the number of disk accesses in the previous 3 quest...
I've been working on my module exercises and I came across this code snippet which reads the notepad file and prints the details about it.
It's working fine, but I just want to know how to give the path of the notepad file in the code itself other than giving the path in the command line.
Below is my code.
class Module06
{
public...
Hey there, I'm having trouble separating numbers and characters from my input string. The purpose of my program is to add,subtract,multiply and divide in postfix
so i cant predict the input form as it can be anything from
2 2 3 + * (answer being 10) to 2 2 + 3 * (answer being 12). So i cant use sscanf to extract the numbers and the opera...
Hi -
I'm working on a hw problem that asks me this:
given a finite set of numbers, and a target number, find if the set can be used to calculate the target number using basic math operations (add, sub, mult, div) and using each number in the set exactly once (so I need to exhaust the set). This has to be done with recursion.
So, for...
Basically i am having problems with my code - this is homework so would rather not post it in here for obvious reasons. If it becomes truely important for me to do so then i will have to as i am so stuck.
i am reading 2 text files and it also has a seperator , these values come from the command line, just assume that the seperator in th...
Ferryboats go back and forth, carrying passengers from one side of the canal to the
other. Each boat can hold at most C passengers. The passengers wait for the boats to
ferry them across the canal. A boat can start crossing the river only when it is full. A
boat cannot start loading passengers on one side of the canal if another boat is ...
For sequential search, what is the average number of comparisons needed to find a record in a file?
...
I am adding musicCD information to a set. I have two different functions for this. The problem is adding the musicians. Its only adding the last musician being passed in like its copying over the first ones.
here is the required output to give you an idea of the info. Only ringo starr is adding and not "George Harrison" "John Lennon".
...
I am trying to add a custom title to a window but I am having troubles with it. I know my code isn't right but when I run it, it creates 2 windows instead, one with just the title tk and another bigger window with "Simple Prog". How do I make it so that the tk window has the title "Simple Prog" instead of having a new additional window. ...
I can't think of an example where the reference count of a file may not be zero even when it is no longer possible to refer a directory or file.
The only example that I could find for a general graph directory structure is this:
(Node 1 would be the north node, Node 2 would be the node Node 1 is pointing too, and so on and so forth)...
This is only the first part of my homework, I've fixed all the other compilation errors but I keep getting this error, theres five.
1>\takehome\main.cpp(39) : error C2065: 'j' : undeclared identifier
1>\takehome\main.cpp(44) : error C2065: 'j' : undeclared identifier
\takehome\main.cpp(45) : error C2065: 'j' : undeclared identifier
\tak...
Implement the “Word Decoder” game. This game will present the player with a series of scrambled words (up to 20 words) and challenge him/her to attempt to unscramble them. Each time a new word is displayed, and a text input is provided for the user to write the unscrambled word.
Once the player thinks the word has been properly decoded, ...
I have a binary file which contains records. The structure of the file is as such:
Structure (see below)
Name String
Address String
The structure in question:
typedef struct{
char * name;
char * address;
short addressLength, nameLength;
int phoneNumber;
}employeeRecord;
employeeRecord record;
I get the name as such:...
Hello. I am trying to make a program that determines if the number is prime or composite. I have gotten thus far. Could you give me any ideas so that it will work? All primes will , however, because composites have values that are both r>0 and r==0, they will always be classified as prime. How can I fix this?
int main()
{
int pNumbe...
Hello everyone,
I am having trouble with a homework question that I've been working at for quite some time.
I don't know exactly why the question is asking and need some clarification on that and also a push in the right direction.
Here is the question:
(2) Solve this problem using one single subscripted array of counters. The pro...
I am to the point where I feel as if I correctly wrote the code for this homework assignment. We were given a skeleton and 2 classes that we had to import (FileIOHelper and Student).
/*
* Created: *** put the date here ***
*
* Author: *** put your name here ***
*
* The program will read information about students and their
* sc...