homework

Java String to Date without time

Hi all, I'm taking a class in Java and I need to convert a string to a date format (dd/MM/yyyy). I have been using the SimpleDateFormat to format my input, but it is showing the time, timezone and day of the week the date falls. Here is a snippet of my code: SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); Date date = new Date...

What are good criteria for grading programming assignments?

I'm going to be teaching a scripting and tool development class to a group of 3D animators. In amongst teaching them coding fundamentals, I plan to have them pick a repetitive task they must perform frequently and have them iteratively develop a tool to automate or simplify this task as an assignment. What I'd like to know are some cri...

finding the longest road in a Settlers of Catan game algorithmically

I'm writing a Settlers of Catan clone for a class. One of the extra credit features is automatically determining which player has the longest road. I've thought about it, and it seems like some slight variation on depth-first search could work, but I'm having trouble figuring out what to do with cycle detection, how to handle the joining...

program giving error

The logic of the program is quite clear but when it asks the user to enter name. The second time it asks for the name i.e at i=1 it asks for the name and also asks for the year to be entered. In short its not allowing to the user to enter data after i=0 in int year. /* Write a program to take input name roll number and year of joining ...

c++ setting pointer to null crashes program

I have a constructor, that receives a character pointer. If it is empty, I need to set its member variable to NULL, however, the program crashes on exit when I try to. I have verified that it gets to the line where it sets it to NULL and that is the cause of the crash. I've tried the following: val = NULL; val = 0; val = ""; Thos...

Please explain what this code is doing (someChar - 48)

i'm going through some practice problems, and i saw this code: #include <stdio.h> #include <string.h> int main(void) { char* s = "357"; int sum = 0; int i = 0; for (i = 0; i < strlen(s); i++) { sum += s[i] - 48; } printf("Sum is %d", sum); return 0; } can someone explain what the code does, especially the s...

How to merge lines in an SQL query?

MY table looks like this id | string | foreign_id --------------------------- 1 | house | 5 2 | garden | 6 3 | window | 5 ... I have an array of strings and i want to get all foreign ids which match all elements in the array. So i have an array like this [house, window] then i want to get 5. The array of strings can have up to 10 ...

Incorrect syntax near insert

I am a student this is homework... The tables are there but data isn't being inserted. Thanks for any advice Msg 156, Level 15, State 1, Line 181 Incorrect syntax near the keyword 'INSERT'. USE Mort; Go INSERT INTO Employee (Last_name, First_name, Address, City, State, Telephone_area_code, Telephone_number, Job_title, Hire_date,...

Lisp list-contains program

Hi, how can I make a Lisp program that checks if a character, string or number is in a list? (list-contains '(1 a 2 d 2 5) 'a) => T (list-contains '(1 a 2 d 2 5) 'x) => NIL ...

SQL select / group

I am a student this is homework. I'm getting tired and confused. Any advice will be appreciated. I have two tables. Employee has the following columns: Last_name First_name Address Phone Job_title(FK) Wage Job_title has job_title(PK) EEO classification Job_description Exempt_Non_Exempt I need to select the employees’ last ...

need a flowchart

i have to make a program which has a structure name book . it includes name of book author and other details of the book.i have to make a menu driven program which has options to : Add a book delete a book sort books etc I know how to proceed but i cant imagine how would i make a function to add a book.plx give me a flow of the prog ...

i need to use large size of array

My requirement is to find a duplicate number in an array of integers of length 10 ^ 15. I need to find a duplicate in one pass. I know the method (logic) to find a duplicate number from an array, but how can I handle such a large size. ...

How can I control the traffic speed (bytes sent) in Java (Jpcap)

Hello guys, I'm making a network simulation application in my class. I already did the entire code, however I'm getting trouble at controlling the speed of the traffic sent. The user of the app can input the desired speed that he wants to generate (for example 10 MiB/s). I'm doing this control in some really crappy way. I made a UDP/TC...

An onsite implementation question from a startup.

The system maintains a table with 150 pages, and each page contains 1.5 million records hashed with users’ birth date. Each record includes information of username, nickname, birth date, hometown and title. We are required to write a C++ program that transforms this table into another one, which has 100 pages and is hashed with username....

data.dat python

say i have the following data in a .dat file: *A-1-2-3-4*B-8-2-4*C-4-2-5-1-5 how can i print the these data like this?: A : 1 2 3 4 B : 8 2 4 C : 4 2 5 1 5 randomly print any one number for each letter. A, B and C can be any word. and the amount of the numbers can be different. i know that it has some thing to do with the * and the...

simplify complex roots

i have made a program to compute roots of quauation but it does not simplify the roots.can anyone help me to simplify them #include<stdio.h> #include<conio.h> #include<math.h> void main(void) { int a,b,c; float d,d2; printf(" Enter a,b and c:"); scanf("%d %d %d",&a,&b,&c); d=b*b-4*a*c; if(d<0) { prin...

Algorithms Run time Complexity

Hi I suppose to write a program that show the run time complixity I solved two but can't solve the third the code is : { class Program { /* static long F1(long n) { long sum = 0; for (int k = 1; k <= n; k++) { for (int j = 1; j <=n*n; j++) { for (int m = 1; m...

While performing operations will the bookid's get changed?

I have made a program which is a small library operated via software. When I add two books and then delete the first book the second book gets the same bookid as the first book because of count-- in the del() function. I cannot rely on printing the count as the bookid. Is there a better option? #include<stdio.h> #include<conio.h> #inclu...

lists and sublists

say i have an output of this, i think its a list ['', 'AB-a-b-c-d', 'BC-f-c-a-r', 'CD-i-s-r'] i want to make the following: ['',[AB,a,b,c,d],[BC,f,c,a,r],[CD,i,s,r]] or ['',[AB,BC,CD],[a,b,c,d],[f,c,a,r],[i,s,r]] ...

after half of the program it turns like a palindrome

i made the strrev function myself.while compling it says that the code in the func xstrrev() has no effect.i would also like to know that while making a copy of the built in funtion for assignments can we use builtinfunctions(other) in it?as i used strlen() in it. #include<stdio.h> #include<conio.h> #include<string.h> void xstrrev(char ...