Problem converting degrees and radians

I am programming a Java program that uses a ui that uses inheritance and polymorphism. It askes the user what shape would he/she like to input information on. Lets say they choose 1 for Line and then another ui apears (i.e. JOptionpane is being used) and the user may input the starting coord for line (x1, y1) and ending coord (x2, y2) or the user may input starting coords and (length and angle) of line. If the user chooses to enter starting and ending coord then the program outputs the starting and ending coord plus it outputs the Length and angle.
Here is the formula:
length = sqrt(( x2 - x1) ^2 + (y2 - y1) ^ 2)
alpha = atan((y2 - y1) /(x2 - x1))
angle must be in degrees before printing (angle * 180/3.14159)
Problem is the angle returns the wrong degrees back.
Can any one help with this problem THANKS!
Here is the formula:
x2 = x1 + length * cos(alpha);
y2 = y1 + length * sin(alpha);
angle must be in radians before calculations (angle * 180/3.14159)
Problem is that my points give me incorrect ending points.

Here is my code for class Line.
* Dwayne Brown
* Line class
package mypackage;
public class Line  extends Point
//fields
private int x2;
private int y2;
private double length;
private double angle;
private double alpha;
  //default constructor
  public Line()
  //implicit call to constructor
  }//end contructor
//constructor with arguments
  public Line(int xValue1, int yValue1, int xValue2, int yValue2)
  //implicit call to constructor
  //call super constructor to Point
  super(xValue1, yValue1);
  setX2(xValue2);
  setY2(yValue2);
  }//end of constructor
  //constructor with arguments
  public Line(int xValue1, int yValue1, double len, double ang)
  //implicit call to constructor
  //call super constructor to Point
  super(xValue1, yValue1);
  setLength(len);
  setAngle(ang);
  alpha = ang * Math.PI/180.0;
  }//end contructor
  //setX2
  public void setX2(int xValue2)
  //evaluate x2 value
  if(xValue2 > 0 || xValue2 < 0)
  x2 = xValue2;
  else
  //sets x2
  x2 = super.getX1() + (int)length * (int)alpha;
  }//end of setX2 method
  //setY2
  public void setY2(int yValue2)
  //evaluate x2 value
  if(yValue2 > 0 || yValue2 < 0)
  y2 = yValue2;
  else
  //sets y2
  y2 = super.getY1() + (int)length * (int)alpha;
  }//end of setY2 method
  //setLength
  public void setLength(double len)
    if(len != 0 )
    length = len;
    else
    //set length
    length = Math.sqrt( Math.pow((x2 - super.getX1()),2) +
    Math.pow(y2 - super.getY1(),2) );
    }//end of else statement
  }//end setLength method
  //setAngle
  public void setAngle(double ang)
    if(ang != 0)
    angle = ang;
    else
    alpha = Math.atan( (y2 - super.getY1() / x2 - super.getX1()) );
    angle = alpha / (Math.PI / 180.0);
    }//end of else statement
  }//end setAngle method
////////////////// getFunctions ///////////////////////
  public int getX2()
    return x2;
  }//end getX2 method
   public int getY2()
    return y2;
  }//end getY2 method
   public double getLength()
    return length;
  }//end getLength method
   public double getAngle()
    return angle;
  }//end getAngle method
//////////////////// toString /////////////////////////
//////////////////// getName //////////////////////////
  public String getName()
    return "Line"; 
  }//end of getName method
  public String toString()
    return getName()+super.toString()+"\nEnd Coordinat=("+x2+", "+y2+")"
    +"\nLine Length="+getLength()+"\nLine Angle with the x-axis="+getAngle();
  }//end toString method
}//end of class line

Similar Messages

  • Convert degrees to decimal equivalent

    can someone help me convert 74degrees,13 minutes ,13 secs and 7degrees,14 mins,55secs to decimal degrees and radians and then convert back to degree minutes.

    import java.util.Scanner;
    public class Angles
         public static void main (String[] args)
              Scanner scan = new Scanner(System.in);
              // takes the first angles from the user
              System.out.print("Enter the Degrees of the first angle < 360: ");
              int Angle1 = scan.nextInt();
         i dont know how to continue

  • Problems converting PDF to MS Word document.  I successfuly converted 4 files and now subsequent files generate a "conversion failure" error when attempting to convert the file.  I have a large manuscript and I separated each chapter to assist with the co

    Problems converting PDF to MS Word document.  I successfully converted 4 files and now subsequent files generate a "conversion failure" error when attempting to convert the file.  I have a large manuscript and I separated each chapter to assist with the conversion; like I said, first 4 parts no problem, then conversion failure.  I attempted to convert the entire document and same result.  I specifically purchased the export to Word feature.  Please assist.  I initially had to export the Word Perfect document into PDF and attempting to go from PDF to MS Word.

    Hi sdr2014,
    I'm sorry to hear your conversion process has stalled. It sounds as though the problem isn't specific to one file, as you've been unable to convert anything since the first four chapters converted successfully.
    So, let's try this:
    If you're converting via the ExportPDF website, please log out, clear the browser cache, and then log back in. If you're using Reader, please choose Help > Check for Updates to make sure that you have the most current version installed.
    Please let us know how it goes.
    Best,
    Sara

  • RightFax and PDF result in 'Problem Converting Fax Body or Cover Sheet'

    Hi All:
    We are trying to send out faxes of invoices and reports to our customers.  We have RightFax software and have used it for a long time.  We are converting our reports to PDF and send them to RightFax.  I am getting 'Problem Converting Fax Body or Cover Sheet'.  I can create a PDF from a word document and it will send it, but files output from SSRS errors.  What is different between the two.
    PhilPHuhn

    Hi All,
    We use RightFax and to get around the problem of
    Problem Converting Fax Body or Cover Sheet we were told to
    open up the PDF you want to send and click print
    Select the RightFax printer and hit print.
    It will now open up the RightFax window with the PDF attached and you just add in the telephon number and other details
    as you would send your fax.
    regards
    Anthony

  • I am having a problem converting word onto PDF . PDF into word.Please help .I am signed and paid to Feb 2015

    Can someone advise me why I am having this problem

    Always in the past .I have my Word Document on screen and then I go to 
    Publish and it atomatically PDF the doc.
    The same if I have a PDF to convert to word. I have the PDF on screen and 
    to the right of my screen it will say Convert .I press on convert it
    converts to  word
    In a message dated 12/17/2014 10:01:32 A.M. Eastern Standard Time, 
    [email protected] writes:
    I  am having a problem converting word onto PDF . PDF into word.Please help
    .I am signed and paid to Feb 2015
    created by florencejohn (https://forums.adobe.com/people/florencejohn) 
    in  Adobe Acrobat.com Services - View the full  discussion
    (https://forums.adobe.com/message/7023171#7023171)

  • HT4623 My iphone 5 seems to be stuck in the horizontal view when I'm in the message mode.  In all other views I can turn the phone 90 degrees and horizontal to vertical works fine.  Not sure what the problem is.

    My iphone 5 seems to be stuck in the horizontal view when I'm in the message mode.  In all other views I can turn the phone 90 degrees and horizontal to vertical works fine.  Not sure what the problem is.

    I found a solution!
    Perhaps this is just temporary, but I have my display up and working again.
    Although the symptoms are different were a bit different, the solution here worked:
    http://apple.stackexchange.com/questions/120259/grey-screen-after-login-blue-scr een-of-death-from-cmdr
    As I was able to connect to my HD via an external monitor, in the finder, I went to:
    1. Macintosh HD --> System --> Library --> Extensions
    2. From there I moved all of the files that started with ADM and ATI (19 in total for me) to a folder on my desktop. (You will need to enter your admin password for this)
    3. Next was a restart.
    4. Then my display started working again.
    5. After that, I transferred the files back into my Extensions folder.
    6. I then did another restart with my fingers crossed and breath held. It worked.
    Also... During the last few days of trying to find a fix, I restored a Mavericks backup to my computer away from Yosemite.
    I'm very sure this problem occurred when I put my MBP to sleep, disconnected the power in its sleep, while something was connected to a USB port and unplugging the USB device (for me an iPhone charger) while the MBP was closed.
    I hope this helps the next person.

  • I am having a problem converting a scanned pdf file into Excel.

    I am having a problem converting a scanned pdf file into Excel. I do not get the columns and rows to align, just a single column of everything. Any suggestions?

    Export makes use of what is "in" a PDF.
    Good export is the "silk purse" and, ya know, you canna make a silk purse from a sow's ear (which is what any scanned image in PDF is with regards to export).
    The quality of export is dictated by the quality of the PDF. We are taking about the "inner essences" of the PDF (e.g., degree of compliance with the PDF Standard - ISO 32000-1).
    So, what goes in goes out or "GIGO".
    This has nothing to do with Acrobat or Acrobat's export process.
    A well-formed Tagged PDF (compliant to ISO 32000-1 & ISO 14289-1, PDF/UA-1) provides a PDF that proactively
    supports content export by Acrobat.
    To get the good stuff from export you start with a well-formed Tagged PDF.
    Goodstuff In — Goodstuff Out
    or
    Garbage In — Garbage Out
    "GIGO"
    Be well...
    Message was edited by: CtDave

  • Problem with ECS and XSD

    Hi B2B Gurus,
    We are facing the problem with ECS and XSD files from past 2 weeks, Steps we followed
    1. Created a ECS file in document editor version 11g: 6.6.0
    2. ECS files consists only from ST and SE segments
    Ex: ST
    BCH
    CUR
    REF
    PER -- Exclude
    TAX -- Exclude
    SE
    3: Generated a XSD file from ECS file( File --> export---> Oracle B2B) in document ediotr
    4. We imported a ECS and XSD file in B2B console( documents---docdef-transaction set ECS file) and XSD File
    5. We tested one file from manually we face below error:
    Error Code B2B-51507
    Error Description Machine Info: (usmtnz-dinfap19.dev.emrsn.org) Description: Payload validation error.
    Error Level ERROR_LEVEL_COLLABORATION
    Error Severity ERROR
    Error Text
    and some times it shows Guideline load Error or simply Error
    Please help us to resolve this
    Regards

    Anuj,
    We are sending the EDI XML file from backend, then B2B will convert it into EDI file, How can we analyze EDI XML file with ECS file, B2B is not converting to EDI.
    1. Can we use 10g ECS file and XSD file in 11G
    2. I tried to import it, but it showing below error while doing testing
    App Message property     {MSG_ID=90422086, Sequencing=false, DOCTYPE_REVISION=5020, MSG_TYPE=1, FROM_PARTY=EMERSON, DOCTYPE_NAME=850, TO_PARTY=APLL, ATTACHMENT=}
    Direction     OUTBOUND
    State     MSG_ERROR
    Error Code     B2B-51507
    Error Text     Error Brief : The element does not include any significant data.
    Error Description     Error : The Element PER02 does not include any significant data characters. Segment PER is defined in the guideline at position 3600.{br}{br}This error was detected at:{br}{tab}Segment Count: 11{br}{tab}Element Count: 2{br}{tab}Characters: 5395 through 5397
    Created Date     06/20/2011 02:52 PM
    Modified Date     06/20/2011 02:52 PM
    Note: I used the same files in 10G its working fine.
    Regards
    Edited by: Francis on Jun 20, 2011 10:48 AM

  • Problem with Class and Classpath

    Hello ME Windows Users, now before you place a wry smile on your face, I have a problem with path and classpath. Stop it, I can see you smiling!
    By visiting the the last 10 pages of the forum and reading Sun installation notes, some tooldocs and by given some answers by some nice people, I have become an expert in turning off my computer, about 10 times/hr. I still am trying to make my first cup of java.
    With the ME computer,
    I'm unable to right click on the desktop and go to properties, advanced,
    I'm unable to go go start, run, sysedit,
    I'm unable to change the ms-dos window of autoexec.bat, it just shuts down.
    Now before you tell me, I should of bought a different computer, the only place I can find to modify the path and classpath is in the environment which is in system configuration under tools. Here I have placed numerous configurations, like
    C:\java>set path=%path%;c:\j2sdk1.4.2\bin
    C:\java>set classpath=%classpath%;.;
    ;java_dir\bin where ;java_bin is c:\j2sdk1.4.2
    .; java_dir\bin; %path% where ;java_bin is c:\j2sdk1.4.2 and the list goes on.
    But, I know you are still smiling, the % signs comes up in a dialog box, saying too many, and will not convert the text to the environment to be saved when I close down for the tenth time in the last hour.
    Can someone help me before I make a real cup of coffee and accidentally drop it on the ME box.
    Have a laugh on me Mik.

    C:\java>set path=%path%;c:\j2sdk1.4.2\binGood
    But it is no good because it has to many % and a dialog box appears, saying you have too many parameters.
    Are you saying I have to shutdown again to answer your ?
    From the HELP menu-
    To confirm startup commands line by line
    Click Start, and then click Shut down.
    Click Restart, click OK, and then press and hold the CTRL key until the Windows Startup Menu appears.
    Enter the number for Step-by-step confirmation, and then press ENTER.
    For each command you want to run, press Y.
    If the command runs successfully, you are prompted with the next command.
    If the command does not run successfully, you receive an error message.
    To skip a command, press N.
    Mik

  • Problem with exporting and printing from pages to PDF

    I have a problem with my Pages
    My font will not be embeded in my pdf files.
    I have saved as a ps file and in to the destiller and my fonts are missing.
    I need to send my file to the print shop but they will not accept my file and i now understand why.
    fonts are missing...
    Is there a workaround.
    I have no problem in Indesign or quark but pages.....
    I need help
    thanks a zillion

    The font is coming from a notation software Sibelius 4 and is namned opus
    Hmmm ... Sibelius is a music notation software and notations are marked up in MusicXML. Presumably the font file is an SFNT with TrueType splines, but it is probably not installed in OS X system folders - rather in an internal Sibelius application font folder. So presumably you do not see the font in FontBook and OS X font auditing does not apply to the font.
    Sibelius exports EPS files, right? If memory serves, an EPS is still legal even if the font resource is not embedded. And in any case, we know from the behaviour that the font resource is not embedded for some reason. So how do you get Sibelius to put the font resource inside the graphic ... normally there is a button in the EPS export procedure that gives you the option to Embed All Fonts.
    You do not seem to get this button, though. Or why else would you not have checked it already and the problem would have gone away already.
    The next point in troubleshooting this is that you are not following the path that would let OS X detect that an external font resource is not embedded.
    I go from pages-print-printer- acrobat Pro 8-save as Pdf-x
    What you are doing here is telling Pages to tell OS X to generate a PostScript program within which is nested your Encapsulated PostScript program with the call to an unresolved external font resource.
    So why does Acrobat Pro not detect the unresolved external font resource? Hmm ... did you try the Preflight option in Acrobat 8 Pro? It should provide information on unresolved embeddings.
    I have also tried pages-print-printer- acrobat Pro 8 and save pdf as postscript and put the postscript file in destiller 8 pro with defalt setting high quality print
    The whole problem with EPS and PS is that this sort of situation is possible in the first place (plus, what is worse, the PS program can include custom additions to the graphics model that then fail in the PS interpreter whence Apple GX normalizing, Adobe Distiller normalizing, and Apple Quartz normalizing). You want to get as far away from EPS and PS as possible, believe me.
    So, you have not done what I posted that you should do in the first place. If I were you, I would first get rid of the problem that the EPS is making a call to an external font and then get rid of the problem that the PostScript is preserving the external call.
    To get rid of the problem that the EPS is preserving an external call, simply open the EPS in Apple Preview which includes a NORMALIZER for EPS/PS, and then save out the graphic as PDF. Alternatively, if you don't trust Quartz for some reason, set up a hotfolder for Distiller, make sure the option to embed all fonts is enabled, and convert the EPS to PDF.
    Now replace your EPS in Pages with PDF in Pages, and don't save PostScript to disk but save PDF to disk through the proper procedure which is File > Print > PDF > Save as PDF/X [for your custom configuration of the PDF/X-3 filter considering that no sane person in North Europe prints lowend US SWOP, we use ISO].
    If you begin by telling OS X that you want PDF within which fonts are supposed to be embedded ALWAYS, then you have started the right way. Otherwise, you have not told the operating system what you want to do, and this then leads you into places where you are unlikely to have the expertise to troubleshoot problems.
    So, forget placing EPS in the first place, place PDF. And forget saving PostScript to disk, save PDF to disk. If that does not sort your problem, here is the dirty solution for professional prepress.
    Adobe Photoshop has an EPS rasterizer that has wide tolerances for poor PostScript programming (so does Adobe Illustrator 6 and higher by the way).
    Therefore, if an EPS is posing problems, one workaround is to rasterize the EPS at high resolution in Photoshop and place that high resolution PDF in your layout.
    Take care that you rasterize as 1 bit at the required resolution of the print provider, probably 2450 dpi. When you save the 1 bit as PDF, Photoshop automatically compresses to a very, very small file (don't be surprised if 15Mb compresses to something like 0.5Mb).
    Rasterizing in Photoshop should not be necessary if you simply start by telling the operating system what it is you are trying to do. Then the operating system should be able to take the right decisions for you, and tell if you if finds problems it cannot resolve without turning to you.
    Good luck,
    Henrik
    would-be technical writer

  • How to convert FLV and F4V files to other media formats

    How to convert FLV and F4V files to other media formats
    Nowadays, every one can download their favorite videos from video sharing websites like YouTube, Hulu, MySpace, Google Video, metacafe, Yahoo! Video, Reuters.com and so on at will. However, these video files we got are usually in the format of FLV, or F4V, which are not workable by most portable devices, or some video players and video editors on our PC. With the intention of solving these problems, this guide will show you how to convert FLV and F4V files to other video and audio formats in detail.
    1. Download, install and run Pavtube FLV Converter
    As soon as you run this program, the following wine red interface will show up:
    2. Add files, set output format and destination folder
    Input FLV and F4V files to this program by clicking on “Add” button, and select a format as the output format in the drop-down list of “Format”, meanwhile, you can press the output folder to specify the destination folder or just use the path set by default. Moreover, “merge into one file” enables you to combine multiple FLV and F4V files to be as a single file, if you have this needs, just tick it.
    3. Set advanced settings
    Click “Settings” button, the following interface will pop up. You can change the parameters like screen size, bit rate, frame rate, sample rate, etc. on it to optimize the output quality or compress file size.
    4. Convert
    After all settings are done, you can press “Convert” button to start transferring, and then the following window will show you the conversion info in detail. According to the info you can manage your time and disk space properly.
    Pavtube FLV Converter can definitely complete the conversion at a swift speed with excellent quality; also it adopts an advanced audio-video sync technology, so that audio and video match very well in the resulted files. Therefore you need not worry about these issues.
    Useful tips:
    Free online FLV downloader:
    www.convertdirect.com
    http://vixy.net/
    http://www.videoconverterdownload.com/online-free-flv-converter.html
    http://www.flv2mp3.com/
    http://www.mediaconverter.org/
    http://2conv.com/
    http://online.movavi.com/
    http://www.youconvertit.com/
    http://www.playtube.com/
    http://www.convert.net/

    Flip4Mac

  • Error "Conversion failed when converting date and/or time from character string" to execute one query in sql 2008 r2, run ok in 2005.

    I have  a table-valued function that run in sql 2005 and when try to execute in sql 2008 r2, return the next "Conversion failed when converting date and/or time from character string".
    USE [Runtime]
    GO
    /****** Object:  UserDefinedFunction [dbo].[f_Pinto_Graf_P_Opt]    Script Date: 06/11/2013 08:47:47 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE   FUNCTION [dbo].[f_Pinto_Graf_P_Opt] (@fechaInicio datetime, @fechaFin datetime)  
    -- Declaramos la tabla "@Produc_Opt" que será devuelta por la funcion
    RETURNS @Produc_Opt table ( Hora datetime,NSACOS int, NSACOS_opt int)
    AS  
    BEGIN 
    -- Crea el Cursor
    DECLARE cursorHora CURSOR
    READ_ONLY
    FOR SELECT DateTime, Value FROM f_PP_Graficas ('Pinto_CON_SACOS',@fechaInicio, @fechaFin,'Pinto_PRODUCTO')
    -- Declaracion de variables locales
    DECLARE @produc_opt_hora int
    DECLARE @produc_opt_parc int
    DECLARE @nsacos int
    DECLARE @time_parc datetime
    -- Inicializamos VARIABLES
    SET @produc_opt_hora = (SELECT * FROM f_Valor (@fechaFin,'Pinto_PRODUC_OPT'))
    -- Abre y se crea el conjunto del cursor
    OPEN cursorHora
    -- Comenzamos los calculos 
    FETCH NEXT FROM cursorHora INTO @time_parc,@nsacos
    /************  BUCLE WHILE QUE SE VA A MOVER A TRAVES DEL CURSOR  ************/
    WHILE (@@fetch_status <> -1)
    BEGIN
    IF (@@fetch_status = -2)
    BEGIN
    -- Terminamos la ejecucion 
    BREAK
    END
    -- REALIZAMOS CÁLCULOS
    SET @produc_opt_parc = (SELECT dbo.f_P_Opt_Parc (@fechaInicio,@time_parc,@produc_opt_hora))
    -- INSERTAMOS VALORES EN LA TABLA
    INSERT @Produc_Opt VALUES (@time_parc,@nsacos, @produc_opt_parc)
    -- Avanzamos el cursor
    FETCH NEXT FROM cursorHora INTO @time_parc,@nsacos
    END
    /************  FIN DEL BUCLE QUE SE MUEVE A TRAVES DEL CURSOR  ***************/
    -- Cerramos el cursor
    CLOSE cursorHora
    -- Liberamos  los cursores
    DEALLOCATE cursorHora
    RETURN 
    END

    You can search the forums for that error message and find previous discussions - they all boil down to the same problem.  Somewhere in your query that calls this function, the code invoked implicitly converts from string to date/datetime.  In general,
    this works in any version of sql server if the runtime settings are correct for the format of the string data.  The fact that it works in one server and not in another server suggests that the query executes with different settings - and I'll assume for
    the moment that the format of the data involved in this conversion is consistent within the database/resultset and consistent between the 2 servers. 
    I suggest you read Tibor's guide to the datetime datatype (via the link to his site below) first - then go find the actual code that performs this conversion.  It may not be in the function you posted, since that function also executes other functions. 
    You also did not post the query that calls this function, so this function may not, in fact, be the source of the problem at all. 
    Tibor's site

  • Having problems converting pdf to word. I'm not able to convert the file, what do I need to do?

    having problems converting pdf to word. I'm not able to convert the file, what do I need to do?

    Hi prates77,
    I'm sorry to hear that you're having trouble converting files. Are you receiving the conversion error regardless of the file that you try to convert? Does the error occur whether you use the web interface, or convert via Reader? And an odd question: how many files do you have stored in your Acrobat.com account? We have seen reports of this error when there are a large number of files stored in the root folder of your Acrobat.com account.
    I look forward to hearing back from you.
    Best,
    Sara

  • Problem converting Excel Charts

    I am using Acrobat 9.3.4 (pro extended) and MS Office 2007 service pack 2.  I am having problems converting the charts in Excel.  The charts in Excel are vector, but when I print to the Acrobat driver or save in Acrobat, the graphs are converted to a low quality bitmap.  Any ideas how I can preserve the quality of the original graph?  Any idea how I can preserve the vector drawings?

    I suspect the upgrade to Excel 2007 is at fault here, but I have not found any settings to get my old functionality back.  I posted the same question to an Excel board, and they referred me to a similar thread, which sounds like other people are having similar problems.
    It looks like some older version of Excel was having trouble when people used "save as pdf" (Excel was resizing the graphic and moving it off the page.)  To eliminate the problem, they seem to have changed their graphics creation engine from vector to bitmap.
    I have an older version of Excel (2003 sp3) at home, and the pie charts, for example, are clearly being created as vector drawings.  In Excel 2007, they appear to be bitmaps created at screen resolution, which in my case is a fuzzy mess because of the need to resize the drawings.  On the Excel board, there is a link to a "hotfix" but I don't know if it is the same issue.  I will post the link here if it works.
    I tried beating my head against the keyboard, but it has not helped.

  • Problem converting graphics to hyperlinks in pdf's

    I'm having a problem converting grapics, words or phrases to hyperlinks in exported pdf's.  The only thing that converts is a complete URL even though the test for source and destination work perfectly.

    In Indesign if you want to generate a PDF you "export". You have two options: Print or Interactive. If you use Interactive it will include hyperlinks by default. If you choose Print you need to check it:

Maybe you are looking for