Complex Math Functions With A Simple Web Page?

Feb 4, 2015

I am a 3rd year electrical engineer and I am working on a project on solar cell design in the developing world.For my project I am looking to create a very simple web page which can be used by people in the developing world to determine whether a photo voltaic system is suitable to their needs.

For this I want to have simple boxes where a user can input numbers and I used complex calculations to return values (a lot of trigonometric functions etc.), the values then should have the opportunity to be altered to the users digression. This will create a solar model.

For the load aspect of it I am looking to have drop down boxes for a number of components which the user can select and will have a numerical value in Watts which will sum to give total load on system. Ideally I would like to show this graphically in a pie chart showing how much energy each component is taking to give the option to remove.

I am also creating a statistical model which determines the likelihood of having no sunlight on a given day which looks at the solar output, battery capacity and load on the system and will return reliability of the system - this has not been completed but should be shortly.

Aim is to keep web page as simple as possible as unskilled computer users may want to use it.

View Replies


ADVERTISEMENT

Calculator That Ranges From Simple Math To Trig

Nov 15, 2014

I am trying to make a calculator that ranges from simple math to trig. I am trying to start the j-frame for it and I already have most of the formulas programmed with the if-else statements and such. How do I go about starting the jFrame and marrying the 2 codes together to start it. (I have taken a bit of programming but relatively new to writing j-frames and using other classes and putting them together).

View Replies View Related

Simple Data Classes - Serialize More Complex Data Structure

Oct 6, 2014

I have written several simple data classes that I serialized manually by converting to text. At this point I need to serialize a more complex data structure. which will include lists of the simpler elements. Can serialize store and reconstitute this type of structure automatically or do I need to do this one manually as well? Consider the pseudocode below for a clarification of my question;

Java Code:

Class Hops{
String Name;
float Alpha Acid;
float Beta Acid;
};

Class Malt{
String Name;
float extract;
};

Class Recipie{
String Name;
CList HopList;
CList MaltList;
};

CList RecipieList; mh_sh_highlight_all('java');

I read the article on Serialization presented at tutorial point, but the example only showed a simple class, not lists of class members. What I want to do is serialize RecipieList, which consists of a CList of Recipies, which in turn consist of CLists of various ingredients.

View Replies View Related

Complex Number Calculations

Jan 25, 2014

A complex number is defined as z=a+i*b, where a is the real part, and b is the imaginary part. In other words, in order to define a complex number, we need the two floating numbers a and b. Write methods that perform for each of the following operations with complex numbers z1 = a1 + i*b1, and z2 = a2 + i*b2:

Addition: z1 + z2=(a1+a2) + i*(b1+b2)
Subtraction: z1 - z2=(a1-a2) + i*(b1-b2)
Multiplication: z1*z2 = (a1*a2 - b1*b2) + i*(a1*b2 + b1*a2)
Division: z1/z2 = (a1*a2 +b1*b2)/(a2^2 + b2^2) + i*(b1*a2 - a1*b2)/(a2^2 + b2^2)

Create a test program that asks for the real and imaginary parts of two complex numbers from the user, and displays the results of the four operations, writing the formula as shown above, and replacing the a1, a2, b1 and b2 with the numbers entered by the user.The professor used the incorrect complex number equations and has notified the students of his error. I have run into a few problems thus far.

1. I'm not sure how to use floating numbers with the Math.pow(double, double) function, since its requires doubles!? So instead of using floating numbers, I've knowingly switched them all to double in order to see if the code itself is working properly for the purposes of this forum. Is there a way that I can modify this function so that it will work for floating numbers?

2. Regarding the division method, an error stating that c and d have not been initialized and I'm not sure how to change it because the other calculation methods work fine. Why do I need to initialize c and d in the division method and not the others?

3. Am I on the right path? I have surfed the web to see how others completed the program and they all appear very different than mine...

package program5;
import java.util.Scanner;
public class Program5 {
  static double a, b, c, d;
static double i = Math.pow(-1,1/2);
 
[code]...

View Replies View Related

Adding Into A Complex Array?

May 26, 2015

I have a main class:

Java Code:

public class Main {
public static void main(String[] args) {
Player[] playerList = new Player[] {new Player("Daniel", 3, 3, 2, 1, 1, 3),new Player ("Player2", 2, 4, 1, 6, 3, 2)};
System.out.println(Player.getPlayer());
}
} mh_sh_highlight_all('java');

[code]....

and whenever I run it, it prints out the last player, so I was wondering how to identify them separately, but still use the array, as (I believe) it is the most efficient way.

View Replies View Related

Complex Formatting Within A Text Field

Apr 30, 2015

I'm trying to figure out a good way to allow my users to have some formatting options within a text box in my application. Ultimately, they need to be able to have text that is alternating between two separate fonts, and ideally could have both italicized and bolded words as well.

View Replies View Related

Complex Numbers - Converting Syntax?

Mar 17, 2015

Convert to following sysntax (from Matlab) having complex nos.

real((413000*atan((T^(1/2)*((4130000*V*1i)/(139*T^(1/2)) + (413000*1i)/T^(1/2)))/413000)*1i)/(139*T^(1/2)))

View Replies View Related

Deleting Complex Object In Java List

Sep 3, 2014

I am following those three tutorials and I have completed it with success.

( [URL] .... )
( [URL] .... )
( [URL] .... )

But then, as author haven't implemented removeCountries method I tried to create it. What I did initially was to just add to class Countries this method:

public boolean removeCountry(Country country) {
return countries.remove(country);
}

But although compiler wasn't complaining it didn't work. Actually it worked last night (before reboot) but not today. Must be some SOAP iterator/binding thing or whatever. Or I thought that it worked but in fact it didn't.

Here are original classes:

//-------------------------------
public class Country {
String CountryId;
String CountryName;
public Country() {
super();

[Code] ....

I would like to avoid my own iterator as JDeveloper can generate automatically iterators for webservices, but if I can't get it that way, what would be better way to write above mentioned iterator in removeCountry method?

Is there any way to remove object directly with something like this:

co.countries.remove(o);
co.removeCountry(country)

using method

// This left unused
public boolean removeCountry(Country country) {
return countries.remove(country);
}

from class Countries?

Parameters should be set by web service iterator.

View Replies View Related

Java - Allocate Whole Object To One Complex Number

Jul 6, 2014

Java has not structures, I must allocate whole object to one complex number?

Java has complex numbers handling, classes for complex?

View Replies View Related

JavaFX 2.0 :: Synchronize Model Representing Complex UI Composite With FlowPane Backing List

Aug 26, 2014

What is the best way to synchronize a Model representing a complex UI composite w/ a FlowPane's backing list?
 
Currently I have a change listener on the Model.  Upon an add I create a new UI composite and manually add it to the FlowPane's backing list via flowPane.getChildren().add().  Similarly if there is a remove, I iterate over the FlowPane's children, grab the right Node, and remove it.  Similarly, if there is a modification detected, I iterate over the FlowPane's children, grab the right Node, remove it, recreate the UI composite, and re-add it to the list.  I also need the list to be sorted, so I implemented a UIComposite comparator and call FXCollections.sort() on the FlowPane's backing list.  I feel like that is hacky, but it works.  It would be cool if I could maintain sort order in my model somehow and have that automatically propogated to the FlowPane's list.
 
I am correct in assuming that there is no way to have a complex binding in between an ObservableList<CompositeViewModel> and the FlowPane's backing list (ObservableList<T>)? 

Some kind of translator that could create a new UIComposite whenever there is a new CompositeViewModel added to the Model list.

View Replies View Related

Functions Are Not Recognized

Oct 29, 2014

// set up the generator
CMSSignedDataGenerator gen = new CMSSignedDataGenerator();
gen.addSigner(key, cert, CMSSignedDataGenerator.DIGEST_SHA224);
gen.addCertificatesAndCRLs(certsAndCRLs);
addsigner and addCertificatesAndCRLs are not found in netbeans.

Which version of Bouncy Castle and JDK version this supports?

View Replies View Related

Use Of Functions In Java

Feb 4, 2014

Write a function (or functions) that given a collection of files will produce a sum of integers from each line of each file. Each file can have any number of lines from 1 to N. Each line can contain only one integer and no other alphanumeric characters. All of the numbers from all of the files should be added to the final result. The result is just one number.

For either, what we are looking for is:

1. Clear separation of concerns
2. Well defined objects / interfaces
3. Application of good OO design principles to solve the problem
4. No code duplication
5. Test Driven Development
6. Well refactored code
7. Well tested code

View Replies View Related

JSP :: Extracting Information About Previous Page From Where Current Page Came

Jan 31, 2015

I have to implement a system where I have to do almost same processing on a jsp page. The slight differences on the present page is based on whether the current page came from page 1 or page 2. So how can I do this?

View Replies View Related

JSF :: XHTML Page - Access To Content Of Dynamic Page?

Jan 15, 2014

I have a xhtml file that initialization it with ui:repeat tag in realtime.all tags of this page placed under ui:fragment tag.

<edges>
<ui:repeat value="#{graphInfoBean.edges}" var="edge" varStatus="indexVar">
<edge id="#{indexVar.index}" source="#{edge.source}" target="#{edge.target}"
weight="#{edge.weight}">

[Code] ....

When i access to this page and save it as xml in realtime, the tags in xml file saved is empty while it is initialized and everything is working properly.

<edges>
</edges>

How can i access to content of this xhtml page and save it on disk?

View Replies View Related

Using Modulus To Alternate Between 2 Functions?

Feb 24, 2014

This code is for a game I'm making. I'm new to using modulus, and I've been looking all over the place for a tutorial that I can understand. No luck. :

What I'm trying to do is get the console to print "enemy hits player" as soon as enemyAttacksPlayer() is called.

After one second, "player hits enemy" should be printed, so it alternates between these two lines every second.

The issue is when I call enemyAttacksPlayer(), it takes a few seconds to print any lines, and this delay is kinda annoying.

public int time = 0;
 public void enemyAttacksPlayer() {
time++;
if (time % 120 == 60) {
System.out.println("enemy hits player");
} if (time % 120 == 0) {
System.out.println("player hits enemy");
}
}

I think I may be using % wrong.

View Replies View Related

Ambiguity In Overloaded Functions

Sep 22, 2014

I have an overloaded function 'f' as follows:

1. public void f(int i, long j){System.out.println("1");}
2. public void f(int...i){System.out.println("2");}
3. public void f(long l, long p){System.out.println("3");}
4. public void f(int j, int k){System.out.println("4");}

With the function call: f(1,2), the output is: 4.

My questions are the following:

a. Why is the compiler choosing #4 to execute and not the rest?
b. If I remove 4 and replace it with: 5. public void f(long j, int k){System.out.println("5");}, why does the compiler now give an error complaining of ambiguous function defintions when 'f' is called?

View Replies View Related

Using Same Parameters But Different Functions - Allowed Or Not?

Feb 12, 2014

I have made a class here that has two methods. As you guys can notice, in my two methods that I made, I have listed some arguments in there with parameters. My question is that the variables im using in first method, can they be identical on my second method? Is this ok to do?

public class StudentScore {
private int math;
private int science;
private int calc;
private int history;
private int pe;
 
[Code] .....

View Replies View Related

Basic Calculator Functions

Jul 2, 2014

my task is to add a few functions to an example calculator. I managed to add a divide button but I simply can't figure out how to add a working Pi and reciprocal function.

package newjavaproject;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class CalculateurNC extends Applet {

[code]....

View Replies View Related

Modify And Delete Functions

Apr 4, 2014

I am writing a program for my Java class and I have every function of the program working aside from the modify and delete button. I'm not sure how to make them work. The course material doesn't cover these functions at all.

Here is what I have so far.. which is practically nothing. If I need to post any other code I will, I just don't want to post more than needed because going through unnecessary code can waste time.

public void actionPerformed(ActionEvent e)
{
inventoryTotalField.setText(String.valueOf(genre[ArrayIndex].getInventoryTotal()));
//add button functions
if (e.getActionCommand() == "First")//if first button is clicked
{
ArrayIndex = 0;//set array index to the first element in the array
setFieldValues(); // display dvd info on the form

[Code] .....

View Replies View Related

Adding Functions To A Calculator

Dec 6, 2014

I've made a calculator that can add, subtract, multiply, and divide, but I still need a clear function and a square root one for it. I've tried going on the various calculator tutorials, but they don't work.

And here's my code:

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Calculator extends JPanel implements ActionListener
{
private JTextField display = new JTextField("0");
private String button = "789/456*123-0.+=";
private double result = 0;

[Code] .....

View Replies View Related

Plot Functions Using Abstract Methods

May 1, 2014

Assignment 13 – Plot functions using abstract methods (Plot functions using abstract methods) Write an abstract class that draws the diagram for a function. The class is defined as follows:

Java Code:

public abstract class AbstractDrawFunction extends JPanel {
/** Polygon to hold the points */
private Polygon p = new Polygon();
protected AbstractDrawFunction() {
drawFunction();

[code].....

For each function, create a class that extends the AbstractDrawFunction class and implement the f method. Figure below displays the drawing for the first three functions.how to make the jframe to work so that I displays the panel

Java Code:

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.LayoutManager;
import java.awt.Polygon;

[code]....

View Replies View Related

Plot Functions Using Abstract Methods

Apr 29, 2014

Assignment 13 – Plot functions using abstract methods

Write an abstract class that draws the diagram for a function. The class is defined as follows:

public abstract class AbstractDrawFunction extends JPanel {
/** Polygon to hold the points */
private Polygon p = new Polygon();
protected AbstractDrawFunction() {
drawFunction();

[Code] ...

Test the class with the following functions:

a.f(x) = x2;
b.f(x) = sin(x);
c.f(x) = cos(x);
d.f(x) = tan(x);
e.f(x) = cos(x) + 5sin(x);
f.f(x) = 5cos(x) + sin(x);
g.f(x) = log(x) + x2;

For each function, create a class that extends the AbstractDrawFunction class and implement the f method. Figure below displays the drawing for the first three functions.

View Replies View Related

Calculating Sin(x) Without Using Math

Sep 14, 2014

I'm trying to calculate sin(x) without using Math.sin(x). The formula for sin(x) is: x - x^3/3! + x^5/5! ... I can't seem to get the coding for the alternating +/- right. Here's my program:

import java.util.Scanner;
import java.lang.Math;
class Sin
{
public static void main(String[] args)
{
Scanner kb = new Scanner(System.in);
int n, c, fact = 1, count = 1;
double x, sum = 0, sum_sin = 0, result;

[Code] ....

View Replies View Related

Utility Functions For Square Matrices And Arrays

Nov 7, 2014

I am working on a number of utility functions for square matrices and arrays, and I keep having trouble with segmentation faults.

arrayUtils~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public class ArrayUtils {
//This function takes an array a, and returns the sum between indices
//i and j, where i is the lower index and j is the upper index. int size makes
//sure that the function doesn't go out of bounds.
public static int subSum(int[] a,int i, int j) {
int sum=0;

[Code] .....

View Replies View Related

Picture Draw (Roses) Using Polar Functions

Feb 23, 2015

I'm trying to make a code that will draw "roses" using polar functions. The code below is what I have, but when I run it nothing happens. What's missing?

package rose;
import edu.princeton.cs.StdDraw;
public class Rose {
public static void main(String [] args) {
int N = Integer.parseInt(args[0]);
StdDraw.setCanvasSize(512, 512);

[Code] .....

View Replies View Related

Java Application That Functions As Lottery Game

Nov 23, 2014

I am writing a java application that will function as a lottery game, using arrays it prompts the user to enter 5 digits and matches them against the random lottery numbers generated.

import java.util.Random;
import java.util.Scanner;
public class App {
public static void main(String[] args) {
int NUM_DIGITS = 5;

[Code] ....

View Replies View Related







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