I need help with this program ( Calculating Pi using random numbers)
hi
please understand that I am not trying to ask anymore to do this hw for me. I am new to java and working on the assignment. below is the specification of this program:
Calculate PI using Random Numbers
In geometry the ratio of the circumference of a circle to its diameter is known as �. The value of � can be estimated from an infinite series of the form:
� / 4 = 1 - (1/3) + (1/5) - (1/7) + (1/9) - (1/11) + ...
There is another novel approach to calculate �. Imagine that you have a dart board that is 2 units square. It inscribes a circle of unit radius. The center of the circle coincides with the center of the square. Now imagine that you throw darts at that dart board randomly. Then the ratio of the number of darts that fall within the circle to the total number of darts thrown is the same as the ratio of the area of the circle to the area of the square dart board. The area of a circle with unit radius is just � square unit. The area of the dart board is 4 square units. The ratio of the area of the circle to the area of the square is � / 4.
To simuluate the throwing of darts we will use a random number generator. The Math class has a random() method that can be used. This method returns random numbers between 0.0 (inclusive) to 1.0 (exclusive). There is an even better random number generator that is provided the Random class. We will first create a Random object called randomGen. This random number generator needs a seed to get started. We will read the time from the System clock and use that as our seed.
Random randomGen = new Random ( System.currentTimeMillis() );
Imagine that the square dart board has a coordinate system attached to it. The upper right corner has coordinates ( 1.0, 1.0) and the lower left corner has coordinates ( -1.0, -1.0 ). It has sides that are 2 units long and its center (as well as the center of the inscribed circle) is at the origin.
A random point inside the dart board can be specified by its x and y coordinates. These values are generated using the random number generator. There is a method nextDouble() that will return a double between 0.0 (inclusive) and 1.0 (exclusive). But we need random numbers between -1.0 and +1.0. The way we achieve that is:
double xPos = (randomGen.nextDouble()) * 2 - 1.0;
double yPos = (randomGen.nextDouble()) * 2 - 1.0;
To determine if a point is inside the circle its distance from the center of the circle must be less than the radius of the circle. The distance of a point with coordinates ( xPos, yPos ) from the center is Math.sqrt ( xPos * xPos + yPos * yPos ). The radius of the circle is 1 unit.
The class that you will be writing will be called CalculatePI. It will have the following structure:
import java.util.*;
public class CalculatePI
public static boolean isInside ( double xPos, double yPos )
public static double computePI ( int numThrows )
public static void main ( String[] args )
In your method main() you want to experiment and see if the accuracy of PI increases with the number of throws on the dartboard. You will compare your result with the value given by Math.PI. The quantity Difference in the output is your calculated value of PI minus Math.PI. Use the following number of throws to run your experiment - 100, 1000, 10,000, and 100,000. You will call the method computePI() with these numbers as input parameters. Your output will be of the following form:
Computation of PI using Random Numbers
Number of throws = 100, Computed PI = ..., Difference = ...
Number of throws = 1000, Computed PI = ..., Difference = ...
Number of throws = 10000, Computed PI = ..., Difference = ...
Number of throws = 100000, Computed PI = ..., Difference = ...
* Difference = Computed PI - Math.PI
In the method computePI() you will simulate the throw of a dart by generating random numbers for the x and y coordinates. You will call the method isInside() to determine if the point is inside the circle or not. This you will do as many times as specified by the number of throws. You will keep a count of the number of times a dart landed inside the circle. That figure divided by the total number of throws is the ratio � / 4. The method computePI() will return the computed value of PI.
and below is what i have so far:
import java.util.*;
public class CalculatePI
public static boolean isInside ( double xPos, double yPos )
double distance = Math.sqrt( xPos * xPos + yPos * yPos );
public static double computePI ( int numThrows )
Random randomGen = new Random ( System.currentTimeMillis() );
double xPos = (randomGen.nextDouble()) * 2 - 1.0;
double yPos = (randomGen.nextDouble()) * 2 - 1.0;
int hits = 0;
int darts = 0;
int i = 0;
int areaSquare = 4 ;
while (i <= numThrows)
if (distance< 1)
hits = hits + 1;
if (distance <= areaSquare)
darts = darts + 1;
double PI = 4 * ( hits / darts );
i = i+1;
public static void main ( String[] args )
Scanner sc = new Scanner (System.in);
System.out.print ("Enter number of throws:");
int numThrows = sc.nextInt();
double Difference = PI - Math.PI;
System.out.println ("Number of throws = " + numThrows + ", Computed PI = " + PI + ", Difference = " + difference );
}when I tried to compile it says "cannot find variable 'distance' " in the while loop. but i thought i already declare that variable in the above method. Please give me some ideas to solve this problem and please check my program to see if there is any other mistakes.
Thanks a lot.
You've declared a local variable, distance, in the method isInside(). The scope of this variable is limited to the method in which it is declared. There is no declaration for distance in computePI() and that is why the compiler gives you an error.
I won't check your entire program but I did notice that isInside() is declared to be a boolean method but doesn't return anything, let alone a boolean value. In fact, it doesn't even compute a boolean value.
Similar Messages
-
New to Java and need help with this program..please!
I'd really appreciate any helpful comments about this program assignment that I have to turn in a week from Friday. I'm taking a class one night a week and completely new to Java. I'd ask my professor for help, but we can't call him during the week and he never answers e-mails. He didn't tell us how to call from other classes yet, and I just can't get the darn thing to do what I want it to do!
The assignment requirements are:
1. Change a card game application that draws two cards
and the higher card wins, to a Blackjack application
2. Include a new class called Hand
3. The Hand class should record the number of draws
4. The application should prompt for a number of draws
5. The game is played against the Dealer
6. The dealer always draws a card if the dealer's hand total is <= 17
7. Prompt the player after each hand if he wants to quit
8. Display the total games won by the dealer and total and the total games wond by the player after each hand
9. Display all of the dealer's and player's cards at the
end of each hand
10. Player has the option of drawing an additional card after the first two cards
11. The Ace can have a value of 11 or 1
(Even though it's not called for in the requirements, I would like to be able to let the Ace have a value of 1 or an 11)
The following is my code with some comments about a few things that are driving me nuts:
import java.util.*;
import javax.swing.*;
import java.text.*;
public class CardDeck
public CardDeck()
deck = new Card[52];
fill();
shuffle();
public void fill()
int i;
int j;
for (i = 1; i <= 13; i++)
for (j = 1; j <= 4; j++)
deck[4 * (i - 1) + j - 1] = new Card(i, j);
cards = 52;
public void shuffle()
int next;
for (next = 0; next < cards - 1; next++)
int rand = (int)(Math.random()*(next+1));
Card temp = deck[next];
deck[next] = deck[rand];
deck[rand] = temp;
public final Card draw()
if (cards == 0)
return null;
cards--;
return deck[cards];
public int changeValue()
int val = 0;
boolean ace = false;
int cds;
for (int i = 0; i < cards; i++)
if (cardValue > 10)
cardValue = 10;
if (cardValue ==1) {
ace = true;
val = val + cardValue;
if ( ace = true && val + 10 <= 21 )
val = val + 10;
return val;
public static void main(String[] args)
CardDeck d = new CardDeck();
int x = 3;
int i;
int wins = 1;
int playerTotal = 1;
do {
Card dealer = (d.draw());
/**I've tried everything I can think of to call the ChangeValue() method after I draw the card, but nothing is working for me.**/
System.out.println("Dealer draws: " + dealer);
do {
dealer = (d.draw());
System.out.println(" " + dealer);
}while (dealer.rank() <= 17);
Card mine = d.draw();
System.out.println("\t\t\t\t Player draws: "
+ mine);
mine = d.draw();
System.out.println("\t\t\t\t\t\t" + mine);
do{
String input = JOptionPane.showInputDialog
("Would you like a card? ");
if(input.equalsIgnoreCase("yes"))
mine = d.draw();
System.out.println("\t\t\t\t\t\t" + mine);
playerTotal++;
else if(input.equalsIgnoreCase("no"))
System.out.println("\t\t\t\t Player stands");
else
System.out.println("\t\tInvalid input.
Please try again.");
I don't know how to go about making and calling a method or class that will combine the total cards delt to the player and the total cards delt to the dealer. The rank() method only seems to give me the last cards drawn to compare with when I try to do the tests.**/
if ((dealer.rank() > mine.rank())
&& (dealer.rank() <= 21)
|| (mine.rank() > 21)
&& (dealer.rank() < 22)
|| ((dealer.rank() == 21)
&& (mine.rank() == 21))
|| ((mine.rank() > 21)
&& (dealer.rank() <= 21)))
System.out.println("Dealer wins");
wins++;
else
System.out.println("I win!");
break;
} while (playerTotal <= 1);
String stop = JOptionPane.showInputDialog
("Would you like to play again? ");
if (stop.equalsIgnoreCase("no"))
break;
if (rounds == 5)
System.out.println("Player wins " +
(CardDeck.rounds - wins) + "rounds");
} while (rounds <= 5);
private Card[] deck;
private int cards;
public static int rounds = 1;
public int cardValue;
/**When I try to compile this nested class, I get an error message saying I need a brace here and at the end of the program. I don't know if any of this code would work because I've tried adding braces and still can't compile it.**/
class Hand()
static int r = 1;
public Hand() { CardDeck.rounds = r; }
public int getRounds() { return r++; }
final class Card
public static final int ACE = 1;
public static final int JACK = 11;
public static final int QUEEN = 12;
public static final int KING = 13;
public static final int CLUBS = 1;
public static final int DIAMONDS = 2;
public static final int HEARTS = 3;
public static final int SPADES = 4;
public Card(int v, int s)
value = v;
suit = s;
public int getValue() { return value; }
public int getSuit() { return suit; }
public int rank()
if (value == 1)
return 4 * 13 + suit;
else
return 4 * (value - 1) + suit;
/**This works, but I'm confused. How is this method called? Does it call itself?**/
public String toString()
String v;
String s;
if (value == ACE)
v = "Ace";
else if (value == JACK)
v = "Jack";
else if (value == QUEEN)
v = "Queen";
else if (value == KING)
v = "King";
else
v = String.valueOf(value);
if (suit == DIAMONDS)
s = "Diamonds";
else if (suit == HEARTS)
s = "Hearts";
else if (suit == SPADES)
s = "Spades";
else
s = "Clubs";
return v + " of " + s;
private int value; //Value is an integer, so how can a
private int suit; //string be assigned to an integer?
}Thank you so much for offering to help me with this Jamie! When I tried to call change value using:
Card dealer = (d.changeValue());
I get an error message saying:
Incompatible types found: int
required: Card
I had my weekly class last night and the professor cleared up a few things for me, but I've not had time to make all of the necessary changes. I did find out how toString worked, so that's one question out of the way, and he gave us a lot of information for adding another class to generate random numbers.
Again, thank you so much. I really want to learn this but I'm feeling so stupid right now. Any help you can give me about the above error message would be appreciated. -
I need help with this script please ASAP
So I need this to work properly, but when ran and the correct answer is chosen the app quits but when the wrong answer is chosen the app goes on to the next question. I need help with this ASAP, it is due tommorow. Thank you so much for the help if you can.
The script (Sorry if it's a bit long):
#------------Startup-------------
display dialog "Social Studies Exchange Trviva Game by Justin Parzik" buttons {"Take the Quiz", "Cyaaaa"} default button 1
set Lolz to (button returned of the result)
if Lolz is "Cyaaaa" then
killapp()
else if Lolz is "Take the Quiz" then
do shell script "say -v samantha Ok starting in 3…2…1…GO!"
#------------Question 1-----------
display dialog "Around age 11, many boys left their fathers to become…" buttons {"Scholars", "Warriors", "Apprentices"}
set A1 to (button returned of the result)
if A1 is "Apprentices" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#----------Question 2--------
display dialog "Most children were taught
to read so that they could understand the…" buttons {"Music of Mozart", "Bible", "art of cooking"}
set A2 to (button returned of the result)
if A2 is "Bible" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#------------Question 3---------
display dialog "In the 1730s and 1740s, a religious movement called the_______swept through the colonies." buttons {"Glorius Revolution", "Great Awakening", "The Enlightenment"}
set A3 to (button returned of the result)
if A3 is "Great Awakening" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#-----------Question 4--------
display dialog "_______ was
a famous American Enlightenment figure." buttons {"Ben Franklin", "George Washington", "Jesus"}
set A4 to (button returned of the result)
if A4 is "Ben Franklin" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#----------Question 5-------
display dialog "______ ownership gave colonists political rights as well as prosperity." buttons {"Land", "Dog", "Slave"}
set A5 to (button returned of the result)
if A5 is "Land" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#---------Question 6--------
display dialog "The first step toward guaranteeing these rights came in 1215. That
year, a group of English noblemen forced King John to accept the…" buttons {"Declaration of Independence", "Magna Carta", "Constitution"}
set A6 to (button returned of the result)
if A6 is "Magna Carta" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#----------Question 7--------
display dialog "England's cheif lawmaking body was" buttons {"the Senate", "Parliament", "King George"}
set A7 to (button returned of the result)
if A7 is "Parliament" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#--------Question 8-----
display dialog "Pariliament decided to overthrow _______ for not respecting their rights" buttons {"King James II", "King George", "King Elizabeth"}
set A8 to (button returned of the result)
if A8 is "King James II" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#--------Question 9------
display dialog "Parliament named ___ and ___ as England's new monarchs in something called ____." buttons {"William/Mary/Glorius Revolution", "Adam/Eve/Great Awakening", "Johhny/Mr.Laphalm/Burning of the hand ceremony"}
set A9 to (button returned of the result)
if A9 is "William/Mary/Glorius Revolution" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#---------Question 10-----
display dialog "After accepting the throne William and Mary agreed in 1689 to uphold the English Bill of _____." buttons {"Money", "Colonies", "Rights"}
set A10 to (button returned of the result)
if A10 is "Rights" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#---------Question 11------
display dialog "By the late 1600s French explorers had claimed the ___ River Valey" buttons {"Mississippi", "Ohio", "Hudson"}
set A11 to (button returned of the result)
if A11 is "Ohio" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#------Question 12---------
display dialog "______ was sent to ask the French to leave 'English Land'." buttons {"Johhny Tremain", "George Washington", "Paul Revere"}
set A12 to (button returned of the result)
if A12 is "George Washington" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#---------Question 13-------
display dialog "_____ proposed the Albany Plan of Union" buttons {"George Washingon", "Ben Franklin", "John Hancock"}
set A13 to (button returned of the result)
if A13 is "Ben Franklin" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#--------Question 14------
display dialog "The __________ declared that England owned all of North America east of the Mississippi" buttons {"Proclomation of England", "Treaty of Paris", "Pontiac Treaty"}
set A14 to (button returned of the result)
if A14 is "" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#-------Question 15-------
display dialog "Braddock was sent to New England so he could ______" buttons {"Command an attack against French", "Scalp the French", "Kill the colonists"}
set A15 to (button returned of the result)
if A15 is "Command an attack against French" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#------TheLolQuestion-----
display dialog "____ is the name of the teacher who runs this class." buttons {"Mr.White", "Mr.John", "Paul Revere"} default button 1
set LOOL to (button returned of the result)
if LOOL is "Mr.White" then
do shell script "say -v samantha Congratulations…you…have…common…sense"
else
do shell script "say -v alex Do…you…have…eyes?"
#------END------
display dialog "I hope you enjoyed the quiz!" buttons {"I did!", "It was horrible"}
set endmenu to (button returned of the result)
if endmenu is "I did!" then
do shell script "say -v samantha Your awesome"
else
do shell script "say -v alex Go outside and run a lap"
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end ifUse code such as:
display dialog "Around age 11, many boys left their fathers to become…" buttons {"Scholars", "Warriors", "Apprentices"}
set A1 to (button returned of the result)
if A1 is "Apprentices" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
return
end if
#----------Question 2--------
display dialog "Most children were taught to read so that they could understand the…" buttons {"Music of Mozart", "Bible", "art of cooking"}
set A2 to (button returned of the result)
if A2 is "Bible" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
return
end if
(90444) -
I purchased Adobe Acrobat x Pro recently and installed it, I have compatibility issues vision 2013. The adobe pdf converter plug in stays inactive despite all my efforts to activate it, I need help with this? How can i get the plug in to work with Visio 2013?
For MS Visio (any version) only the appropriate version of Acrobat *PRO* provides PDFMaker for Visio.
For Visio 2013 specifically you must have Acrobat XI Pro (updated to at least 11.0.1).
See:
http://helpx.adobe.com/acrobat/kb/compatible-web-browsers-pdfmaker-applications.html
Be well... -
I purchased Adobe Acrobat x Pro recently and installed it, I have compatibility issues vision 2013. The adobe pdf converter plug in stays inactive despite all my efforts to activate it, I need help with this? How can i get the plug in to work with Visio 2013?
For MS Visio (any version) only the appropriate version of Acrobat *PRO* provides PDFMaker for Visio.
For Visio 2013 specifically you must have Acrobat XI Pro (updated to at least 11.0.1).
See:
http://helpx.adobe.com/acrobat/kb/compatible-web-browsers-pdfmaker-applications.html
Be well... -
Hi!!
I urgently need help with this:
When I compile this in Flex Builder 3 it says: The element type 'mx:Application' must be terminated by the matching end-tag '</mx:Application>'.
but I have this end tag in my file, but when I try to switch from source view to desgin view it says, that: >/mx:Script> expected to terminate element at line 71, this is right at the end of the .mxml file. I have actionscript(.as) file for scripting data.
This is the mxml code to terminate apllication tag which I did as you can see:
MXML code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#007200, #000200]" width="1024" height="768" applicationComplete="popolni_vse()">
<mx:HTTPService id="bazaMME" url="lokalnabaza/baza_MME_svn.xml" showBusyCursor="true" resultFormat="e4x"/>
<mx:Script source="dajzaj.as"/>
<mx:states>
<mx:State name="Galerije">
<mx:SetProperty target="{panel1}" name="title" value="Galerije MME"/>
<mx:SetProperty target="{panel2}" name="title" value="opis slik"/>
<mx:SetProperty target="{panel3}" name="title" value="Opis Galerije"/>
<mx:AddChild relativeTo="{panel1}" position="lastChild">
<mx:HorizontalList x="0" y="22" width="713.09863" height="157.39436" id="ListaslikGalerije"></mx:HorizontalList>
</mx:AddChild>
<mx:SetProperty target="{text1}" name="text" value="MME opisi galerij "/>
<mx:AddChild relativeTo="{panel1}" position="lastChild">
<mx:Label x="217" y="346" text="labela za test" id="izbr"/>
</mx:AddChild>
<mx:SetProperty target="{label1}" name="text" value="26. November 2009@08:06"/>
<mx:SetProperty target="{label1}" name="x" value="845"/>
<mx:SetProperty target="{label1}" name="width" value="169"/>
<mx:SetProperty target="{Gale}" name="text" value="plac za Galerije"/>
</mx:State>
<mx:State name="Projekti"/>
</mx:states>
<mx:MenuBar id="MMEMenu" labelField="@label" showRoot="true" fillAlphas="[1.0, 1.0]" fillColors="[#043D01, #000000]" color="#9EE499" x="8" y="24"
itemClick="dajVsebino(event)" width="1006.1268" height="21.90141">
<mx:XMLList id="MMEmenuModel">
<menuitem label="O nas">
<menuitem label="reference podjetja" name="refMME" type="check" groupName="one"/>
<menuitem label="reference direktor" name="refdir" type="check" groupName="one"/>
<menuitem label="Kontakt" name="podatMME" groupName="one" />
<menuitem label="Kje smo" name="lokaMME" type="check" groupName="one" />
</menuitem>
<menuitem type="separator"/>
<menuitem label="Galerija">
<menuitem label="Slovenija" name="galSvn" type="check" groupName="one"/>
<menuitem label="Nemčija" name="galDeu" type="check" groupName="one" />
</menuitem>
<menuitem type="separator"/>
<menuitem label="projekti">
<menuitem label="Slovenija" name="projSvn" type="check" groupName="one"/>
<menuitem label="Nemčija" name="projDeu" type="check" groupName="one" />
<menuitem label="Madžarska" name="projHun" type="check" groupName="one"/>
</menuitem>
</mx:XMLList>
</mx:MenuBar>
<mx:Label x="845" y="10" text="25. November 2009@08:21" color="#FFFFFF" width="169" height="18.02817" id="label1"/>
<mx:Label x="746" y="10" text="zadnja posodobitev:" color="#FFFFFF"/>
<mx:Panel x="9" y="57" width="743.02814" height="688.4507" layout="absolute" title="Plac za Vsebino" id="panel1">
<mx:Text x="0" y="-0.1" text="MME vsebina" width="722.95776" height="648.4507" id="Gale"/>
</mx:Panel>
<mx:Label x="197.25" y="748.45" color="#FFFFFF" text="Copyright © 2009 MME d.o.o." fontSize="12" width="228.73239" height="20"/>
<mx:Label x="463.35" y="748.45" text="izdelava spletnih strani: FACTUM d.o.o." color="#FBFDFD" fontSize="12" width="287.60565" height="20"/>
<mx:Panel x="759" y="53" width="250" height="705.07043" layout="absolute" title="Plac za hitre novice" id="panel3">
<mx:Text x="0" y="0" text="MME novice" width="230" height="665.07043" id="text1"/>
<mx:Panel x="-10" y="325.35" width="250" height="336.61972" layout="absolute" title="začasna panela" color="#000203" themeColor="#4BA247" cornerRadius="10" backgroundColor="#4B9539" id="panel2">
<mx:Label x="145" y="53" text="vrednost" id="spremmen"/>
<mx:Label x="125" y="78" text="Label"/>
<mx:Label x="125" y="103" text="Label"/>
<mx:Label x="0" y="53" text="spremenljivka iz Menuja:"/>
<mx:Label x="45" y="78" text="Label"/>
<mx:Label x="45" y="103" text="Label"/>
</mx:Panel>
</mx:Panel>
<mx:Label x="9.9" y="10" text="plac za naslov MME vsebine" id="MMEnaslov" color="#040000"/>
</mx:states></mx:Application>I know it's been a while but… did you fix this?
It looks to me like you are terminating the <mx:Application> tag at the top. The opening tag should end like this: resultFormat="e4x">, not resultFormat="e4x"/> (Remove the /).
Carlos -
Please I really need help with this video problem.
Hi!
Please I need help with this app I am trying to make for an Android cellphone and I've been struggling with this for a couple of months.
I have a main flash file (video player.fla) that will load external swf files. This is the main screen.When I click the Sets Anteriores button I want to open another swf file called sets.swf.The app is freezing when I click Sets Anteriores button
Here is the code for this fla file.
import flash.events.MouseEvent;
preloaderBar.visible = false;
var loader:Loader = new Loader();
btHome.enabled = false;
var filme : String = "";
carregaFilme("home.swf");
function carregaFilme(filme : String ) :void
var reqMovie:URLRequest = new URLRequest(filme);
loader.load(reqMovie);
loader.contentLoaderInfo.addEventListener(Event.OPEN,comeco);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,progresso);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,completo);
palco.addChild(loader);
function comeco(event:Event):void
preloaderBar.visible = true;
preloaderBar.barra.scaleX = 0;
function progresso(e:ProgressEvent):void
var perc:Number = e.bytesLoaded / e.bytesTotal;
preloaderBar.percent.text = Math.ceil(perc*100).toString();
preloaderBar.barra.scaleX = perc;
function completo(e:Event):void
preloaderBar.percent.text = '';
preloaderBar.visible = false;
btHome.addEventListener(MouseEvent.MOUSE_DOWN,onHomeDown);
btHome.addEventListener(MouseEvent.MOUSE_UP,onHomeUp);
btSets.addEventListener(MouseEvent.MOUSE_DOWN,onSetsDown);
btSets.addEventListener(MouseEvent.MOUSE_UP,onSetsUp);
btVivo.addEventListener(MouseEvent.MOUSE_DOWN,onVivoDown);
btVivo.addEventListener(MouseEvent.MOUSE_UP,onVivoUp);
btHome.addEventListener(MouseEvent.CLICK,onHomeClick);
btSets.addEventListener(MouseEvent.CLICK,onSetsClick);
function onSetsClick(Event : MouseEvent) : void
if (filme != "sets.swf")
filme = "sets.swf";
carregaFilme("sets.swf");
function onHomeClick(Event : MouseEvent) : void
if (filme != "home.swf")
filme = "home.swf";
carregaFilme("home.swf");
function onHomeDown(Event : MouseEvent) : void
btHome.y += 1;
function onHomeUp(Event : MouseEvent) : void
btHome.y -= 1;
function onSetsDown(Event : MouseEvent) : void
btSets.y += 1;
function onSetsUp(Event : MouseEvent) : void
btSets.y -= 1;
function onVivoDown(Event : MouseEvent) : void
btVivo.y += 1;
function onVivoUp(Event : MouseEvent) : void
btVivo.y -= 1;
Now this is the sets.fla file:
Here is the code for sets.fla
import flash.utils.Timer;
import flash.events.TimerEvent;
var video:Video;
var nc:NetConnection;
var ns:NetStream;
var t : Timer = new Timer(1000,0);
var meta:Object = new Object();
this.addEventListener(Event.ADDED_TO_STAGE,init);
function init(e:Event):void{
video= new Video(320, 240);
addChild(video);
video.x = 80;
video.y = 100;
nc= new NetConnection();
nc.connect(null);
ns = new NetStream(nc);
ns.addEventListener(NetStatusEvent.NET_STATUS, onStatusEvent);
ns.bufferTime = 1;
ns.client = meta;
video.attachNetStream(ns);
ns.play("http://www.djchambinho.com/videos/segundaquinta.flv");
ns.pause();
t.addEventListener(TimerEvent.TIMER,timeHandler);
t.start();
function onStatusEvent(stat:Object):void
trace(stat.info.code);
meta.onMetaData = function(meta:Object)
trace(meta.duration);
function timeHandler(event : TimerEvent) : void
if (ns.bytesLoaded>0&&ns.bytesLoaded == ns.bytesTotal )
ns.resume();
t.removeEventListener(TimerEvent.TIMER,timeHandler);
t.stop();
The problem is when I test it on my computer it works but when I upload it to my phone it freezes when I click Sets Anteriores button.
Please help me with this problem I dont know what else to do.
thank youMy first guess is you're simply generating an error. You'll always want to load this on your device in quick debugging over USB so you can see any errors you're generating.
Outside that, if you plan on accessing anything inside the SWF you should be loading the SWF into the correct context. Relevant sample code:
var context:LoaderContext = new LoaderContext();
context.securityDomain = SecurityDomain.currentDomain;
context.applicationDomain = ApplicationDomain.currentDomain;
var urlReq:URLRequest = new URLRequest("http://www.[your_domain_here].com/library.swf");
var ldr:Loader = new Loader();
ldr.load(urlReq, context);
More information:
http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9 b90204-7de0.html
If you're doing this on iOS you'll need to stripped SWFs if you plan on using any coding (ABC) inside the files. You mentioned iOS so I won't get into that here, but just incase, here's info on stripping external SWFs:
http://blogs.adobe.com/airodynamics/2013/03/08/external-hosting-of-secondary-swfs-for-air- apps-on-ios/ -
Please help! I am trying to change my Apple Id that used to be my mother to Mine- Every time i have it changed and i go and try and do an update it continues to ask for her old password. I really need help with this!
Phil0124 wrote:
Apps downloaded with an Apple ID are forever tied to that Apple ID and will always require it to update.
The only way around this is to delete the apps that require the other Apple ID and download them again with yours.
Or simply log out of iTunes & App stores then log in with updated AppleID. -
I need help with this code error "unreachable statement"
the error_
F:\Java\Projects\Tools.java:51: unreachable statement <-----------------------------------------------------------------------------------------------------------------THIS
int index;
^
F:\Java\Projects\Tools.java:71: missing return statement
}//end delete method
^
F:\Java\Projects\Tools.java:86: missing return statement
}//end getrecod
^
3 errors
import java.util.*;
import javax.swing.*;
import java.awt.*;
public class Tools//tool class
private int numberOfToolItems;
private ToolItems[] toolArray = new ToolItems[10];
public Tools()//array of tool
numberOfToolItems = 0;
for(int i = 0; i < toolArray.length; i++)//for loop to create the array tools
toolArray[i] = new ToolItems();
}//end for loop
}//end of array of tools
public int search(int id)//search mehtod
int index = 0;
while (index < numberOfToolItems)//while and if loop search
if(toolArray[index].getID() == id)
return index;
else
index ++;
}//en while and if loop
return -1;
}//end search method
public int insert(int id, int numberInStock, int quality, double basePrice, String nm)//insert method
if(numberOfToolItems >= toolArray.length)
return 0;
int index;
index = search(id); <-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------HERE
if (index == -1)
toolArray[index].assign(id,numberInStock, quality, basePrice,nm);
numberInStock ++;
return 1;
}//end if index
}//end if toolitem array
return -1;
}//end insert method
public int delete(/*int id*/)//delete method
}//end delete method
public void display()//display method
for(int i = 0; i < numberOfToolItems; i++)
//toolArray.display(g,y,x);
}//end display method
public String getRecord(int i)//get record method
// return toolArray[i].getName()+ "ID: "+toolArray[i].getID()
}//end getrecod
}//end class
Edited by: ladsoftware on Oct 9, 2009 6:08 AM
Edited by: ladsoftware on Oct 9, 2009 6:09 AM
Edited by: ladsoftware on Oct 9, 2009 6:10 AM
Edited by: ladsoftware on Oct 9, 2009 6:11 AMladsoftware wrote:
Subject: Re: I need help with this code error "unreachable statement"
F:\Java\Projects\Tools.java:51: unreachable statement <-----------------------------------------------------------------------------------------------------------------THIS
int index;
^
F:\Java\Projects\Tools.java:71: missing return statement
}//end delete method
^
F:\Java\Projects\Tools.java:86: missing return statement
}//end getrecod
^
3 errorsThe compiler is telling you exactly what the problems are:
public int insert(int id, int numberInStock, int quality, double basePrice, String nm)//insert method
if(numberOfToolItems >= toolArray.length)
return 0; // <<== HERE you return, so everyting in the if block after this is unreachable
int index;
index = search(id); //< -----------------------------------------------------------------------------------------------------------------HERE
if (index == -1)
toolArray[index].assign(id,numberInStock, quality, basePrice,nm);
numberInStock ++;
return 1;
}//end if index
}//end if toolitem array
return -1;
}//end insert method
public int delete(/*int id*/)//delete method
// <<== HERE where is the return statement?
}//end delete method
public String getRecord(int i)//get record method
// return toolArray.getName()+ "ID: "+toolArray[i].getID() <<== HERE you commented out the return statement
}//end getrecod
}//end class -
FormsCentral retiring in July???!!! Are you freaking kidding me? My clients use this feature all the time. What do you suggest I do now? What service do I go with that is comparable to it? I need help with this asap!
I would suggest checking out http://www.logiforms.com. They have really good PDF support for both hosted PDF's and generating PDFs. You can:
populate PDF forms from a web form submission
Merge multiple PDF's together using conditional logic
Include uploaded images in the generated PDF
Get Electronic signatures on PDF's
Use conditional logic when creating PDF's
Convert HTML to PDF. You design in HTML and CSS and use form field wildcards and generate the PDF
More of the PDF features are explained here:
PDF Form Creator | PDF Form Maker | V3.Logiforms.com
They are also offering a 25% discount to anyone coming from Forms Central... -
Please need help with this query
Hi !
Please need help with this query:
Needs to show (in cases of more than 1 loan offer) the latest create_date one time.
Meaning, In cases the USER_ID, LOAN_ID, CREATE_DATE are the same need to show only the latest, Thanks!!!
select distinct a.id,
create_date,
a.loanid,
a.rate,
a.pays,
a.gracetime,
a.emailtosend,
d.first_name,
d.last_name,
a.user_id
from CLAL_LOANCALC_DET a,
loan_Calculator b,
bv_user_profile c,
bv_mr_user_profile d
where b.loanid = a.loanid
and c.NET_USER_NO = a.resp_id
and d.user_id = c.user_id
and a.is_partner is null
and a.create_date between
TO_DATE('6/3/2008 01:00:00', 'DD/MM/YY HH24:MI:SS') and
TO_DATE('27/3/2008 23:59:00', 'DD/MM/YY HH24:MI:SS')
order by a.create_datePerhaps something like this...
select id, create_date, loanid, rate, pays, gracetime, emailtosend, first_name, last_name, user_id
from (
select distinct a.id,
create_date,
a.loanid,
a.rate,
a.pays,
a.gracetime,
a.emailtosend,
d.first_name,
d.last_name,
a.user_id,
max(create_date) over (partition by a.user_id, a.loadid) as max_create_date
from CLAL_LOANCALC_DET a,
loan_Calculator b,
bv_user_profile c,
bv_mr_user_profile d
where b.loanid = a.loanid
and c.NET_USER_NO = a.resp_id
and d.user_id = c.user_id
and a.is_partner is null
and a.create_date between
TO_DATE('6/3/2008 01:00:00', 'DD/MM/YY HH24:MI:SS') and
TO_DATE('27/3/2008 23:59:00', 'DD/MM/YY HH24:MI:SS')
where create_date = max_create_date
order by create_date -
I just downloaded an album from itunes and 2 of the tracks will not play at all, they cut off. I need help with this??
Does the track play correctly in Quicktime Player? If it does then it is an iTunes issue. If it doesn't then it is possible the file was not completely downloaded, or is corrupt.
Downloading (using iOS or computer) past purchases from the App Store, iBookstore, and iTunes Store - http://support.apple.com/kb/ht2519 - enabled with iTunes 10.3 and newer; not available in all countries; apps, books (not audiobooks), music, t.v. shows, and movies (some - not all studios have permitted this). Movies currently available in the USA only. Downloading previously purchased movies and TV shows requires iTunes 10.6 or later. Discontinued items not available. For items not included in the iCloud list (e.g., ringtones), or locations or computer systems where iCloud is not (yet?) available, you only get one download per fee paid.
If it can be downloaded again, delete the track from iTunes.
Select the store on the left side of iTunes.
Click on Purchased on the right side under Quick Links.
You can re-download your available previous purchases.
If it is corrupt and you cannot download it a second time, contact Apple. Contact iTunes Store support staff through the report a problem links in your account history or,
iTunes Customer Service Contact - http://www.apple.com/support/itunes/contact.html > Get iTunes support via Express Lane > iTunes > iTunes Store -
Need help with this assignment!!!!
Please help me with this. I am having some troubles. below is the specification of this assignment:
In geometry the ratio of the circumference of a circle to its diameter is known as �. The value of � can be estimated from an infinite series of the form:
� / 4 = 1 - (1/3) + (1/5) - (1/7) + (1/9) - (1/11) + ...
There is another novel approach to calculate �. Imagine that you have a dart board that is 2 units square. It inscribes a circle of unit radius. The center of the circle coincides with the center of the square. Now imagine that you throw darts at that dart board randomly. Then the ratio of the number of darts that fall within the circle to the total number of darts thrown is the same as the ratio of the area of the circle to the area of the square dart board. The area of a circle with unit radius is just � square unit. The area of the dart board is 4 square units. The ratio of the area of the circle to the area of the square is � / 4.
To simuluate the throwing of darts we will use a random number generator. The Math class has a random() method that can be used. This method returns random numbers between 0.0 (inclusive) to 1.0 (exclusive). There is an even better random number generator that is provided the Random class. We will first create a Random object called randomGen. This random number generator needs a seed to get started. We will read the time from the System clock and use that as our seed.
Random randomGen = new Random ( System.currentTimeMillis() );
Imagine that the square dart board has a coordinate system attached to it. The upper right corner has coordinates ( 1.0, 1.0) and the lower left corner has coordinates ( -1.0, -1.0 ). It has sides that are 2 units long and its center (as well as the center of the inscribed circle) is at the origin.
A random point inside the dart board can be specified by its x and y coordinates. These values are generated using the random number generator. There is a method nextDouble() that will return a double between 0.0 (inclusive) and 1.0 (exclusive). But we need random numbers between -1.0 and +1.0. The way we achieve that is:
double xPos = (randomGen.nextDouble()) * 2 - 1.0;
double yPos = (randomGen.nextDouble()) * 2 - 1.0;
To determine if a point is inside the circle its distance from the center of the circle must be less than the radius of the circle. The distance of a point with coordinates ( xPos, yPos ) from the center is Math.sqrt ( xPos * xPos + yPos * yPos ). The radius of the circle is 1 unit.
The class that you will be writing will be called CalculatePI. It will have the following structure:
import java.util.*;
public class CalculatePI
public static boolean isInside ( double xPos, double yPos )
public static double computePI ( int numThrows )
public static void main ( String[] args )
In your method main() you want to experiment and see if the accuracy of PI increases with the number of throws on the dartboard. You will compare your result with the value given by Math.PI. The quantity Difference in the output is your calculated value of PI minus Math.PI. Use the following number of throws to run your experiment - 100, 1000, 10,000, and 100,000. You will call the method computePI() with these numbers as input parameters. Your output will be of the following form:
Computation of PI using Random Numbers
Number of throws = 100, Computed PI = ..., Difference = ...
Number of throws = 1000, Computed PI = ..., Difference = ...
Number of throws = 10000, Computed PI = ..., Difference = ...
Number of throws = 100000, Computed PI = ..., Difference = ...
* Difference = Computed PI - Math.PI
In the method computePI() you will simulate the throw of a dart by generating random numbers for the x and y coordinates. You will call the method isInside() to determine if the point is inside the circle or not. This you will do as many times as specified by the number of throws. You will keep a count of the number of times a dart landed inside the circle. That figure divided by the total number of throws is the ratio � / 4. The method computePI() will return the computed value of PI.
and below is what i have so far:
import java.util.*;
public class CalculatePI
public static boolean isInside ( double xPos, double yPos )
boolean result;
double distance = Math.sqrt( xPos * xPos + yPos * yPos );
if (distance < 1)
result = true;
return result;
public static double computePI ( int numThrows )
Random randomGen = new Random ( System.currentTimeMillis() );
double xPos = (randomGen.nextDouble()) * 2 - 1.0;
double yPos = (randomGen.nextDouble()) * 2 - 1.0;
boolean isInside = isInside (xPos, yPos);
int hits = 0;
double PI = 0;
for ( int i = 0; i <= numThrows; i ++ )
if (isInside)
hits = hits + 1;
PI = 4 * ( hits / numThrows );
return PI;
public static void main ( String[] args )
Scanner sc = new Scanner (System.in);
System.out.print ("Enter number of throws:");
int numThrows = sc.nextInt();
double Difference = computePI(numThrows) - Math.PI;
System.out.println ("Number of throws = " + numThrows + ", Computed PI = " + computePI(numThrows) + ", Difference = " + Difference );
}when i tried to compile it says "variable result might not have been initialized" Why is this? and please check this program for me too see if theres any syntax or logic errors. Thanks.when i tried to compile it says "variable result might not have been
initialized" Why is this?Because you only assigned it if distance < 1. What is it assigned to if distance >= 1? It isn't.
Simple fix:
boolean result = (distance < 1);
return result;
or more simply:
return (distance < 1);
and please check this program for me too see if theres any syntax or
logic errors. Thanks.No, not going to do that. That's much more your job, and to ask specific questions about if needed. -
Need help with my graphic calculator!!!
Hello everybody!! I need help with my little program I made.... The problem is that I am unable to use to calculate but it is possible to compile the code!! What should I do?? Thanks in advance.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Aritmetik extends JFrame implements ActionListener{
private JLabel l1 = new JLabel("Tal1: ", JLabel.LEFT);
private JLabel l2 = new JLabel("Tal2: ", JLabel.LEFT);
private JLabel l3 = new JLabel("Resultat",JLabel.LEFT);
private JLabel l4 = new JLabel(" ", JLabel.RIGHT);
private JTextField t1 = new JTextField(" ",10);
private JTextField t2 = new JTextField(" ",10);
private JButton b1 = new JButton("+");
private JButton b2 = new JButton("-");
private JButton b3 = new JButton("*");
private JButton b4 = new JButton("/");
public Aritmetik(){
Container v = getContentPane();
v.setLayout(new GridLayout(5,2));
v.add(l1);
v.add(t1);
v.add(l2);
v.add(t2);
v.add(b1);
v.add(b2);
v.add(b3);
v.add(b4);
v.add(l3);
v.add(l4);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
pack();
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
public void actionPerformed(ActionEvent e){
int tal1 = Integer.parseInt(t1.getText());
int tal2 = Integer.parseInt(t2.getText());
if(e.getSource() == b1){
if(t1.getText().equals("") || t2.getText().equals(""))
JOptionPane.showMessageDialog(null, "Mata in tal!");
else{
l3.setText("Resultat ");
l4.setText(" " + (tal1+tal2));
else if(e.getSource() == b2){
int sub = tal1-tal2;
l4.setText(" " + (sub));
else if(e.getSource() == b3){
int multi = tal1*tal2;
l4.setText(" " + (multi));
else if(e.getSource() == b4){
int div = tal1/tal2;
l4.setText(" " + (div));
public static void main(String[] arg){
Aritmetik A =new Aritmetik();Here is your problem:
public void actionPerformed(ActionEvent e){
int tal1 = Integer.parseInt(t1.getText().trim()); // add the trim()
int tal2 = Integer.parseInt(t2.getText().trim()); // add the trim()
if(e.getSource() == b1){
if(t1.getText().equals("") || t2.getText().equals(""))
JOptionPane.showMessageDialog(null, "Mata in tal!");
else{
l3.setText("Resultat ");
l4.setText(" " + (tal1+tal2));
}... Better ...
public void actionPerformed(ActionEvent e) throws NumberFormatException {
String tala = t1.getText().trim();
String talb = t2.getText().trim();
if ( tala == null || "".equals(tala) || talb == null || "".equals(talb) ) {
JOptionPane.showMessageDialog(null, "Mata in tal!");
return();
int tal1 = Integer.parseInt(tala);
int tal2 = Integer.parseInt(talb);
if(e.getSource() == b1){
l3.setText("Resultat ");
l4.setText(" " + (tal1+tal2));
else if(e.getSource() == b2){
int sub = tal1-tal2;
l4.setText(" " + (sub));
else if(e.getSource() == b3){
int multi = tal1*tal2;
l4.setText(" " + (multi));
else if(e.getSource() == b4){
int div = tal1/tal2;
l4.setText(" " + (div));
}Message was edited by:
abillconsl -
[8i] Need help with some workday calculations
At the beginning of the month, I got help with a workday calculation in: [8i] Help with function with parameters (for workday calculation)
Now, as it turns out, I was able to locate a function in the database that does what I want, however, it is much slower to use the function than to join two copies of the CALN table (Please see referenced thread for details. I can copy them to this thread if necessary.) I need to verify that the pre-existing function has 'DETERMINISTIC' in it, as I would guess that if it doesn't, it would be much slower than it could be.
But now, I've come across a situation where I have to do multiple workday calculations in the same query--enough that I have to join 6 copies of my CALN table. I can't imagine that is at all efficient. I believe it was Frank K. who said (in the original thread) that if the function was slow, I should consider alternatives. Can anyone help me identify some of those alternatives? I'm definitely at that point now. (This query is one I'm using as the base for a report in Oracle BI, and let's just say it doesn't like my query, even though my syntax appears to be correct, and I would guess that joining 6 copies of one table is at least partly to blame for this).
Note: I'm working with Oracle 8iOK, I finally have some sample data... I tried to make it thorough. I've included data in the CALN table YTD + tomorrow, so that any workday calculations using SYSDATE will work.
CREATE TABLE caln
( clndr_dt DATE NOT NULL
, clndr_yr NUMBER
, shop_day NUMBER
, shop_dt DATE
, shop_wk NUMBER
, shop_yr NUMBER
, shop_days NUMBER
, clndr_days NUMBER
CONSTRAINT caln_pk PRIMARY KEY (clndr_dt)
INSERT INTO caln
VALUES (To_Date('12/23/2009','mm/dd/yyyy'),2009,247,To_Date('12/23/2009','mm/dd/yyyy'),51,2009,7631,10950);
INSERT INTO caln
VALUES (To_Date('01/01/2010','mm/dd/yyyy'),2010,0,To_Date('12/23/2009','mm/dd/yyyy'),52,2009,7631,10959);
INSERT INTO caln
VALUES (To_Date('01/02/2010','mm/dd/yyyy'),2010,0,To_Date('12/23/2009','mm/dd/yyyy'),52,2009,7631,10960);
INSERT INTO caln
VALUES (To_Date('01/03/2010','mm/dd/yyyy'),2010,0,To_Date('12/23/2009','mm/dd/yyyy'),1,2010,7631,10961);
INSERT INTO caln
VALUES (To_Date('01/04/2010','mm/dd/yyyy'),2010,1,To_Date('01/04/2010','mm/dd/yyyy'),1,2010,7632,10962);
INSERT INTO caln
VALUES (To_Date('01/05/2010','mm/dd/yyyy'),2010,2,To_Date('01/05/2010','mm/dd/yyyy'),1,2010,7633,10963);
INSERT INTO caln
VALUES (To_Date('01/06/2010','mm/dd/yyyy'),2010,3,To_Date('01/06/2010','mm/dd/yyyy'),1,2010,7634,10964);
INSERT INTO caln
VALUES (To_Date('01/07/2010','mm/dd/yyyy'),2010,4,To_Date('01/07/2010','mm/dd/yyyy'),1,2010,7635,10965);
INSERT INTO caln
VALUES (To_Date('01/08/2010','mm/dd/yyyy'),2010,5,To_Date('01/08/2010','mm/dd/yyyy'),1,2010,7636,10966);
INSERT INTO caln
VALUES (To_Date('01/09/2010','mm/dd/yyyy'),2010,0,To_Date('01/08/2010','mm/dd/yyyy'),1,2010,7636,10967);
INSERT INTO caln
VALUES (To_Date('01/10/2010','mm/dd/yyyy'),2010,0,To_Date('01/08/2010','mm/dd/yyyy'),2,2010,7636,10968);
INSERT INTO caln
VALUES (To_Date('01/11/2010','mm/dd/yyyy'),2010,6,To_Date('01/11/2010','mm/dd/yyyy'),2,2010,7637,10969);
INSERT INTO caln
VALUES (To_Date('01/12/2010','mm/dd/yyyy'),2010,7,To_Date('01/12/2010','mm/dd/yyyy'),2,2010,7638,10970);
INSERT INTO caln
VALUES (To_Date('01/13/2010','mm/dd/yyyy'),2010,8,To_Date('01/13/2010','mm/dd/yyyy'),2,2010,7639,10971);
INSERT INTO caln
VALUES (To_Date('01/14/2010','mm/dd/yyyy'),2010,9,To_Date('01/14/2010','mm/dd/yyyy'),2,2010,7640,10972);
INSERT INTO caln
VALUES (To_Date('01/15/2010','mm/dd/yyyy'),2010,10,To_Date('01/15/2010','mm/dd/yyyy'),2,2010,7641,10973);
INSERT INTO caln
VALUES (To_Date('01/16/2010','mm/dd/yyyy'),2010,0,To_Date('01/15/2010','mm/dd/yyyy'),2,2010,7641,10974);
INSERT INTO caln
VALUES (To_Date('01/17/2010','mm/dd/yyyy'),2010,0,To_Date('01/15/2010','mm/dd/yyyy'),3,2010,7641,10975);
INSERT INTO caln
VALUES (To_Date('01/18/2010','mm/dd/yyyy'),2010,11,To_Date('01/18/2010','mm/dd/yyyy'),3,2010,7642,10976);
INSERT INTO caln
VALUES (To_Date('01/19/2010','mm/dd/yyyy'),2010,12,To_Date('01/19/2010','mm/dd/yyyy'),3,2010,7643,10977);
INSERT INTO caln
VALUES (To_Date('01/20/2010','mm/dd/yyyy'),2010,13,To_Date('01/20/2010','mm/dd/yyyy'),3,2010,7644,10978);
INSERT INTO caln
VALUES (To_Date('01/21/2010','mm/dd/yyyy'),2010,14,To_Date('01/21/2010','mm/dd/yyyy'),3,2010,7645,10979);
INSERT INTO caln
VALUES (To_Date('01/22/2010','mm/dd/yyyy'),2010,15,To_Date('01/22/2010','mm/dd/yyyy'),3,2010,7646,10980);
INSERT INTO caln
VALUES (To_Date('01/23/2010','mm/dd/yyyy'),2010,0,To_Date('01/22/2010','mm/dd/yyyy'),3,2010,7646,10981);
INSERT INTO caln
VALUES (To_Date('01/24/2010','mm/dd/yyyy'),2010,0,To_Date('01/22/2010','mm/dd/yyyy'),4,2010,7646,10982);
INSERT INTO caln
VALUES (To_Date('01/25/2010','mm/dd/yyyy'),2010,16,To_Date('01/25/2010','mm/dd/yyyy'),4,2010,7647,10983);
INSERT INTO caln
VALUES (To_Date('01/26/2010','mm/dd/yyyy'),2010,17,To_Date('01/26/2010','mm/dd/yyyy'),4,2010,7648,10984);
INSERT INTO caln
VALUES (To_Date('01/27/2010','mm/dd/yyyy'),2010,18,To_Date('01/27/2010','mm/dd/yyyy'),4,2010,7649,10985);
INSERT INTO caln
VALUES (To_Date('01/28/2010','mm/dd/yyyy'),2010,19,To_Date('01/28/2010','mm/dd/yyyy'),4,2010,7650,10986);
INSERT INTO caln
VALUES (To_Date('01/29/2010','mm/dd/yyyy'),2010,20,To_Date('01/29/2010','mm/dd/yyyy'),4,2010,7651,10987);
INSERT INTO caln
VALUES (To_Date('01/30/2010','mm/dd/yyyy'),2010,0,To_Date('01/29/2010','mm/dd/yyyy'),4,2010,7651,10988);
INSERT INTO caln
VALUES (To_Date('01/31/2010','mm/dd/yyyy'),2010,0,To_Date('01/29/2010','mm/dd/yyyy'),5,2010,7651,10989);
INSERT INTO caln
VALUES (To_Date('02/01/2010','mm/dd/yyyy'),2010,21,To_Date('02/01/2010','mm/dd/yyyy'),5,2010,7652,10990);
INSERT INTO caln
VALUES (To_Date('02/02/2010','mm/dd/yyyy'),2010,22,To_Date('02/02/2010','mm/dd/yyyy'),5,2010,7653,10991);
INSERT INTO caln
VALUES (To_Date('02/03/2010','mm/dd/yyyy'),2010,23,To_Date('02/03/2010','mm/dd/yyyy'),5,2010,7654,10992);
INSERT INTO caln
VALUES (To_Date('02/04/2010','mm/dd/yyyy'),2010,24,To_Date('02/04/2010','mm/dd/yyyy'),5,2010,7655,10993);
INSERT INTO caln
VALUES (To_Date('02/05/2010','mm/dd/yyyy'),2010,25,To_Date('02/05/2010','mm/dd/yyyy'),5,2010,7656,10994);
INSERT INTO caln
VALUES (To_Date('02/06/2010','mm/dd/yyyy'),2010,0,To_Date('02/05/2010','mm/dd/yyyy'),5,2010,7656,10995);
INSERT INTO caln
VALUES (To_Date('02/07/2010','mm/dd/yyyy'),2010,0,To_Date('02/05/2010','mm/dd/yyyy'),6,2010,7656,10996);
INSERT INTO caln
VALUES (To_Date('02/08/2010','mm/dd/yyyy'),2010,26,To_Date('02/08/2010','mm/dd/yyyy'),6,2010,7657,10997);
INSERT INTO caln
VALUES (To_Date('02/09/2010','mm/dd/yyyy'),2010,27,To_Date('02/09/2010','mm/dd/yyyy'),6,2010,7658,10998);
INSERT INTO caln
VALUES (To_Date('02/10/2010','mm/dd/yyyy'),2010,28,To_Date('02/10/2010','mm/dd/yyyy'),6,2010,7659,10999);
INSERT INTO caln
VALUES (To_Date('02/11/2010','mm/dd/yyyy'),2010,29,To_Date('02/11/2010','mm/dd/yyyy'),6,2010,7660,11000);
INSERT INTO caln
VALUES (To_Date('02/12/2010','mm/dd/yyyy'),2010,30,To_Date('02/12/2010','mm/dd/yyyy'),6,2010,7661,11001);
INSERT INTO caln
VALUES (To_Date('02/13/2010','mm/dd/yyyy'),2010,0,To_Date('02/12/2010','mm/dd/yyyy'),6,2010,7661,11002);
INSERT INTO caln
VALUES (To_Date('02/14/2010','mm/dd/yyyy'),2010,0,To_Date('02/12/2010','mm/dd/yyyy'),7,2010,7661,11003);
INSERT INTO caln
VALUES (To_Date('02/15/2010','mm/dd/yyyy'),2010,31,To_Date('02/15/2010','mm/dd/yyyy'),7,2010,7662,11004);
INSERT INTO caln
VALUES (To_Date('02/16/2010','mm/dd/yyyy'),2010,32,To_Date('02/16/2010','mm/dd/yyyy'),7,2010,7663,11005);
INSERT INTO caln
VALUES (To_Date('02/17/2010','mm/dd/yyyy'),2010,33,To_Date('02/17/2010','mm/dd/yyyy'),7,2010,7664,11006);
INSERT INTO caln
VALUES (To_Date('02/18/2010','mm/dd/yyyy'),2010,34,To_Date('02/18/2010','mm/dd/yyyy'),7,2010,7665,11007);
INSERT INTO caln
VALUES (To_Date('02/19/2010','mm/dd/yyyy'),2010,35,To_Date('02/19/2010','mm/dd/yyyy'),7,2010,7666,11008);
INSERT INTO caln
VALUES (To_Date('02/20/2010','mm/dd/yyyy'),2010,0,To_Date('02/19/2010','mm/dd/yyyy'),7,2010,7666,11009);
CREATE TABLE ords
( ord_nbr NUMBER NOT NULL
, sub_nbr NUMBER NOT NULL
, ord_stat VARCHAR2(2)
, ord_qty NUMBER
, part_nbr VARCHAR2(5)
CONSTRAINT ords_pk PRIMARY KEY (ord_nbr, sub_nbr)
INSERT INTO ords
VALUES (1,1,'CL',10,'PART1');
INSERT INTO ords
VALUES (1,2,'CL',5,'PART1');
INSERT INTO ords
VALUES (25,1,'CL',15,'PART2');
INSERT INTO ords
VALUES (14,1,'OP',12,'PART3');
INSERT INTO ords
VALUES (33,1,'CL',25,'PART1');
INSERT INTO ords
VALUES (33,2,'CL',15,'PART1');
INSERT INTO ords
VALUES (33,3,'OP',10,'PART1');
INSERT INTO ords
VALUES (7,1,'PL',18,'PART2');
INSERT INTO ords
VALUES (96,1,'PL',10,'PART3');
INSERT INTO ords
VALUES (31,1,'CL',20,'PART2');
CREATE TABLE oops
( ord_nbr NUMBER NOT NULL
, sub_nbr NUMBER NOT NULL
, op_nbr VARCHAR2(4) NOT NULL
, mach_id VARCHAR2(4)
, oper_stat VARCHAR2(2)
, plan_start_dt DATE
, plsu NUMBER
, plrn NUMBER
CONSTRAINT ords_pk PRIMARY KEY (ord_nbr, sub_nbr, op_nbr)
-- NOTE:
-- for the orders with a status of 'CL' or 'PL' in the 'ords' table, I'm not bothering to put
-- in more than two operations (though in reality more would be there) since they should be
-- ignored in the final result anyway
INSERT INTO oops
VALUES (1,1,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.2);
INSERT INTO oops
VALUES (1,1,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.15);
INSERT INTO oops
VALUES (1,2,'0010','123A','CP',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.2);
INSERT INTO oops
VALUES (1,2,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.15);
INSERT INTO oops
VALUES (25,1,'0005','123A','CP',TO_DATE('01/18/2010','mm/dd/yyyy'),2,0.25);
INSERT INTO oops
VALUES (25,1,'0030','110C','CL',TO_DATE('01/19/2010','mm/dd/yyyy'),4,0.1);
INSERT INTO oops
VALUES (14,1,'0010','127A','CP',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.25);
INSERT INTO oops
VALUES (14,1,'0025','110C','CL',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
INSERT INTO oops
VALUES (14,1,'0040','050C','CP',TO_DATE('01/13/2010','mm/dd/yyyy'),1.3,0.15);
INSERT INTO oops
VALUES (14,1,'0050','220B','WK',TO_DATE('01/14/2010','mm/dd/yyyy'),4,0.25);
INSERT INTO oops
VALUES (14,1,'0065','242B','AV',TO_DATE('01/18/2010','mm/dd/yyyy'),1.5,0.1);
INSERT INTO oops
VALUES (14,1,'0067','150G','NA',TO_DATE('01/19/2010','mm/dd/yyyy'),2,0.1);
INSERT INTO oops
VALUES (14,1,'0100','250G','NA',TO_DATE('01/20/2010','mm/dd/yyyy'),2.1,0.2);
INSERT INTO oops
VALUES (33,1,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
INSERT INTO oops
VALUES (33,1,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
INSERT INTO oops
VALUES (33,2,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
INSERT INTO oops
VALUES (33,2,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
INSERT INTO oops
VALUES (33,3,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
INSERT INTO oops
VALUES (33,3,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
INSERT INTO oops
VALUES (33,3,'0020','220B','NA',TO_DATE('01/12/2010','mm/dd/yyyy'),1.7,0.15);
INSERT INTO oops
VALUES (33,3,'0030','150G','NA',TO_DATE('01/13/2010','mm/dd/yyyy'),1.3,0.05);
INSERT INTO oops
VALUES (33,3,'0055','150G','NA',TO_DATE('01/15/2010','mm/dd/yyyy'),2.1.,0.1);
INSERT INTO oops
VALUES (7,1,'0005','123A','NA',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.2);
INSERT INTO oops
VALUES (7,1,'0030','110C','NA',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.15);
INSERT INTO oops
VALUES (96,1,'0010','127A','NA',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.25);
INSERT INTO oops
VALUES (96,1,'0025','110C','NA',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
INSERT INTO oops
VALUES (31,1,'0005','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
INSERT INTO oops
VALUES (31,1,'0030','110C','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
CREATE TABLE mach
( mach_id VARCHAR2(4) NOT NULL
, desc_short VARCHAR2(9)
, group VARCHAR2(7)
CONSTRAINT ords_pk PRIMARY KEY (mach_id)
INSERT INTO mach
VALUES ('123A','desc here','GROUPH1');
INSERT INTO mach
VALUES ('259B','desc here','GROUPH2');
INSERT INTO mach
VALUES ('110C','desc here','GROUPJ1');
INSERT INTO mach
VALUES ('050C','desc here','GROUPK2');
INSERT INTO mach
VALUES ('220B','desc here','GROUPH2');
INSERT INTO mach
VALUES ('242B','desc here','GROUPH2');
INSERT INTO mach
VALUES ('150G','desc here','GROUPL1');
INSERT INTO mach
VALUES ('250G','desc here','GROUPL2');
INSERT INTO mach
VALUES ('242B','desc here','GROUPH2');
Maybe you are looking for
-
Adobe CC apps nightmare, hideous interfaces
Hi, I have just bought into the whole Adobe CC apps things after years of working with CS4, 5 and 5.5 and remaining compatible with most of my clients, few are taking the leap to CC right now. And when I report on what my last week has been like with
-
Ora 12543 tns destination host not reachable
Dear All, OS: RHEL 5 DB VERSION:-11.2.0 I am facing problem related to ora 12543 tns destination host not reachable The problem here is little bit different what exactly other face:- i have 2 servers with name abc.localdomain & xyz.localdomain. Db na
-
What can i do? Please help!! i just fail to purchase gold in the game~
-
How to view the calendar in Outlook
Is there a way to view my iCloud calendar in Outlook (similar to how this link describes it for a Google calendar): http://www.howtogeek.com/howto/18353/view-your-google-calendar-in-outlook-2010/ I would much prefer not to install any software on m
-
Mail Update for Mavericks will not install
Downloaded the Mail update for Mavericks. When I run the installer, it says my volume does not meet the requirments for this update. Thoughts?