Creating A 4x4 Gird
Feb 6, 2015
I am having trouble developing a 4x4 grid that has the letters A-Z and a-z and the corresponding ASCII numbers for each letter. I have created the code to retrieve these letters and their corresponding ASCII numbers, I only am having trouble with creating the grid and displaying these numbers and letters in their separate 4x4 grids: one grid for (a-z), one grid for (A-Z), one grid for (ASCII# a-z), one grid for (ASCII# A-Z).
Java Code: // Constants Declaration Section
//*******************************
public static void main(String[] args)
{
// Variables Declaration Section
//******************************
[code]...
View Replies
ADVERTISEMENT
Jun 8, 2014
Im creating a program that has about 20 different input forms. Fairly standard forms but what i need to know whats the easiest way of creating forms. Is there some way of using templates or some plugin to quickly generate forms.
View Replies
View Related
Dec 9, 2014
Empty the following csv table to a map, where the key is a calendar, and the value is arraylist. The table represents the sock values of Google fro a period of time.
"Date,Open,High,Low,Close,Volume,Adj Close
12/8/2014,527.13,531,523.79,526.98,2323000,526.98
12/5/2014,531,532.89,524.28,525.26,2552700,525.26
12/4/2014,531.16,537.34,528.59,537.31,1388300,537.31
12/3/2014,531.44,536,529.26,531.32,1274500,531.32
12/2/2014,533.51,535.5,529.8,533.75,1521600,533.75
[Code] ....
-----------------------------------------------
import java.util.*;
public class Mymap {
public static void main(String[] args) {
Map<String,List<String>> map=
new HashMap<String, List<String>>();
map.put());
Code] ....
View Replies
View Related
Feb 17, 2015
creating a table, and this is the code that I go down so far:
import java.util.Scanner;
public class program1 {
public static void main(String[] args)
{
String heading1 = "Quiz 1";
String heading2 = "Quiz 2";
String heading3 = "Test 1";
[code]...
View Replies
View Related
Jul 23, 2014
I'm new to Web Services and I've been finding trouble when creating my first one. Before talking about the problem, I'd like to show you the process I followed to see if it's ok. Note that I'm using Eclipse Kepler, Tomcat 5.5 and Axis2.
1- I created a new Dynamic Web Project.
2- I created the Java class that implements the service with just one method, a simple one: you pass it a name and it returns "Hi, <name>"
3- Right click over that class and then: Web Services -> Create Web Service
4- I go through the next steps. On the last one, I select "Launch the Web Services Explorer to publish this Web service to a UDDI Registry". Click on "Finish".
5- The Web Services Explorer is launched, but I just get a "HTTP ERROR: 500" message.
I understand that my Web Service wasn't published and therefore it's useless to create a client as it wouldn't connect.
View Replies
View Related
Mar 6, 2015
I need to create a chart for work and comes across this sample from mbostock's chord diagram (bl.ocks.org/mbostock/4062006).
I only need to revise the tick label (names, display positions) but I don't know how to do it as I have 0 experience with Java.
My sample data for the var matrix is
[0,100,100,100]
[0,0,99,98]
[0,0,92,84]
[0,99,0,0]
which shows flows between country A, B, C and D.
I would like to revise the tick labels, so that:
1) Instead of showing 0K 5K 10K, I would like to show the country names (A - D), with no number or tick. I figured out this one by just commenting out all the codes relating to ticks.
2) Place the country names in the center of the arch. I don't know how to do this one.
View Replies
View Related
Jul 9, 2014
I wrote a program that asks the user to enter some information, does some calculations and tells them what they need to order. I know there is a way I just do not know how to do it. I would like the output from the program which is presented in text fields to be printed onto a form I made in excel when a button is pressed.
View Replies
View Related
Oct 3, 2014
I need to create a diagonal cross however I can not figure out how to do the upper left side of it.
Currently I am getting
0*
1--*
2---*
3 *--*
4*-----*
I want to get it to look like
0*------*
1 *--*
2----*
3 *---*
4*------ *
( I replaced spaces with -) So far I have
System.out.println("Input a size(must be larger than 1: )");
size=input.nextInt();
if (size>1) {
for (x=0;x<size;x++){
System.out.println("");
[Code] ....
View Replies
View Related
Nov 11, 2014
I am working on a class project where I have to give the program a predefined String, have it output the first char, then the second char, then the String backwards, and then the String as it originally was. The problem is that it's not out putting all of the information that I need it to. Here's my code:
Here is the class that prints the first char, second char, etc.:
public class Word {
private String word;
public Word() {
}
public Word(String s) {
setString(word);
[code]....
Here's the main class:
public class WordRunner {
public static void main(String[] args) {
Word run = new Word();
run.setString("Hello");
[Code] ....
The output is supposed to look like this:
H
o
olleH
Hello
But this is what I get:
olleH
View Replies
View Related
Mar 20, 2014
public class demo
{
Public class static void main(String[]args) {
//Creating a variable that will be a reference to the object
Peoples person_one;
[Code] ....
I have assembled this code below that has a void method which will creat a new object. Problem I encounter is that in
Create_object(person_one);
the person_one has an error saying not initialized. I'm jus trying to learn on my own ways here and practice so may know what's wrong with this? I know I can use a return object from methods but what about this approach?
View Replies
View Related
Nov 7, 2014
I was tasked with building a program that, when is given a string by the user, takes it and prints it out as a rectangle. For example, if the user types in "COMPUTER", the output would be:
COMPUTER
OMPUTERC
MPUTERCO
PUTERCOM
UTERCOMP
TERCOMPU
ERCOMPUT
RCOMPUTE
So far, I have created 2 separate strings, and have gotten the output to look like:
COMPUTER
OMPUTERC
OMPUTERO
OMPUTERO
OMPUTERO
OMPUTERO
OMPUTERO
OMPUTERO
OMPUTERO
So, it works once, but then it doesn't work again. Here is my code:
i was tasked with building a program that, when is given a string by the user, takes it and prints it out as a rectangle. For example, if the user types in "COMPUTER", the output would be:
COMPUTER
OMPUTERC
MPUTERCO
PUTERCOM
UTERCOMP
TERCOMPU
ERCOMPUT
RCOMPUTE
So far, I have created 2 separate strings, and have gotten the output to look like:
COMPUTER
OMPUTERC
OMPUTERO
OMPUTERO
OMPUTERO
OMPUTERO
OMPUTERO
OMPUTERO
OMPUTERO
So, it works once, but then it doesn't work again. Here is my code:
import java.util.Scanner;
public class WordRectangle {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner userInput = new Scanner (System.in);
[code]....
View Replies
View Related
Aug 14, 2014
Though have been playing around with my ebook but finding it difficult to get along with the topic PACKAGE&INTERFACES, I find it challenging to write a package file despite the book I currently studying and online tutorial.. so I want a more explanatory format to comprehend the piece cos without knowing it.
View Replies
View Related
Dec 30, 2014
I'm trying to create complex Character objects. Each object has a name, and for each object with the same name, they share some of the same initial data. However, there are also some bits of data that are given to the object when it's created. For example, an "Elephant" always starts out having a weight of 500, but its position is determined when it's created. Any of these values may later be changed during runtime.
class CharacterStaticParameters {
int weight;
int numberOfFeet;
int numberOfEyes;
[code]....
For example, whether I should try to use words other than 'static' and 'dynamic', or a nicer word than 'parameters'?
View Replies
View Related
Aug 17, 2014
So I'm still trying to get to grips with Java, and like to understand exactly why I'm doing something, so that I am not just regurgitating the code, If I want to create an object from class "Apples", I would use the following, right?
Apples MyAppleObject = new Apples();
From what I understand, MyAppleObject is the new object name, new -> creates a new instance of it in memory, and Apples() is the onCreate method that is called
So question 1: (just a quick aside question) Can I create an object without calling Apples()? i.e.
Apples MyAppleObject = new;
Question 2: - PARTLY SOLVED - I discovered that (Button) is a way of typecasting, so I understand that line a little better. What I don't understand is why we don't need to initialize the object with "new"
I've now looked at a bit of android development and xml and those declarations are all together different, and I'm not sure why. I haven't found a single explanation for the difference in format.
Java Code:
Button Add;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Add = (Button) findViewById(R.id.button1); mh_sh_highlight_all('java'); So the Button object is declared above the onCreate method, but initialized afterwards I guess....
But instead of using Button Add = new Button() they use Add = (Button) findViewById(R.id.button1);
Question 3:
then In XML they use the following:
Java Code:
public*static*void*main(String[] args){
*********
********// Creates a DOM object in memory. Now you can access
********// data in the xml file
*********
********Document xmlDoc = getDocument("./src/tvshows5.xml"); mh_sh_highlight_all('java');
Once again, why didn't they have to use : Document xmlDoc = new Document()
View Replies
View Related
Sep 14, 2014
I want to make a program where users are prompted to enter a username and a password and have these two values create a new instance of the Object User. But I'm not sure where to start.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
createUser();
[Code] ....
how to take username + password and put it into an object.
View Replies
View Related
Aug 28, 2014
so here's my code
import java.io.*;
public class Movies {
public String title;
public String director;
public String theme;
public Title(String title)
[code]....
the error is in line 9 which is
public Title(String title)
and the error is (error: invalid method declaration; return type required)
View Replies
View Related
Jan 11, 2015
I'm having trouble with my program for my class. The program just has to be able to have a button and show how many times a user has clicked it.
Every time I compile it I get errors such as:
unable to find symbol x where the code is executed when the button is clicked
What can I do?
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.JPanel;
public class Program {
public static void main(String[] args){
int x = 0;
[code]....
View Replies
View Related
Mar 1, 2014
I'm having a problem with using the openCSV library when I create a JAR file. I'm currently using BlueJ to run my code. When I compile my program in there, I have no problems whatsoever and it runs great, yet when I create my program into a JAR file, my application doesn't work.
I would think that my problem is either stemming from faulty exception handling, although I don't understand why an input would work in the BlueJ environment, but not when using the JAR file. Or, perhaps the openCSV library isn't in a correct class path(I don't know if this is correct terminology).
View Replies
View Related
Apr 25, 2014
I was trying to play around a little bit after learning creating multiple classes and stuff.However,i encountered a strange problem with reading a value from the user and then storing it in a variable.The usual way i do it is
Scanner variableName=new Scanner(System.in);
System.out.println(variableName.nextLine());
But when i trying to print the contents of the variable "variableName" the compiler throws a lot of errors .I am attaching how i have tried that out in my code
import java.util.Scanner;
class laptop{
private String modelNumber;
private boolean hasFan;
private float ramSpeed;
protected int numCores;
//private String input;
[code]....
Without the setInfo() in the laptop class the program functions as desired but i intend to ask the user if he wants to modify something and then reflect the same.
View Replies
View Related
Sep 28, 2014
Why I have to place two parameters in the Verify constructor. If the numbers are being typed in by the user and passed through the validate method, what is the point of having them in Verify() ?
First, create three exception classes named NumberHighException, NumberLowException, and NumberNegativeException. Both NumberHighException and NumberLowException should be directly subclassed from the Exception class, but NumberNegativeException should be subclassed from NumberLowException. You can use the BadDataException class that was defined in this module as the model for your exception classes.
Next create a class called Verify that will be used to validate that a number is within a specified range. It should have one constructor that has two int parameters. The first parameter is the minimum number in the range, and the second parameter is the maximum number in the range.
In addition to the constructor, the Verify class should have one method that is named validate. The validate method should have a single parameter of data type int. The parameter contains the number that is being validated. If the value of the parameter is less than zero, the method should throw a NumberNegativeException. If the value is less than the minimum value of the range, it should throw a NumberLowException. If the value is greater than the maximum value of the range, it should throw a NumberHighException. If the value is within the specified range, no exception should be thrown.
Once all of these classes are created, create the driver class called Program5. The driver class should instantiate a Verify object with a range of 10 to 100. It should then do the following:
-Prompt the user to input a number within the specified range.
-Use a Scanner to read the user input as an int. You can ensure that an int was entered because the nextInt method throws an --InputMismatchException if any non-digits are entered.
-Call the validate method to validate that the number is within the range.
-Print an appropriate error message if the value is not within the range, or print the value if it is within the range.
View Replies
View Related
Jun 9, 2014
I'm really new to object oriented coding. A good way to create a Text Based Game that used objects as rooms, and items. However, I can't figure out what the best way to define and use rooms and items would be. I've been at it for the past few days, and just can't think of something that works well and is easy to use.
I want to have each room have it's own "inventory" of items that the player can pickup, as well as drop items into. I want items that are dropped to maintain their properties (durability, level, ect). I would also need several methods for things like getting an item from a room by the item's display name or id. For instance, if there is a room with a Broken Iron Sword, and a Stone Dagger, I'd need to be able to get the Broken Iron Sword object with the string "Broken Iron Sword".
View Replies
View Related
Sep 26, 2014
It is possible to delay the creation of a file until I know I am writing to it.
View Replies
View Related
Dec 6, 2014
I did or at least thought I create a matrix of Buttons with values inside of them.
I will show code snippets from different classes:
Made into the view class
for(int i=0; i<25; i++){
for(int j=0;j<25;j++)
[Code].....
My IDE says counter cannot be resolved or is not a field. I understand what it is saying but why not? I try my best not to put a bunch of code on here.
View Replies
View Related
Oct 20, 2014
I just started studying recursion and I wanted to know how to create a palindrome number going up from 1 to n then back to 1 like this: "12345...n...54321".
I've done one going downwards and then upwards like this: "n...4321234...n".
Here's my code:
Java Code: import java.util.*;
public class PalindromeTest
{
public static void downPalindrome(int n)
[Code].....
View Replies
View Related
May 12, 2014
I am working on a java logic game and I want it to be able to work on other people's Mac's, so I tried to figure out how to make it create a folder in which it can create files. The file creating is going fine however the folder never seems to create.Here is the code I attempted to use:
File logicFile = new File("/Library/Application Support/LogicGameSupport");
if(!logicFile.exists()){
if(logicFile.mkdir()){
System.out.println("Directory success");
}else{
System.out.println("Directory failed");
}
}
View Replies
View Related
Dec 31, 2014
Here is my Code for the Game Of Life that I am programming to teach my self java. I am trying to create a GUI and I have done so and a window displays however i don't understand how i can get the Game of Life to display within that GUI?
import java.io.*;
import javax.swing.JFrame;
import java.awt.Color;
import java.awt.FlowLayout; //Provides default layout managing
import javax.swing.JLabel;
public class LifeMain extends JFrame
[Code] ......
View Replies
View Related