Error that i cant figure out!...
mypr2.java:71: 'class' or 'interface' expected
public double calcMilesTraveled(dataSet ds, double frstEnt, double sndEnt ) {
^
mypr2.java:122: 'class' or 'interface' expected
^
mypr2.java:128: 'class' or 'interface' expected
^
////////// methods //////////
/////////////////// load data collection ////////////////////////
public dataCollection loadDataCollection() {
//String whichTrack = "stock";
String whichTrack = "gas";
// Load all datasets from specified directory
dataCollection dc = new dataCollection("pr2.data/", whichTrack);
return dc;
/////////////////// tally distance traveled ////////////////////////
public void tallyDistanceTraveled(dataCollection dc) {
// variables: totalDistanceTraveled
// set totalDistanceTraveled to 0
// loop through all datasets within dataCollection:
// milesTraveled = calcMilesTraveled(dataset)
// incr totalDistanceTraveled appropriately
System.out.println(
"\n============= beginning PR2 warmup =========");
System.out.println(
"\n============= print first stockVal from all files =========");
int numDataSets = dc.size(); // determine number of data sets in collection
for (int i=0; i<numDataSets; i++) {
dataSet ds = dc.get(i); // get the ith dataset
String filename = ds.sourceFileName;
int j = 0;
//for (int j=0; j<0; j++)
dataEl el = ds.get(j); // get the 0th element of the ith dataset
double value = el.getMainValue(); // get the associated main value
int dateInt = el.getDateInt();
//for (int dateInt=0; dateInt<0; dateInt++) {
System.out.println("data set " + filename + ": value " + value + dateInt);
// ... continue with our implementation
/////////////////// calcMilesTraveled ////////////////////////
public double calcMilesTraveled(dataSet ds, double frstEnt, double sndEnt ) {
// variables:
// firstDataEl, lastDataEl (both of type dataEl)
// firstDataVal, lastDataVal (both of type double)
// milesTraveled
// firstDataVal, lastDataVal (both of type double)
// milesTraveled
// pseudocode:
// assign firstDataEl to the first element of ds
// calc number of data elements in dataSet ds
// use this to assign lastDataEl to the last element of ds
// use these two variables to correctly set firstDataVal and lastDataVal
// calculate milesTraveled
// return this result
dataEl firstDataEl = ds.get(frstEnt);
dataEl lastDataEl = ds.get(sndEnt);
double firstDataVal = firstDataEl.getMainValue();
double lastDataVal = lastDataEl.getMainValue();
int milesTraveled = 0;
return milesTraveled;
//System.out.println("first data" + firstDataEl);
/////////////////// main ////////////////////////
public static void main(String[] args) {
// Example to be worked through in class:
// calculate the total number of miles reported traveled by
// all those watching their odometers
// Variables: collection (a dataCollection)
// collection = loadDataCollection(gas)
// tallyDistanceTraveled(collection)
// tallyDistanceTraveled(collection)
pr2 myCode = new myCode();
myCode.calcMilesTraveled(ds,frstEnt,sndEnt);
myCode.loadDataCollection();
myCode.tallyDistanceTraveled(dc);
}
You have an extra closing curly brace. As a result, the method that the error message is pointing to is outside of any class, and the compiler is expecting a class declaration.
Just be sure that all your methods are defined inside of classes or interfaces.
Similar Messages
-
i would like to know how to solve this problem without erasing what is currently on my phone.
You can transfer songs that you didn't buy from the iTunes store but it requires third party software such as Suneti. This is one of the best programs I know for the task and unfortunately I'm not aware of any freeware programs that transfer music from an iOS device to the computer.
-
I cant figure out how to authorize my office computer to download songs that I have purchased. A message saying I cant do it, but gives me no link to make it happen. Frustrating.Can someone help?
If you're running iTunes 11 and you don't see the menus, press Control-B or go to the small icon with the arrow at the extreme upper left and select "Show Menu Bar":
Apple for some inexplicable reason elected to hide the menus by default in the Windows version of iTunes 11.
I doubt that this will address a download problem, though. You'll need to provide more details about that; what device you're attempting the download on, the exact error message, and other such pertinent information.
Regards. -
I purchased a song off of itunes and it said it downloaded successfully, but when i try to listen to that song it only plays 2 seconds of that song and i cant figure out how to download that song again. What can i do.
Delete it, click here, and follow the instructions.
(88741) -
I've got movies on my computer on itunes, however my parents wish that i use my laptop for itunes stuff, and i cant figure out how to get those movies to be able to sync with my ipod again, it wont recognize that I have them. Suggestions?
While you're in itunes, with the leftside window open, click on Apps. Then, look across the top middle of your itunes screen. You will see several choices: All, Iphone/iPad Touch, Ipad, Ipod Games, List, and Updates.
Clicking on each of these gives you a different view.
When you select ALL you will see all of your apps. When you select Updates you sill see only the apps that need to be updated. When you are in Updates you will see the Update button in the lower right corner.
Hope this helps. -
In updating my iTunes,I got a message "Service Apple Mobile Device failed to start. verify that you have sufficent priviliges to start system services". Cant figure out what to do
So many people are having this problem! Doehunter's instructions here worked for me! Hope this helps. https://discussions.apple.com/message/23824640#23824640
-
I have my ipod shuffle plugged into a diffrent computer associated with it for ittunes, but i cant figure out how to maually manage my music without erasing all the songs already on my ipod shuffle... so how do i do that? I've done it before with my old ipod before it broke. I really need help with this!
I have my ipod shuffle plugged into a diffrent computer associated with it for ittunes, but i cant figure out how to maually manage my music without erasing all the songs already on my ipod shuffle... so how do i do that? I've done it before with my old ipod before it broke. I really need help with this!
-
MY pages documents on my ipad wont sync to icloud. Some of the documents have had the upload icon on them for over a month. It was all working fine a month or so ago but I cant figure out why it wont work now.
Why start a new and very similar thread to your other one which you have not responded to (have you read the replies?)
I suggest that no response is made to this duplicate thread. -
My mini died. bought one used from a friend... all of my songs and books are on my iPhone, and I cant figure out how to get them onto this new computer. this is frustrating. the things i really want are purchases I've made from itunes store... help
!!!!!Hey kevyg3,
I was able to find an article that I believe will help you move your iTunes purchases from your iPhone over to your new computer:
iTunes Store: Transferring purchases from your iOS device or iPod to a computer
http://support.apple.com/kb/HT1848
Hope this helps,
David -
My ipod touch is disabled, i installed the latest version of itunes, but cant figure out how to restore the ipod, can anyone help?
If you run into the "another installation" message even after the reboot of the PC (which is an excellent idea by HTP ProXy), reregistering your Windows Installer Service is worth a try.
First, launch a command prompt as an administrator. In your Start search, type cmd then right-click on the cmd that comes up and select "Run as administrator".
At the command prompt:
Type %windir%\system32\msiexec.exe /unregister and hit enter.
Type %windir%\syswow64\msiexec.exe /unregister and hit enter.
Type %windir%\system32\msiexec.exe /regserver and hit enter.
Type %windir%\syswow64\msiexec.exe /regserver and hit enter.
Restart the PC and try another reinstalll. -
My mac is version 10.5.8 and I cant figure out how to up date it.
My friends mac is a version 10.5.8 and i cant figure out how to up date it. The last update says it was february of 2011...
The first step in Upgrading... is to Snow Leopard = OS X 10.6.x
It is Not available as a download... It is a Paid Upgrade.
Do this first...
Check that your Mac meets the System Requirements for Snow Leopard...
Snow Leopard Tech Specs
http://support.apple.com/kb/SP575
If so... Purchase a Snow Leopard Install Disc...
http://store.apple.com/us/product/MC573Z/A/mac-os-x-106-snow-leopard
Other countries...
http://support.apple.com/kb/HE57
After the Successful Install, run Software Update to get the latest updates for Snow Leopard.
Be sure to make a Backup of your Current System Before Upgrading... -
my lock button is jammed and i read somewhere that you can turn your phone on through itunes. i have tried plugging it up to a charger and doing everything you can imagine to get the button unjammed. i cant figure out how to use itunes to get it to turn on, any advice or know of another way?
maybe your power button is pushed down and won't allow it to turn on.
usually when you touch any button on an iphone, it will turn on. wether it's the home or power button.
you should take your phone into the apple store. -
i bought this off of my friend and now i cant figure out how to down load music onto it its and ipod shuffle
Hey kevyg3,
I was able to find an article that I believe will help you move your iTunes purchases from your iPhone over to your new computer:
iTunes Store: Transferring purchases from your iOS device or iPod to a computer
http://support.apple.com/kb/HT1848
Hope this helps,
David -
i tried to sinc my photos and i ended up deleting off my phone all the pictures. i only ended up with one folder, and i cant figure out how to put rest of folders from my computer back on my phone.....help
and on a second problem. I need to know for sure that my contacts are backed up on my computerCreate a parent folder on your computer to store the named folders of photos that you want transferred to your iPhone. Under the Photos tab for your iPhone sync preferences with iTunes, select the parent folder. All named folders of photos within will be transferred to your iPhone as separate folders or albums.
Regarding your 2nd question, this should be easy. Your contacts should be available on your computer with or without an iPhone or any cell phone, which can be lost or stolen.
Although contacts are included with your iPhone's backup which is updated by iTunes as the first step during the iTunes sync process, not a good idea to depend on this either since the iPhone backup includes a significant amount of other data. Contacts are designed to be synced with a supported address book app on your computer. With Windoze, this can be with Outlook 2003, 2007, or 2010 along with syncing calendar events and notes, or with the address book app used by Outlook Express with XP and by Windows Mail with Vista and Windows 7 called Windows Contacts for syncing contacts only. -
I have an older mac and it wants me to update to itunes 10 but my mac is too old and I cant figure out how to disable the update so I can use the store.
If Software Update is offering the update then it would be compatible with your model. Unfortunately, you haven't provided us with any information on your hardware that would enable us to determine if it really is too old.
If you really wish to disable the update alert then the next time Software Update opens, select the update in the list then select "Ignore update" from SU's Update menu.
Maybe you are looking for
-
Also, myt Adobe Audition application won't open! I need to fix this fast. Is this a result of moving from purchased applications to CC?
-
Is there a time limit for a podcast to publish on iweb?
I am creating a podcast in Garageband. I would like to do it in a series of 13 minutes for each lecture. Is there a time limit or file size restriction to publish on my website in iweb?
-
Skipping dependent Tables in Logical Standby
Hello DBAs I need your expertise here. Let me explain the scenario. Suppose a table is skipped in a logical standby. This table is referred by other tables and there are dependencies on this table. Now my question is what happens when a transaction i
-
TSV_TNEW_PAGE_ALLOC_FAILED error in report
Hi Experts, I am trying to run a report which will retrieve the Active BPs for a particular product Id in CRM environment. I am trying to run the report on development in background mode. It is being canceled out and TSV_TNEW_PAGE
-
On the latest operating system where do I find my iPhoto library
Where do I find my iPhoto library in the latest operating system?