homework

Help me check homework for write a recursive method that counts the number of nodes in a chain of linked nodes.

I try many coding to solve the question bellow but also cannot find the answer. Can anyone help me solve my problem and tell me where is the wrong coding?? /** Task: Recusively counts the nodes in a chain. * @param start the first node * @returns the number of nodes in the linked chain */ public int countNodes(Node start) { if (start ==...

Show the step to find the total operations of the algorithm

Bellow is some Java code for the question: int total1 = 0; int total2 = 0; for (int x = 0; x <= n; x++) total1 = total1 + x; for (int y = 1; y < n; y++) total2 += total1 * y; Based on the question above, I do an answer likes bellow. Please help me check my answer right or wrong. Thanks for your helping. Operation Numbe...

Which of the following statements are true?

public class CreditCard { private String cardID; private Integer limit; public String ownerName; public void setCardlnformation(String cardID, String ownerName, Integer limit) { this.cardID = cardID; this.ownerName = ownerName; this.limit = limit; } } Which is true and Why ? A. The class is fully enc...

Pattern of HASH characters (#) with Java loop

Hello i need a program that reads a number and then prints a square pattern of (#) hash. But each edge needs the same number of hashes eg enter a number: 5 ##### ##### ##### ##### ##### this is what i have so far import console; print("write a number: "); int n = readInt(); int nva=0; String i="#"; while (nva<n){ print(i); ...

What is a fast algorithm for finding critical nodes?

I'm looking for a quick method/algorithm for finding which nodes in a graph is critical. For example, in this graph: Node number 2 and 5 are critical. My current method is to try removing one non-endpoint node from the graph at a time and then check if the entire network can be reached from all other nodes. This method is obvious not...

Regular Expression for all positive even numbers

I am currently enrolled in Translation Applications and we are working on regular expressions. This IS a homework problem. I have been at this one for a while I am just confused. I don't want just an answer, an explanation would be greatly appreciated just making sure that I learn it. I just need a regular expression for all even number...

Beginner C programming help

Ok, to start off, I am taking a C programming class this semester, and somehow was allowed to register even though I have not taken the prerequisite course. I thought I would still be able to handle it, but now that I have passed the point of no return for dropping it, I have found myself completely lost. For my present assignment I am...

How to optimize my current getMax method to retrieve the highest number in an array?

What would be the best way to optimize this code below to make it more efficient while applying the 'best practices'. This is just a simple school project and it works, I've tested it. But I just feel like there's a better and more efficient way to write this method. What do you think? I have an array that is pre-populated with a bunch...

C - Pointer problems - how to fill array with value pointer is pointing to?

I have a function void add_car(char *car) { park.buffer[park.size] = car; park.size ++; } car is a string like "XYZ". Atm, It seems to assign the carpark buffer array element to an address. Thus if I fill the array with 10 cars, I get back 10 cars, but each of them is the latest one, since the address of car was overwritten. H...

Writing a Prototype Constructor in C++

homework help time! I am taking a quadratic expression, where y=ax^2 + bx + c with a,b,c are constants and x is a variable. Here is my class: class quadratic { public: double evaluate(const double x); void getCoefficients (double &A, double &B, double &C); void setCoefficients (const double A, const double B, const double C); private:...

Java Regex for genome puzzle

I was assigned a problem to find genes when given a string of the letters A,C,G, or T all in a row, like ATGCTCTCTTGATTTTTTTATGTGTAGCCATGCACACACACACATAAGA. A gene is started with ATG, and ends with either TAA, TAG, or TGA (the gene excludes both endpoints). The gene consists of triplets of letters, so its length is a multiple of three, a...

How to install implementation of Corba on my computer and then program using any language compatible with Corba

I have to do a project in Corba.I have absolutely zero knowledge of corba.Things that I've to do is first is to install a corba implementation on my PC.After that I have to develop a Photo Printing Portal in any programming language supported by Corba.After that I have to deploy my application on the supplied ORB. Please suggest how shou...

Sum integers in 2d array using recursion ?

Hello! I need some help with this problem. I have to sum alle the integers in a 2d array using recursion. Below is what I have managed to do on my own, but I'm stuck. This code generates the sum 14, which should be 18. Any suggestions? Is the base case wrong? Or is the recursive method wrong? public class tablerecursion { public static...

Oracle SQL Issue with Insert Statements

So I am a beginner to this, and trying to follow my professors instructions on how to complete this. They are as follows: Consider the relational database described in Tables 1-3. The underlined attribute(s) is the primary key for a table. Use your Oracle account to create this database and to insert the tuples listed in each table. ...

Help building RSS reader in Java

For a class project, I'm trying to write a simple RSS reader for my Java class. I am trying to walk the DOM tree just to get the experience doing it although I know there are better more efficient ways and tools. I have a ReaderObject that gets the basic title, link, description, and a List to hold RSSItem objects that have the instan...

Identifying which Algorithm is which and explaining the running times

For a given problem with input size n, Algorithms A,B,C are executed. In terms of running time, one of the algorithms is O(n), one O(nlogn) and one O(n^2). Some measured running times of these algorithms are given below Input Size 512 1024 2048 A 70 ...

Java login screen using a textfile

I am creating a java application and I need to get the user PINs from the text file. I used the following code below, but is it not working properly. Could anyone please help me out soon..... String typedPIN=""; Menus obj1=new Menus(); BufferedReader getIt=new BufferedReader(new InputStreamReader(System.in)); String u...

java guess the number game

import java.awt.*; import java.awt.event.*; import javax.swing.*; public class guess extends JFrame implements ActionListener { JLabel title = new JLabel ("SAMPLE 1"); JTextField txt1 = new JTextField (10); JLabel direction = new JLabel ("GUESS A NUMBER BETWEEN 1 AND 100"); JLabel status = new JLabel (); JPanel pnl1...

Not so Useful Error -- Segmentation Fault (Core Dump) in Homework Assignment

When compiling a program containing this particular function, /* * Function read_integer * * @Parameter CHAR* stringInt * * Parameter contains a string representing a struct integer. * Tokenizes the string by each character, converts each char * into an integer, and constructs a backwards linked list out * of the digits. * * @...

read/write in python !

Hello everyone, can someone help me do this : I first open a file: Date=open('Test.txt','r') but what I am looking for is how to read line number 12, then check if it contains the word "Hey!", and in that case print "Found Word", otherwise print "not found" and write "Hello Dude" after 30 letters. ...