Basic java but i am getting an error in netbeans 6.5
public class math {
* @param args the command line arguments
public static void main(String[] args) {
int x = (int) Math.PI * 20.0;
System.out.println(x);
found : double
required: int
int x = (int) Math.PI * 20.0;
1 error
BUILD FAILED (total time: 0 seconds)
aszxcv02 wrote:
i am doing a book example that the int is suppose to round pie to 3 and then multiple by 20 so the answer will be 60
i just copied straight out the book and i was suppose to get back 60.Use parentheses or - if it is exactly as you describe - multiply by 20 rather than 20.0.
The point is that when you take pi cast to an int (ie, truncated to 3) and multiply it by a double you will get a double result. The compiler complains when you try and assign this double to an int variable.
Edited by: pbrockway2 on Dec 27, 2008 2:00 PM
Slow ;(
But make sure you understand why it works. There is an order to things:
(a) Get the double Math.pi
(b) Truncate it to an int
(c) Multiply the int by the int value 20
What does int x = (int)(Math.PI * 20.0); do? Why?
Similar Messages
-
I am unable to update apps on my iPhone 4. I tried rebooting but still I get an error message which says "unable to update"
I really didnt want to restore unless i had absolutely other option.
as per usual, apple wont help unless i buy an apple care plan. helpful much. -
I'm trying to purchase and download a movie, but I keep getting message error that I have no space. The error states that I must delete some photos or videos in order to download. I've gone to iPod then edit and deleted some videos, but I'm still getting the message. What is the correct way to delete the videos and should they still be there.
They wont still be there if you delete them,but if you have those same photos on the main computer.
-
I am getting an Error when I try to open Firefox that Says Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system. This has happened several times recently. I deinstalld and reinstalled but am still getting the error. Any thoughts?
This happens to me as well. However, I have a shortcut on my desktop as well as my quick start bar. When this has happened to me, I can usually log back in without restarting, by using the shortcut on the desktop rather than the usual quick start bar.
I know this sounds weird, but it has worked for me about 80% of the time. -
I am trying to burn a music cd on iTunes, but I am getting an error that reads that the cd burner is being used by another application. I know that I am not using the cd burner for anything else. I have restarted the Mac and nothing. Any ideas?
One other thread said it was fixed by waiting till prompted by iTunes to insert the blank disk, instead of putting it in first. Does that work? Found a number of hits on this Googling.
-
Dear ALL,
i am trying to export the combained PDF based on BOOK opetion using below scripts. but i am getting following error message "Invalid value for parameter 'to' of method 'exportFile'. Expected File, but received 1952403524". anyone knows, please suggest me solutions.
var myBookFileName ,myBookFileName_temp;
if ( myFolder != null )
var myFiles = [];
var myAllFilesList = myFolder.getFiles("*.indd");
for (var f = 0; f < myAllFilesList.length; f++)
var myFile = myAllFilesList[f];
myFiles.push(myFile);
if ( myFiles.length > 0 )
myBookFileName = myFolder + "/"+ myFolder.name + ".indb";
myBookFileName_temp=myFolder.name ;
myBookFile = new File( myBookFileName );
myBook = app.books.add( myBookFile );
myBook.automaticPagination = false;
for ( i=0; i < myFiles.length; i++ )
myBook.bookContents.add( myFiles[i] );
var pdfFile =File(File(myFolder).fsName + "\\"+myBookFileName_temp+"_WEB.pdf");
var bookComps = myBook.bookContents;
if (bookComps.length === 1)
bookComps = [bookComps];
var myPDFExportPreset = app.pdfExportPresets.item("AER6");
app.activeBook.exportFile(ExportFormat.PDF_TYPE,File("D:\\AER\\WEBPDF.pdf"),false,myPDFEx portPreset,bookComps);
//myBook.exportFile (ExportFormat.pdfType, pdfFile, false);
//myBook.exportFile(pdfFile, false, pdfPref, bookComps);
myBook.close(SaveOptions.yes);Change the below line:
app.activeBook.exportFile(ExportFormat.PDF_TYPE,File("D:\\AER\\WEBPDF.pdf"),false,myPDFExp ortPreset,bookComps);
to
app.activeBook.exportFile(ExportFormat.PDF_TYPE,File("D:\\AER\\WEBPDF.pdf"),false,myPDFExp ortPreset);
Vandy -
I updated my itunes to 11 and found out my phone and ipod were not compatible. I uninstalled it and reinstalled 10.7 but now I get an error message when I try to open itunes saying "the file cannot be read because it was created by a newer verison" What do I do?
Thank you for clarify I'm supposed to read the ENTIRE article. I thought I was just supposed to read the title and magically everything will fix itself. I appreciate you taking the time to help me however I do not appreciate the caps and the way you have addressed the situation. If you are not going to kindly help people/make suggestions just don't try! And for the record my conclusions are not illogical, the iOS7 thing is on the website in small font (which I got by reading the ENTIRE thing) and you should really find a new hobby because your socialization skills need some help! That goes for you too Chris. Not everyone is a tech nerd
-
I'm trying to backup a my hard drive with disk utility but I'm getting an error Unable to create Backup.dmg" (input/output error). Is there any other way to save my data? I believe my hard drive is failing or corrupt file. I can't boot up. Grey screen and spinning wheel. I've tried everything https://discussions.apple.com/message/20580424#20580424
any help will be greatly appreciated.Check here. Also have you done a TimeMachine back up?
http://support.apple.com/kb/TS2570 -
I have a tried to format my seagate free agent 1TB external hard drive so I can use it, but I keep getting an error message saying it failed. Can n e 1 help me plz
This article has a link for more information on finding your profile directory: [[Fix the "Could not initialize the application's security component" error message]]. On Windows 7, you can try this (either in a Windows Explorer window address bar or from the start menu search box):
%APPDATA%\Mozilla\Firefox\Profiles
You may see one folder in there and that's the one you want. If you see more than one, look for the one with the most recently modified files. -
My Ipod is stuck in recovery mode with the plug in to itunes thing on the screen I tryed to restore it but I keep getting a error 28 and I tryed to do the reset thing but it did not work what do I do?
Hi,
You could see if this helps...
DFU Mode / Unable to Update or Restore
http://support.apple.com/kb/HT1808
DFU Mode
Open iTunes and Connect the iPod to your Mac
Press and Hold the Sleep/Wake Button and the Home Button at the Same Time
After 10 Seconds release the Sleep/Wake Button until iTunes tells you it has Detected an iPod in Recovery Mode...
The Phone Screen will remain Black... Now Restore.
Backing up, Updating and Restoring
http://support.apple.com/kb/HT1414 -
I just downloaded Mountain Lion and everything is working great. But i keep getting an error in the app store and i can't download 'Pages' or any other apps. I keep getting an "error" and it says credit card processing is temporarily unavailable......help
Try deleting the cache associated with the App Store.
Quit the App Store if it's open.
Open the Finder. From the Finder menu bar click Go > Go to Folder
Type this exactly as you see it here:
~/Library/Caches/com.apple.appstore/Cache.db
Click Go
Move the Cache.db file to the Trash.
Launch the App Store. See if that made a difference... -
Hello,
I want to install Photoshop but everytime I get an ERROR CODE: A12E1.How do I solve that and what is it?A12E1 error installing Creative Cloud products | CC
Mylenium -
I downloaded the icloud software on my computer in order to sync calenders and contacts using Windows 2007, but I keep getting an error message when trying to sync my icloud and Outlook calendars. I downloaded it for the first time a month ago and had it working but it stopped syncing, so I deinstalled the iCloud software and reinstalled, but keep getting the error message "Your setup couldn't be started because of an unexpected error. What do I do now? Can anyone help with this?
Hello easbda,
Thank you for providing the details of the calendar issue you are experiencing with your iPhone. I recommend following the steps in the section titled "Troubleshooting on Microsoft Windows (Microsoft Outlook)" in the following article to assist with syncing your calendar events between your devices:
iCloud: Troubleshooting iCloud Calendar
http://support.apple.com/kb/ts3999
Thank you for using Apple Support Communities.
Best,
Sheila M. -
I'm trying to logon on to my itunes, but I keep getting an error "The progro can't start because MSVCR80.dll is missing from your computer. Try reinstalling the program to fix the problem.
iTunes 11.1.4 for Windows - Unable to install or open - MSVCR80 issue - http://support.apple.com/kb/TS5376
iTunes for Windows: Missing MSVCR80.dll - https://sites.google.com/site/appleclubfhs/support/advice-and-articles/itunes-wi ndows-missing-msvcr80-dll - install as administrator. -
I was in the middle of the iOS 8 update and tried to turn my phone off (yes, I realize this was dumb) But what happened was it tried to reset. Now, my iphone 4s has the connect to itunes screen. I have tried to reset, recover, etc but I keep getting and error -51 message. Any ideas how I can get my phone working again? I am not worried about saving any info just having a phone to use!
Try a Hard Reset.....
Press and hold the Wake / Sleep button AND the Home button at the same time, keep them both pressed until the Apple Logo appears on the screen, it can take 10 or more seconds. Ignore the swipe to turn off message.
Maybe you are looking for
-
Workaround for function to_blob in Oracle 8i
Hi all, this query run in Oracle 9i but not in oracle 8i: select to_lob(dbms_lob.substr(data,dbms_lob.getlength(data)-dbms_lob.instr(data,'3F3E')-1,dbms_lob.instr(data,'3F3E')+4)) as stream_data, filename as stream_name, substr(filename,instr(filenam
-
Admin server on MS window while Managed Server on Unix
Hi, Is it possible to run Weblogic Administrative server 7.0 SP1 on MS Windows Platform while run the Managed (or Clustered) Server instances on several Unix box such as HPUX or Solaris? thanks
-
Org.apache.axis2.AxisFault: The service cannot be found for the endpoint
Hi Team, I'm getting following error while runnig WebServices [ERROR] The service cannot be found for the endpoint reference (EPR) /TestServices/services org.apache.axis2.AxisFault: The service cannot be found for the endpoint reference (EPR) /TestSe
-
Link externally edited files to the original, like Aperture does
This is one thing I really like about Aperture - when you edit files externally, Aperture keeps track of them, and keeps them associated with the original. That little bit of housekeeping is a very nice touch.
-
Problem: Extension Manager not working - have loaded EM 1.7 w DW8
I have tried to load extensions. The message says: "Macromedia Extension Manager Can not up date a file The extension can not be installed." I have deleted both D8 and EM 1.7. I have downloaded the latest update to Dreamweaver 8: http://www.adobe.com