Formula For Creating Quarter Wave Antennas

Jun 19, 2014

I have this formula for creating quarter wave antennas, however for some reason I can not get the right answer for it. double parM takes the users information which is a frequency in Megahertz and changes to feet so we can construct our antenna. However, in the program it gives me 1.9 instead 7.7 which it is suppose to be.

double parM = Double.parseDouble(userInput.getText());
double getSize = (234 / parM) * 12; // 12 is in inches

View Replies


ADVERTISEMENT

Hexagon And Pyramid Formula

Mar 30, 2014

What is accurate formula area and perimeter for pyramid and hexagon? I got stuck of my assignment.

View Replies View Related

Distance Formula - Return Value NaN

Mar 17, 2015

I am working on this new project where we are using the great distance formula but every time I run my ending result is NaN. I was researching, and people say its because you divide by 0. I think I have my formula correct.

Java Code:

public class testingFormula {
public static void main(String[] args) {
double lat = 34.01858902;
double lon = -118.2817688;
double lat2 =33.94530869;
double lon2 = -118.3994904;

[Code] ....

View Replies View Related

Loop To Work With Formula To Calculate New Value Of CD

Jan 28, 2014

It's suppose to generate a table with the month, and the new amount of the CD. Right now, the program generates a continuous table for months, but it doesn't update the value of the CD.

import java.util.*;
public class Excercise04_31 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);

[Code] ....

View Replies View Related

Converting Math Formula To Java?

Jan 20, 2015

I'm trying to convert a Formula to run in a java program.

This is the formula:

(you can ignore the modifier part)

This is my attempt. However it prints out 0.0

import java.util.Scanner;
public class DamageCalc{
public static void main(String[] args){
Scanner s = new Scanner(System.in);

[Code].....

View Replies View Related

Importing Math Formula To Java

Sep 1, 2014

i am trying to calculate the number of months it takes to pay off a set amount of credit card debt given the following information: principle amount, annual interest rate, and monthly payment. How to import the formula necessary to system.out.print the answer (number of months it takes to pay off debt) ???

View Replies View Related

Arithmetic Expression With Quadratic Formula

Oct 3, 2014

I have just started to learn programming in the book I am teaching myself from it said how would you write the following arithmetic expression with it being the quadratic formula but only the plus part of it in the plus or minus..

package javalearning;
import java.util.Scanner;
public class QuadraticFormula {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.print("Enter value for B: ");
double B = input.nextDouble();
System.out.print("Enter value for A: ");
double A = input.nextDouble();
System.out.print("Enter value for C: ");
double C = input.nextDouble();
double negativeOfB = -B;

[code]....

View Replies View Related

Declare Array And Populate It With Log Formula

Feb 10, 2014

Still trying to get a handle on arrays! So, I declare an array to be a 46x1 and I am trying to populate it with a Log formula that I am using but I keep getting an ArrayIndexOutofBoundsException.

Code :

private double[][] LNValues = new double[46][1];
//Calculating y=LN(E-k) and Initializing the Array
for(int x=0; x<LNValues.length; x++)
{
double i = Math.log(eValues[x][1] - kValue);
if(i > 0)

[Code] ....

View Replies View Related

Take Input From User And Calculate Value Of PI Using Formula

Sep 6, 2014

I'm supposed to take an input from the user and calculate the value of pi using this formula: 1/1 - 1/3 + 1/5 - 1/7 etc... so on alternating between minus and plus and denominator increasing by 2 every time. If the user inputs the number 3, then it should print (1/1 - 1/3 + 1/5 - 1/7 + 1/9) *4. The idea here is that the higher the input of the user is, the higher the equation will be close to pi.

This is what i have so far :

import java.util.Scanner;
public class Pi
{
public static void main(String[] args) {
double first = 1/1;
double second = 1/3;
Scanner input = new Scanner(System.in);
System.out.println("Enter a Number to calculate how far you want the formula to perform: ");
double count = input.nextDouble();
}
}

This is literally all i have, i know i need a while loop and an if loop.

View Replies View Related

How To Write A Program Using Quadratic Formula In JGrasp

Mar 4, 2015

Write a program named QuadraticTable.java that takes three double arguments and two int arguments (in that order) from the command line. The three doubles will represent a, b, and c from the quadratic formula.

If the discriminant is non-negative, find and print the solutions to the quadratic equation. (The plus/minus sign in the quadratic formula indicates that you would separately perform both operations). Otherwise print "no real solutions".

Then using the last two int arguments as x_min and x_max, print a table of x and ax

2 + bx + c

values using the a, b, and c read in as command line arguments.

Sample output: (command line arguments were 1 0 2 -3 3)

1x^2 + 0x + 2 has no real solutions.

X 1x^2 + 0x + 2

-3 11

-2 6

-1 2

0 2

1 3

2 6

3 11

View Replies View Related

Swing/AWT/SWT :: Drawing A Semicircle Using Formula For The Equation Of A Circle

Sep 19, 2014

So Ive got to make a turtle on an image draw a semicircle that starts at the top of a circle and goes down and to the left, changing colors halfway through. I've got everything down, I can draw the turtles and make them do straight lines. My problem is more math related. I need to use the equation of a circle, give it points, and figure out how to write that code in java.

We use the equation for a circle: (x - a)^2 + (y - b)^2 = r^2

amanda.setName("amanda");
amanda.setShellColor(Color.BLUE);
amanda.setBodyColor(Color.RED);
amanda.setPenColor(Color.YELLOW);
amanda.setPenWidth(3);
amanda.forward();
amanda.turn(-90);
amanda.setPenColor(Color.BLUE);
amanda.forward(???);

the question marks are where I need to draw a line on an arc, like in the picture.

View Replies View Related

Calculate Area Of Triangle By Herons Formula And Tell If It Is Equilateral Or Pythagorean

Feb 24, 2014

Basically its a program where a user is prompted to enter the length of all three sides of a triangle and the program calculates the area by herons formula and can tell if the triangle is equilateral or Pythagorean. I am having trouble entering a formula to where all three enter sides cant possibly be a triangle. Here is my Program. Where the '?' is stated.

import java.util.Scanner;
public class Triangle {
public static void main(String[] args){
double a;
double b;
double c;
double s;
double x;
double area;

[Code] ....

View Replies View Related

Best Way Of Creating Forms

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

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 View Related

Creating A Map With Stocks

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

Creating A Table

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

Creating A Web Service

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

Creating A Chart For Work?

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

Creating A Excel From Swing?

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

Creating A Diagonal Cross?

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

Creating A Backwards String?

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

Creating Objects From Methods?

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

Creating A Word Rectangle?

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

Creating A Package File

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

Creating Complicated Objects

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

Creating Objects From Class

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







Copyrights 2005-15 www.BigResource.com, All rights reserved