Can't Connect Nexus7 To Macbook To Test Program
Feb 16, 2014
I started with Eclipse and wrote the basic "Hello World" app and added a few other lines of a=5, b=9, println (a*b) etc. and ran the program in the screen.
Then I thought that perhaps I could move it onto my nexus 7 and see what it looks like there. [I have a lot to learn I suppose].
The first issue is that I can't connect my Nexus 7 tablet to me macbook pro without using "android file transfer" and then the computer does not show the device in the finder because it is running through the file transfer program.
I have done some research and changed the settings in the nexus to connect as a camera rather than storage but that doesn't work either.
So my main issue now is being able to get the program onto the device - can it simply be copied and pasted into one of the files on the device using the file transfer screen?
View Replies
ADVERTISEMENT
Nov 19, 2014
My code below is trying to make a connect four program without GUI. I'm having trouble with getting the players to make their moves. What should I put in my "makeAMove" method...
Java Code:
public class Connect
final static int MAXROW = 6;
final static int MAXCOL = 7;
public static void main(String[] args){
[code]....
View Replies
View Related
Apr 21, 2015
For the latest assignment, my instructor has asked us to create a program where we create lines of at least for integers and if the program registers there being four of the same integer horizontally, vertically, or diagonally it returns true. For example:
1 1 1 1 1 2 3 4 1 2 3 4
4 3 6 2 2 1 4 5 1 5 6 7
8 2 0 3 3 2 1 6 1 3 5 7
4 7 9 3 5 7 4 1 1 8 9 0
If the program doesn't see four integers of the same value anywhere, it is supposed to return false. I've got it so it returns true for the lines above, 6x6 lines of integers and lines where only four out of six+ integers are equal. However, I cannot get my code to return false if there are only three matching integers in a row/column/diagonal nor can I get the program to print out either true or false for lines that do not start at the top left corner. (i.e 2 3 1 1 1 1) For the former I get this error message:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4
at ConnectFour.is4Consecutive(ConnectFour.java:41)
at ConnectFour.main(ConnectFour.java:32)
For the latter:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 6
at ConnectFour.is4Consecutive(ConnectFour.java:43)
at ConnectFour.main(ConnectFour.java:34)
The answer to fixing my code is probably something small or something that will make me wonder why I hadn't thought of it myself... Here is my code:
import java.util.Scanner;
public class ConnectFour {
private static Scanner sc;
public static void main(String[] args)
{
sc = new Scanner(System.in);
System.out.print("Enter the height: ");
int h = sc.nextInt();
System.out.print("Enter the width: ");
[Code] .....
1 1 1 1
4 3 6 2
8 2 0 3
4 7 9 3
1 2 3 4
2 1 4 5
3 2 1 6
5 7 4 1
1 2 3 4
1 5 6 7
1 3 5 7
1 8 9 0
View Replies
View Related
Apr 5, 2014
I want to connect java program with Ms access.
View Replies
View Related
Nov 4, 2014
User-defined classes. The concept of getters and setters goes right over my head. Right now we're to write a program to test the Person class below. We have to create 2 instances of the class to test each constructor, and test each method.
class Person {
// Data Members
private String name; // The name of this person
private int age; // The age of this person
private char gender; // The gender of this person
// Default constructor
public Person() {
this("Not Given", 0, 'U');
[code]....
then my output will print out the name. But the assignment doesn't tell us to modify the Person class at all, just to create a tester one.
View Replies
View Related
Jun 16, 2014
I'm working on a homework assignment and I keep getting a compiler message this is the message
GradesAverage.java:44: error: variable totalgrade might not have been initialized
System.out.println("Over all you have " + totalgrade);
^
1 error
The homework is this Write a program that has variables to hold three test scores. The program should ask the user to enter three test scores and then assign the values entered to the variables. The program should display the average of the test stores and the letter grade that is assigned for the test score average. Use the grading scheme in the following table:
Test Score Average Letter Grade
90-100 A
80-89 B
70-79 C
60-69 D
Below 60 F
This is my code
import javax.swing.JOptionPane; // Needed for JOptionPane class
import java.util.Scanner; // Needed for the scanner class
public class GradesAverage
{
public static void main (String[] args)
[code]....
View Replies
View Related
Apr 13, 2014
I keep getting an error that says variable can't be found, what am I missing?
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.text.DecimalFormat;
import java.util.Scanner;
public class testscores extends JFrame
[code]...
View Replies
View Related
Jan 13, 2014
I am trying to test values stored in 2d arrays once but i my program just keeps looping what am i doing wrong
Java Code:
tempi=i;
tempx=x;
for( i=0;i<3;i++) {
for( x=0;x<4;x++) {
if(rounded[i][x]<395 || rounded[i][x] >405) {
System.out.println("there is an error with probes "+rounded[i][x]);
[Code] .....
View Replies
View Related
Apr 28, 2015
So in trying to create a circle class, and use the dimensions of that circle (radius, area, etc.) to prove it will equal pie and print (3.141592653589793). This is my code so far it and am getting an error in the last two classes. I know it has to do with Circle(Radius); in the 2nd class but whenever i call upon it, it is assigned to itself. And in the last class im not too sure how to put the B= new b(1,1).
[public class Circle {
private double radius;
public Circle() {
radius = 0;
}
public Circle(double radius) {
this.radius = radius;
[Code] .....
View Replies
View Related
Jan 28, 2015
package Program1;
import java.util.Scanner;
public class Source1 {
[Code].....
using netbeans to debug the program but i'm not sure what I did wrong as it doesnt go past test 1
View Replies
View Related
Apr 1, 2014
I'm making a program for school that reads a text file with answers to a personality test and prints the temperament to an output file. Problem is, it sets the temperament for the first person to INFJ and then prints INFJ for the rest of the people too. My code is below, and the input file 'personality.txt' goes like this:
Betty Boop
BABAAAABAAAAAAABAAAABBAAAAAABAAAABABAABAAABABABAABAAAAAABAAAAAABAAAAAA
Snoopy
AABBAABBBBBABABAAAAABABBAABBAAAABBBAAABAABAABABAAAABAABBBBAAABBAABABBB
Bugs Bunny
[Code] ....
This is my Code :
public static void main(String[] args) throws FileNotFoundException {
welcome();
Scanner input = new Scanner(new File("personality.txt"));
PrintStream out = new PrintStream(new File("output.txt"));
int[][] outcome = new int[4][2];
double[] percent = new double[4];
[Code] .....
View Replies
View Related
Apr 22, 2015
Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Write the following methods in the program:
calculateAverage This method should accept five test scores as arguments and return the average of the scores. determineGrade This method should accept a test score as an argument and return a letter grade for the score, based on the following grading scale
Score Letter Grade
90-100 A
80-89 B
70-79 C
60-69 D
Below 60 F
double test1,test2,test3,test4,test5;
double average;
char grade;
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter the first score");
test1 = keyboard.nextDouble();
System.out.println("Enter the second score");
test2 = keyboard.nextDouble();
[code]....
View Replies
View Related
Nov 25, 2014
I did a problem from my book which is "Write a method that displays an n-by-n matrix. Each element is 0 or 1, which is generate randomly. Write a test program that prompts the user to enter n and displays the n-by-b matrix".
So if a user would enter 3, and output could be 0 1 1
0 1 0
1 0 1
So here's my question... I was able to get the program to work in the way my book describes (by just writing the code in the class with the main), but for practice, I want to learn how to do this OOP-style...
I'm not sure how to do this, though, since the method is a void method, so I can't seem to call it within a toString method.
import java.util.Scanner;
public class MatrixTest {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter an int");
int number = input.nextInt();
MatrixClass mc = new MatrixClass(number);
[Code] .....
View Replies
View Related
Nov 21, 2013
I use Eclipse (kepler version, with JDK 7) on MacBook Pro (Lion).I want to overwrite a line printed on my console. I used "" for that. I was expecting the cursor to go to the beginning of the line. Instead, it is going to the next line.
Code:
System.out.print("Superman
Sober");
Expected Output:
Soberman
Actual Output:
----------------
Superman
Sober
View Replies
View Related
Apr 2, 2015
Four experiments are performed, each consisting of six tests. The number of test results for each experiment is entered by the user. Write a Java program using a nested loop to compute and display the average of the test results for each experiment.
You can run the program by entering the following test results:
Experiment 1 results:23.231.516.927.525.428.6
Experiment 2 results:34.845.227.936.833.439.4
Experiment 3 results:19.416.810.220.818.913.4
Experiment 4 results:36.939.549.245.142.750.6
View Replies
View Related
Dec 26, 2014
I have just started learning about sockets and such... and i have created a chat program with a server and a client
server:
public class Server {
private static ServerSocket server;
private static Socket connection;
private static PrintWriter pw;
private static BufferedReader br;
private static JTextField textOutput;
[Code] ....
so, everything is working fine . There is only one thing i would like to do now: make it so that i can run the server from my computer and then others can run the client from theirs and we will be able to chat . So I tried:
In the client code on line 56 is says:
connection = new Socket("localhost",7777);
So I changed "localhost",7777 to "myip",7777)
But when i run the server on my computer and run the client on another computer i get this error:
java.net.ConnectException: Connection refused: connect
Why is the connection getting refused? is it for security reasons? so hackers cant connect to me or something? And is there a way to tell your computer to allow that client to connect?
View Replies
View Related
Oct 20, 2014
I have compiled and coded the whole thing, but the TIE function when no one wins, isn't popping up. I'm not sure why but here is my code;
import java.applet.AudioClip;
import java.awt.*;
import javax.imageio.ImageIO;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.DataLine;
[code]....
The TIE doesn't pop up, that is all the errors i have, though there is no error messages.
View Replies
View Related
Nov 25, 2014
Our assignment is to make a version of the classic 'Connect Four' game, where we need to construct a GUI that shows the current state of the game and instead of having a winner once a player has four chips in a row, the game needs to continue until no chips can be placed anymore.We currently get stuck in the GUI part. Running it right now results in a board with empty spaces only. Also after choosing a column to place, the board remains empty.
Our question: How do we get the board filled with the right color of chips at the right place?We know the 'ArcsPanel'-class (almost at the bottom of the code) is wrong, but we don't know what to do to make it right.
Main class 'ConnectPanel':
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.GridLayout;
[code]....
At the moment, only the colors white, red and blue are used. This is purely for finding out how to work in general.
View Replies
View Related
Aug 20, 2014
I am trying to learn how to connect to web sites using java. Someone suggested that I learn to "consume an API with java". They also suggested that I practice through a weather website called weather underground and sent me a link [URL] .... I would like to know how to connect to this site to get weather information.
View Replies
View Related
May 1, 2015
soo, is there a way to (via sockets or something like that) connect to a stream via the streamers url (or just via anything) and then get the actual stream? like the images that keeps updating? so that i can display the images/stream on a jframe?
View Replies
View Related
Nov 26, 2014
How can I connect to an SSH server in Java? I don't need/want a shell. I just want to connect to the SSH server and get the content of, say, file.txt. How can I do that? Example : I get host, user,pass in txt and connect it with java code!
View Replies
View Related
Dec 31, 2014
I have a vps set up to running a MySQL database already by zpanel but when I try to connect to the database with Java I am unable to connect and receive the message:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server."
I have MySQL Connector(dev.mysql.com/downloads/connector/j) already added to my build and tried it with both the url and the ip. This is my connection code:
package net;
import java.sql.*;
import javax.swing.JOptionPane;
public class LoginDatabaseConnection {
Connection conn = null;
[Code] ....
The code is from youtube but when I connect to localhost it works fine however when I try to connect to the VPS the above error happens.
View Replies
View Related
Mar 23, 2014
i want o know that how can i connect my sql database to java
View Replies
View Related
Apr 28, 2015
I am a student in an intro to computer science class working on my final project. This is essentially a game of connect 4, but only requiring 3-in-a-row for victory. We were given the base game and a sample file to work with to make an AI that beats our professor's ai in the base game. Here is the base game
package cs110.project3;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
[code].....
View Replies
View Related
Nov 17, 2014
I have to make the connect 4 game be connect 3. Ive edited a code but I the math is over my head. These loop methods check the ways someone can win.
for (int j=0;j<7;j+=2)//need to change
{
if ((f[i][j+1] != " ")
&& (f[i][j+3] != " ")
&& (f[i][j+5] != " ")
&& (f[i][j+7] != " ")
&& ((f[i][j+1] == f[i][j+3])
&& (f[i][j+3] == f[i][j+5])
&& (f[i][j+5] == f[i][j+7])))
//end of loop
[code]....
View Replies
View Related
Jul 22, 2014
I am having a problem to connect my .exe file to the database(mysql). I used launch4j to convert the jar file to .exe but the jar file can connect to the database when running inside the dist folder. When I run the .exe I am getting this error: No suitable driver found for jdbc:mysql.
View Replies
View Related