Can someone please help... I'm stuck!!!
I am working on an assignment for my java class, and I am stuck. This is the 1st programming class that i have taken and am a little confused. I am supposed to write a program that inputs 5 numbers and determines and prints the number of negative numbers, positive numbers, and zeros that were inputed.
This is what i have so far:
import java.util.Scanner;
public class test
public static void main (String[] args)
Scanner input = new Scanner (System.in);
int number;
int negative = 0;
int positive = 0;
int zero = 0;
int numberCounter = 1;
while (numberCounter <=5)
System.out.print("Please enter a number:");
number = input.nextInt();
if (number == 0)
zero = zero +1;
else
negative=negative+1;
numberCounter = numberCounter + 1;
System.out.printf( " Positive: %d\n Negative: %d\n Zero: %d\n", positive, negative, zero);
I don't know how to add another arugment to the if statement for the positive numbers. As of right now, it only correctly adds the zeros and displays the rest as negative numbers. Thank you!
You're almost there; the syntax of an if-then-else statement is easy:if (<condition>) <statement> else <statement>The if-then-else thing is a statement itself, so:if (<condition>) <statement> else if (<condition>)<statement> else <statement>... is valid too. So your extra condition is simply:if (number == 0)
zero++; // same as zero= zero+1
else if (number > 0)
positive++;
else
negative++;kind regards,
Jos
Similar Messages
-
i have an iPhone 4 that is stuck in a recovery loop. i try to restore it but it comes up with an error code (-1) towards the end of the restore. can someone please help me?
i just baught it off someone.. so im unsure if it was jailbroken or not.. and i dont think its under warranty now.
is there a software or something along those lines that would indicate what peice of hardware is faulty?
i baught it in this recovery loop thinking it was going to be a cheap way of getting a new phone without having to do much.. but now im starting to think its a brick -
i have an ipod touch 3rd gen.I used the function of erasing all contents and settings and now i am stuck with this screen showing the apple logo and the loading sign for the past 17 hours.CAN SOMEONE PLEASE HELP!!!!!!!!!!!!
Hold down the on/off button and the home button for 20 to 30 sec, when the iPod starts and the Apple logo is on the screen release the on/off button but continue to hold the home button until you see the plug into iTunes screen. Connect the iPod to iTunes and you should be good to go.
-
My "fn" button is stuck on only revealing mission control in Lion. With this problem none of my "f" keys will work nor can I hold "fn" and delete to delete text in opposite direction. Can someone please help with this?
Following the fix here worked for me:
https://discussions.apple.com/message/15680566#15680566
except my plist file was in ~/Library instead of /Library.
-Scott -
I tried updating my iPod 5th gen to iOS 8 but it only shows me a picture of the iTunes logo and a charger at the bottom, I'm not sure what this means or what I need to do. Can someone please help me?
After restoring to factory settings/new iPod you will then have to restore from backup
To restore from backup see:
iOS: Back up and restore your iOS device with iCloud or iTunes
If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
You can redownload most iTunes purchases by:
Downloading past purchases from the App Store, iBookstore, and iTunes Store -
My iPhone 4 will not sync my new voice memos from the "Voice Memos" app to my computer. This is frustrating, should not be so hard, can someone please help. I use PC with windows 7 with iPhone version 6.1.3 and iTunes most recent. Thanks.
In the Music tab of iTunes, do you have 'Include Voice Memos' checked?
-
First of all, I live in Ho Chi Minh City, Vietnam. Sometimes, I use a VPN to search on the web here. I purchased Toy Story 3 on my MacBook Pro 2011 OS/X - Lion through iTunes. I initially had trouble downloading it which may be due to being on and off the VPN but after a while it finally downloaded and shows up in my iTunes library on my MacBook.
Under my Apple ID account (which is the only Apple ID account I have), I look under purchase history and it shows that I paid for Toy Story which is where I got my Order # from. But if you go to the iTunes Store then to the Quick Links then click on Purchased, under all my Movies, it does NOT show Toy Story 3 as one of my movies.
Now when I go to my iPad (3rd gen.), Toy Story 3 does not show up under purchased movies (all or not on my iPad). It does not show up on my Apple TV as well. If I want to have Toy Story 3 on my iPad or Apple TV, then it says I have to purchase it again.
I have searched for help via Apple support communities but so far none of their solutions have worked for me. I have tried logging off iTunes & App Store on iPad and also shutting down the iPad. I also made sure that under iTunes Preferences>Store that iTunes in the Clouds purchases is checked. Can someone please help me with this? Your consideration is greatly appreciated. Thanks.Thanks King_Penguin for taking time to read and reply.
I just purchased this movie on Thursday, May 15, so just a few days ago. I have never had any trouble whatsoever since I have been in Vietnam. I have downloaded several movies and even music and they have all synced to my respected Apple products except for this purchase.
Sorry, I don't quite understand what you mean by studios and different versions. Could you please explain?
I checked my purchased list in my purchase history under my account and there are no hidden items. -
hi... can someone please help me.. i want to download the latest ios, but do not have the software update option in the general settings....
Connect it to iTunes on a computer and update it from there.
(73609) -
Updated my iphone4 with ios6.1 software. App store is not working. Tried rebooting, restoring, changing date, signing with another apple id etc. but no luck. can someone please help?
I guess I will wrap this up. I have abandoned iPhoto and viewing my Photo Streams using it and moved to Adobe products (Bridge + PS). So that's that.
-
Can someone please help me re-install my Creative Design 5.5 on my Mac? My MacBook Pro recently crashed and had to have the hard drive replaced. The back up from Time Machine is not reinstalling the program. Since I have the download paid, and codes, I need direction on how to reinstall -- HELP?
Hi bodegakc,
If you have the serial number then please use the below mentioned link to download the product you are looking for .
CS5.5
Also before installing Please go to Applications-->Utilities--> Adobe installers and if there is any uninstaller for CS5.5 , you can remove it and do a fresh install.
You can also use creative cloud cleaner tool before installing.
Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6
Thanks
Nikhil Gupta -
I keep getting an error can someone please help
i am trying to develop a web application using tomcat. i have a servlet that will not compile because of two things. firstly, it says that package beans does not exist and secondle it gives an error becuase im using a user bean here to set some attributes but it keeps saying it cannot resolve symbol User. can someone please help me sort this out. thanks
You need to package the bean classes in the proper package (in your case beans), and then place them in WEB-INF/classes/<package dirs>.
Then you need to import the classes in the JSP.
Cheers!
***Annie*** -
can someone please help me as its not letting me turn it on. i have tried to start it up pressing both buttons connecting to itunes and its not working still., it wont even charge or show apple icon anymore,
You may not get a response as you are shouting at everyone.
All caps indicates shouting, is considered rude, and is difficult to read.
Many will not read such posts.
Try turning off you caps lock and asking again. -
Hi,
My iphone 4 won't connect to my mac book, it says that I need to install to latest version of itunes 11.1. When I go to itunes and try to update, it says that I have the latest version (10.6.3). Can someone please help me!
thanksYou are probably running OS 10.4 or 10.5 on a PPC Mac. No version of iTunes higher than 10.6.3 is available for these older Macs. I have the same problem, and while I can still use the PPC to sync my iPod, it can't be used to sync an iPhone 4 or higher. The only solution, as I discovered after upgrading to the iPhone 4, is to buy a newer Mac. I was able to get a 2006 MacBook running Lion for under $300, and that has been a lifesaver.
-
My safari keeps closing unexpectedly and when it does it tells me that it quite while using the .GameHouseBeachParty.so plugin. I have no idea what this means! Can someone please help me fix this?
You have the Flashback trojan.
Check out the replies in this thread for what to do;
https://discussions.apple.com/message/18114958#18114958 -
I imported all my pics to Iphoto and I can't open/edit them now. When I double click on them, I only get an exclamation mark. Please help me I don't have copies. I tried burning them to a cd but it didn't work. Can someone please help me?
The ! turns up when iPhoto loses the connection between the thumbnail in the iPhoto Window and the file it represents.
What version of iPhoto? Assuming 09 or later...
Option 1
Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
If that fails:
Option 2
Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. .
Regards
TD -
'm trying to transfer the music from my iPhone 3G to my iPod shuffle using iTunes but I don't know how. I checked on websites but i dont really trust them cause I don't want all my music to be erased (cause i spent a lot of money on them) can someone PLEASE help me. Why is iTunes so complicated.
iTunes match - http://www.apple.com/itunes/itunes-match/ - see FAQ at end too
http://arstechnica.com/apple/2011/11/itunes-match-your-questions-answered/
http://ipod.about.com/od/UsingiOS5/a/Itunes-Match-Frequently-Asked-Questions.htm
http://forums.macrumors.com/showthread.php?t=1277415 - deleting items from your computer but saving them in iCloud. Yes, but risky.
Maybe you are looking for
-
Wireless Function Not Working Correctly
When I try to print wirelessly, it prints 2-3 pages and then quits printing, often right in the middle of a page, and tells me there was a printing error. When I print through a cable, it works perfectly. The printer is about 13 feet away from the in
-
I recently ugraded to appleworks 6 from 5 on a PC with Win XP Pro. I had a database created in 5 which was imported to 6. My problem is that when I create a new record and I type in text, when I move to the next field the text disappears. If I go int
-
Problem pricing CRMD_BUS2000115
We have a problem in transaction CRMD_BUS2000115. The pricing is not based on field "PricingRefProd." when we fill in this field with the BADI method CRM_PRODUCT_I_MERGE. We enter product 'A'. This is automatically replaced by 'B', thats fine, but we
-
Dear sir , In Service Master for a specific type of services where "work contrct tax" is applicable , we mention Service Type as "WCT" . Our requirement is that at the time of MIRO , a message / pop-up message should be appeared on screen indicating
-
How can I turn document saved in Acrobat PDF back into multipage AI PDF document.
I accidentally saved my multipage AI PDF document in acrobat. Now i can't open it in AI as it original multipage AI PDF document. How can I access tye document in it original multipage AI PDF document format?